chrome-devtools-frontend 1.0.1012587 → 1.0.1013237
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/gni/devtools_grd_files.gni +2 -0
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/en-US.json +21 -0
- package/front_end/core/i18n/locales/en-XL.json +21 -0
- package/front_end/core/sdk/CSSFontFace.ts +6 -0
- package/front_end/generated/InspectorBackendCommands.js +2 -0
- package/front_end/generated/protocol.ts +16 -0
- package/front_end/panels/application/AppManifestView.ts +12 -1
- package/front_end/panels/application/components/ProtocolHandlersView.ts +182 -0
- package/front_end/panels/application/components/components.ts +2 -0
- package/front_end/panels/application/components/protocolHandlersView.css +39 -0
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +15 -15
- package/front_end/third_party/lighthouse/report/bundle.d.ts +23 -2
- package/front_end/third_party/lighthouse/report/bundle.js +45 -19
- package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +16 -11
- package/front_end/ui/components/linear_memory_inspector/linearMemoryInspector.css +4 -0
- package/package.json +1 -1
- package/scripts/build/ninja/devtools_entrypoint.gni +3 -3
- package/scripts/build/ninja/wasm.gni +25 -0
- package/scripts/build/wasm-as.py +87 -0
- package/scripts/build/wasm_sourcemap.mjs +22 -0
@@ -847,6 +847,7 @@ grd_files_debug_sources = [
|
|
847
847
|
"front_end/panels/application/components/InterestGroupAccessGrid.js",
|
848
848
|
"front_end/panels/application/components/OriginTrialTreeView.js",
|
849
849
|
"front_end/panels/application/components/PermissionsPolicySection.js",
|
850
|
+
"front_end/panels/application/components/ProtocolHandlersView.js",
|
850
851
|
"front_end/panels/application/components/ReportsGrid.js",
|
851
852
|
"front_end/panels/application/components/StackTrace.js",
|
852
853
|
"front_end/panels/application/components/TrustTokensView.js",
|
@@ -857,6 +858,7 @@ grd_files_debug_sources = [
|
|
857
858
|
"front_end/panels/application/components/originTrialTokenRows.css.js",
|
858
859
|
"front_end/panels/application/components/originTrialTreeView.css.js",
|
859
860
|
"front_end/panels/application/components/permissionsPolicySection.css.js",
|
861
|
+
"front_end/panels/application/components/protocolHandlersView.css.js",
|
860
862
|
"front_end/panels/application/components/reportingApiGrid.css.js",
|
861
863
|
"front_end/panels/application/components/stackTraceLinkButton.css.js",
|
862
864
|
"front_end/panels/application/components/stackTraceRow.css.js",
|
@@ -345,7 +345,8 @@ export enum Action {
|
|
345
345
|
PerfPanelTraceImported = 54,
|
346
346
|
PerfPanelTraceExported = 55,
|
347
347
|
StackFrameRestarted = 56,
|
348
|
-
|
348
|
+
CaptureTestProtocolClicked = 57,
|
349
|
+
MaxValue = 58,
|
349
350
|
}
|
350
351
|
|
351
352
|
/* eslint-disable @typescript-eslint/naming-convention */
|
@@ -2426,6 +2426,9 @@
|
|
2426
2426
|
"panels/application/AppManifestView.ts | primaryManifestIconFromS": {
|
2427
2427
|
"message": "Primary manifest icon from {PH1}"
|
2428
2428
|
},
|
2429
|
+
"panels/application/AppManifestView.ts | protocolHandlers": {
|
2430
|
+
"message": "Protocol Handlers"
|
2431
|
+
},
|
2429
2432
|
"panels/application/AppManifestView.ts | screenshot": {
|
2430
2433
|
"message": "Screenshot"
|
2431
2434
|
},
|
@@ -3197,6 +3200,24 @@
|
|
3197
3200
|
"panels/application/components/PermissionsPolicySection.ts | showDetails": {
|
3198
3201
|
"message": "Show details"
|
3199
3202
|
},
|
3203
|
+
"panels/application/components/ProtocolHandlersView.ts | manifest": {
|
3204
|
+
"message": "manifest"
|
3205
|
+
},
|
3206
|
+
"panels/application/components/ProtocolHandlersView.ts | needHelpReadOur": {
|
3207
|
+
"message": "Need help? Read {PH1}."
|
3208
|
+
},
|
3209
|
+
"panels/application/components/ProtocolHandlersView.ts | protocolDetected": {
|
3210
|
+
"message": "Found valid protocol handler registration in the {PH1}. With the app installed, test the registered protocols."
|
3211
|
+
},
|
3212
|
+
"panels/application/components/ProtocolHandlersView.ts | protocolHandlerRegistrations": {
|
3213
|
+
"message": "URL protocol handler registration for PWAs"
|
3214
|
+
},
|
3215
|
+
"panels/application/components/ProtocolHandlersView.ts | protocolNotDetected": {
|
3216
|
+
"message": "Define protocol handlers in the {PH1} to register your app as a handler for custom protocols when your app is installed."
|
3217
|
+
},
|
3218
|
+
"panels/application/components/ProtocolHandlersView.ts | testProtocol": {
|
3219
|
+
"message": "Test protocol"
|
3220
|
+
},
|
3200
3221
|
"panels/application/components/ReportsGrid.ts | destination": {
|
3201
3222
|
"message": "Destination"
|
3202
3223
|
},
|
@@ -2426,6 +2426,9 @@
|
|
2426
2426
|
"panels/application/AppManifestView.ts | primaryManifestIconFromS": {
|
2427
2427
|
"message": "P̂ŕîḿâŕŷ ḿâńîf́êśt̂ íĉón̂ f́r̂óm̂ {PH1}"
|
2428
2428
|
},
|
2429
|
+
"panels/application/AppManifestView.ts | protocolHandlers": {
|
2430
|
+
"message": "P̂ŕôt́ôćôĺ Ĥán̂d́l̂ér̂ś"
|
2431
|
+
},
|
2429
2432
|
"panels/application/AppManifestView.ts | screenshot": {
|
2430
2433
|
"message": "Ŝćr̂éêńŝh́ôt́"
|
2431
2434
|
},
|
@@ -3197,6 +3200,24 @@
|
|
3197
3200
|
"panels/application/components/PermissionsPolicySection.ts | showDetails": {
|
3198
3201
|
"message": "Ŝh́ôẃ d̂ét̂áîĺŝ"
|
3199
3202
|
},
|
3203
|
+
"panels/application/components/ProtocolHandlersView.ts | manifest": {
|
3204
|
+
"message": "m̂án̂íf̂éŝt́"
|
3205
|
+
},
|
3206
|
+
"panels/application/components/ProtocolHandlersView.ts | needHelpReadOur": {
|
3207
|
+
"message": "N̂éêd́ ĥél̂ṕ? R̂éâd́ {PH1}."
|
3208
|
+
},
|
3209
|
+
"panels/application/components/ProtocolHandlersView.ts | protocolDetected": {
|
3210
|
+
"message": "F̂óûńd̂ v́âĺîd́ p̂ŕôt́ôćôĺ ĥán̂d́l̂ér̂ ŕêǵîśt̂ŕât́îón̂ ín̂ t́ĥé {PH1}. Ŵít̂h́ t̂h́ê áp̂ṕ îńŝt́âĺl̂éd̂, t́êśt̂ t́ĥé r̂éĝíŝt́êŕêd́ p̂ŕôt́ôćôĺŝ."
|
3211
|
+
},
|
3212
|
+
"panels/application/components/ProtocolHandlersView.ts | protocolHandlerRegistrations": {
|
3213
|
+
"message": "ÛŔL̂ ṕr̂ót̂óĉól̂ h́âńd̂ĺêŕ r̂éĝíŝt́r̂át̂íôń f̂ór̂ ṔŴÁŝ"
|
3214
|
+
},
|
3215
|
+
"panels/application/components/ProtocolHandlersView.ts | protocolNotDetected": {
|
3216
|
+
"message": "D̂éf̂ín̂é p̂ŕôt́ôćôĺ ĥán̂d́l̂ér̂ś îń t̂h́ê {PH1} t́ô ŕêǵîśt̂ér̂ ýôúr̂ áp̂ṕ âś â h́âńd̂ĺêŕ f̂ór̂ ćûśt̂óm̂ ṕr̂ót̂óĉól̂ś ŵh́êń ŷóûŕ âṕp̂ íŝ ín̂śt̂ál̂ĺêd́."
|
3217
|
+
},
|
3218
|
+
"panels/application/components/ProtocolHandlersView.ts | testProtocol": {
|
3219
|
+
"message": "T̂éŝt́ p̂ŕôt́ôćôĺ"
|
3220
|
+
},
|
3200
3221
|
"panels/application/components/ReportsGrid.ts | destination": {
|
3201
3222
|
"message": "D̂éŝt́îńât́îón̂"
|
3202
3223
|
},
|
@@ -10,12 +10,14 @@ export class CSSFontFace {
|
|
10
10
|
readonly #fontVariationAxes: Protocol.CSS.FontVariationAxis[];
|
11
11
|
readonly #fontVariationAxesByTag: Map<string, Protocol.CSS.FontVariationAxis>;
|
12
12
|
readonly #src: Platform.DevToolsPath.UrlString;
|
13
|
+
readonly #fontDisplay: string;
|
13
14
|
|
14
15
|
constructor(payload: Protocol.CSS.FontFace) {
|
15
16
|
this.#fontFamily = payload.fontFamily;
|
16
17
|
this.#fontVariationAxes = payload.fontVariationAxes || [];
|
17
18
|
this.#fontVariationAxesByTag = new Map();
|
18
19
|
this.#src = payload.src as Platform.DevToolsPath.UrlString;
|
20
|
+
this.#fontDisplay = payload.fontDisplay;
|
19
21
|
for (const axis of this.#fontVariationAxes) {
|
20
22
|
this.#fontVariationAxesByTag.set(axis.tag, axis);
|
21
23
|
}
|
@@ -29,6 +31,10 @@ export class CSSFontFace {
|
|
29
31
|
return this.#src;
|
30
32
|
}
|
31
33
|
|
34
|
+
getFontDisplay(): string {
|
35
|
+
return this.#fontDisplay;
|
36
|
+
}
|
37
|
+
|
32
38
|
getVariationAxisByTag(tag: string): Protocol.CSS.FontVariationAxis|undefined {
|
33
39
|
return this.#fontVariationAxesByTag.get(tag);
|
34
40
|
}
|
@@ -287,6 +287,7 @@ export function registerCommands(inspectorBackend) {
|
|
287
287
|
GeolocationInsecureOriginDeprecatedNotRemoved: 'GeolocationInsecureOriginDeprecatedNotRemoved',
|
288
288
|
GetUserMediaInsecureOrigin: 'GetUserMediaInsecureOrigin',
|
289
289
|
HostCandidateAttributeGetter: 'HostCandidateAttributeGetter',
|
290
|
+
IdentityInCanMakePaymentEvent: 'IdentityInCanMakePaymentEvent',
|
290
291
|
InsecurePrivateNetworkSubresourceRequest: 'InsecurePrivateNetworkSubresourceRequest',
|
291
292
|
LegacyConstraintGoogIPv6: 'LegacyConstraintGoogIPv6',
|
292
293
|
LocalCSSFileExtensionRejected: 'LocalCSSFileExtensionRejected',
|
@@ -296,6 +297,7 @@ export function registerCommands(inspectorBackend) {
|
|
296
297
|
NotificationInsecureOrigin: 'NotificationInsecureOrigin',
|
297
298
|
NotificationPermissionRequestedIframe: 'NotificationPermissionRequestedIframe',
|
298
299
|
ObsoleteWebRtcCipherSuite: 'ObsoleteWebRtcCipherSuite',
|
300
|
+
OpenWebDatabaseInsecureContext: 'OpenWebDatabaseInsecureContext',
|
299
301
|
PictureSourceSrc: 'PictureSourceSrc',
|
300
302
|
PrefixedCancelAnimationFrame: 'PrefixedCancelAnimationFrame',
|
301
303
|
PrefixedRequestAnimationFrame: 'PrefixedRequestAnimationFrame',
|
@@ -1034,6 +1034,7 @@ export namespace Audits {
|
|
1034
1034
|
GeolocationInsecureOriginDeprecatedNotRemoved = 'GeolocationInsecureOriginDeprecatedNotRemoved',
|
1035
1035
|
GetUserMediaInsecureOrigin = 'GetUserMediaInsecureOrigin',
|
1036
1036
|
HostCandidateAttributeGetter = 'HostCandidateAttributeGetter',
|
1037
|
+
IdentityInCanMakePaymentEvent = 'IdentityInCanMakePaymentEvent',
|
1037
1038
|
InsecurePrivateNetworkSubresourceRequest = 'InsecurePrivateNetworkSubresourceRequest',
|
1038
1039
|
LegacyConstraintGoogIPv6 = 'LegacyConstraintGoogIPv6',
|
1039
1040
|
LocalCSSFileExtensionRejected = 'LocalCSSFileExtensionRejected',
|
@@ -1043,6 +1044,7 @@ export namespace Audits {
|
|
1043
1044
|
NotificationInsecureOrigin = 'NotificationInsecureOrigin',
|
1044
1045
|
NotificationPermissionRequestedIframe = 'NotificationPermissionRequestedIframe',
|
1045
1046
|
ObsoleteWebRtcCipherSuite = 'ObsoleteWebRtcCipherSuite',
|
1047
|
+
OpenWebDatabaseInsecureContext = 'OpenWebDatabaseInsecureContext',
|
1046
1048
|
PictureSourceSrc = 'PictureSourceSrc',
|
1047
1049
|
PrefixedCancelAnimationFrame = 'PrefixedCancelAnimationFrame',
|
1048
1050
|
PrefixedRequestAnimationFrame = 'PrefixedRequestAnimationFrame',
|
@@ -1785,6 +1787,10 @@ export namespace CSS {
|
|
1785
1787
|
* Pseudo element type.
|
1786
1788
|
*/
|
1787
1789
|
pseudoType: DOM.PseudoType;
|
1790
|
+
/**
|
1791
|
+
* Pseudo element custom ident.
|
1792
|
+
*/
|
1793
|
+
pseudoIdentifier?: string;
|
1788
1794
|
/**
|
1789
1795
|
* Matches of CSS rules applicable to the pseudo style.
|
1790
1796
|
*/
|
@@ -3172,6 +3178,11 @@ export namespace DOM {
|
|
3172
3178
|
* Pseudo element type for this node.
|
3173
3179
|
*/
|
3174
3180
|
pseudoType?: PseudoType;
|
3181
|
+
/**
|
3182
|
+
* Pseudo element identifier for this node. Only present if there is a
|
3183
|
+
* valid pseudoType.
|
3184
|
+
*/
|
3185
|
+
pseudoIdentifier?: string;
|
3175
3186
|
/**
|
3176
3187
|
* Shadow root type.
|
3177
3188
|
*/
|
@@ -4760,6 +4771,11 @@ export namespace DOMSnapshot {
|
|
4760
4771
|
* Type of a pseudo element node.
|
4761
4772
|
*/
|
4762
4773
|
pseudoType?: RareStringData;
|
4774
|
+
/**
|
4775
|
+
* Pseudo element identifier for this node. Only present if there is a
|
4776
|
+
* valid pseudoType.
|
4777
|
+
*/
|
4778
|
+
pseudoIdentifier?: RareStringData;
|
4763
4779
|
/**
|
4764
4780
|
* Whether this DOM node responds to mouse clicks. This includes nodes that have had click
|
4765
4781
|
* event listeners attached via JavaScript as well as anchor tags that naturally navigate when
|
@@ -15,6 +15,7 @@ import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
15
15
|
import * as UI from '../../ui/legacy/legacy.js';
|
16
16
|
import type * as Protocol from '../../generated/protocol.js';
|
17
17
|
import * as IconButton from '../../ui/components/icon_button/icon_button.js';
|
18
|
+
import * as ApplicationComponents from './components/components.js';
|
18
19
|
|
19
20
|
const UIStrings = {
|
20
21
|
/**
|
@@ -44,6 +45,10 @@ const UIStrings = {
|
|
44
45
|
/**
|
45
46
|
*@description Text in App Manifest View of the Application panel
|
46
47
|
*/
|
48
|
+
protocolHandlers: 'Protocol Handlers',
|
49
|
+
/**
|
50
|
+
*@description Text in App Manifest View of the Application panel
|
51
|
+
*/
|
47
52
|
icons: 'Icons',
|
48
53
|
/**
|
49
54
|
*@description Text for the name of something
|
@@ -423,6 +428,7 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
|
|
423
428
|
private target?: SDK.Target.Target;
|
424
429
|
private resourceTreeModel?: SDK.ResourceTreeModel.ResourceTreeModel|null;
|
425
430
|
private serviceWorkerManager?: SDK.ServiceWorkerManager.ServiceWorkerManager|null;
|
431
|
+
private protocolHandlersView: ApplicationComponents.ProtocolHandlersView.ProtocolHandlersView;
|
426
432
|
constructor() {
|
427
433
|
super(true);
|
428
434
|
|
@@ -448,8 +454,10 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
|
|
448
454
|
this.errorsSection = this.reportView.appendSection(i18nString(UIStrings.errorsAndWarnings));
|
449
455
|
this.installabilitySection = this.reportView.appendSection(i18nString(UIStrings.installability));
|
450
456
|
this.identitySection = this.reportView.appendSection(i18nString(UIStrings.identity));
|
451
|
-
|
452
457
|
this.presentationSection = this.reportView.appendSection(i18nString(UIStrings.presentation));
|
458
|
+
const protocolHandlersSection = this.reportView.appendSection(i18nString(UIStrings.protocolHandlers));
|
459
|
+
this.protocolHandlersView = new ApplicationComponents.ProtocolHandlersView.ProtocolHandlersView();
|
460
|
+
protocolHandlersSection.contentElement.append(this.protocolHandlersView);
|
453
461
|
this.iconsSection = this.reportView.appendSection(i18nString(UIStrings.icons), 'report-section-icons');
|
454
462
|
this.shortcutSections = [];
|
455
463
|
this.screenshotsSections = [];
|
@@ -701,6 +709,9 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
|
|
701
709
|
this.newNoteUrlField.appendChild(link);
|
702
710
|
}
|
703
711
|
|
712
|
+
const protocolHandlers = parsedManifest['protocol_handlers'] || [];
|
713
|
+
this.protocolHandlersView.data = {protocolHandlers, manifestLink: url};
|
714
|
+
|
704
715
|
const icons = parsedManifest['icons'] || [];
|
705
716
|
this.iconsSection.clearContent();
|
706
717
|
|
@@ -0,0 +1,182 @@
|
|
1
|
+
// Copyright 2022 The Chromium Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
import * as Host from '../../../core/host/host.js';
|
6
|
+
import * as i18n from '../../../core/i18n/i18n.js';
|
7
|
+
import * as Platform from '../../../core/platform/platform.js';
|
8
|
+
import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
9
|
+
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
10
|
+
import * as IconButton from '../../../ui/components/icon_button/icon_button.js';
|
11
|
+
import * as Input from '../../../ui/components/input/input.js';
|
12
|
+
// inspectorCommonStyles is imported for the chrome-select class that is used for the dropdown
|
13
|
+
// eslint-disable-next-line rulesdir/es_modules_import
|
14
|
+
import inspectorCommonStyles from '../../../ui/legacy/inspectorCommon.css.js';
|
15
|
+
import * as UI from '../../../ui/legacy/legacy.js';
|
16
|
+
import * as LitHtml from '../../../ui/lit-html/lit-html.js';
|
17
|
+
|
18
|
+
import protocolHandlersViewStyles from './protocolHandlersView.css.js';
|
19
|
+
|
20
|
+
const PROTOCOL_DOCUMENT_URL = 'https://web.dev/url-protocol-handler/';
|
21
|
+
const UIStrings = {
|
22
|
+
/**
|
23
|
+
*@description Status message for when protocol handlers are detected in the manifest
|
24
|
+
*@example {protocolhandler/manifest.json} PH1
|
25
|
+
*/
|
26
|
+
protocolDetected:
|
27
|
+
'Found valid protocol handler registration in the {PH1}. With the app installed, test the registered protocols.',
|
28
|
+
/**
|
29
|
+
*@description Status message for when protocol handlers are not detected in the manifest
|
30
|
+
*@example {protocolhandler/manifest.json} PH1
|
31
|
+
*/
|
32
|
+
protocolNotDetected:
|
33
|
+
'Define protocol handlers in the {PH1} to register your app as a handler for custom protocols when your app is installed.',
|
34
|
+
/**
|
35
|
+
*@description Text wrapping a link pointing to more information on handling protocol handlers
|
36
|
+
*@example {https://example.com/} PH1
|
37
|
+
*/
|
38
|
+
needHelpReadOur: 'Need help? Read {PH1}.',
|
39
|
+
/**
|
40
|
+
*@description Link text for more information on URL protocol handler registrations for PWAs
|
41
|
+
*/
|
42
|
+
protocolHandlerRegistrations: 'URL protocol handler registration for PWAs',
|
43
|
+
/**
|
44
|
+
*@description In text hyperlink to the PWA manifest
|
45
|
+
*/
|
46
|
+
manifest: 'manifest',
|
47
|
+
/**
|
48
|
+
*@description Text for test protocol button
|
49
|
+
*/
|
50
|
+
testProtocol: 'Test protocol',
|
51
|
+
};
|
52
|
+
|
53
|
+
const str_ = i18n.i18n.registerUIStrings('panels/application/components/ProtocolHandlersView.ts', UIStrings);
|
54
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
55
|
+
|
56
|
+
interface HTMLSelectElementEvent extends Event {
|
57
|
+
target: HTMLSelectElement;
|
58
|
+
}
|
59
|
+
|
60
|
+
interface HTMLInputElementEvent extends Event {
|
61
|
+
target: HTMLInputElement;
|
62
|
+
}
|
63
|
+
|
64
|
+
export interface ProtocolHandler {
|
65
|
+
protocol: string;
|
66
|
+
url: string;
|
67
|
+
}
|
68
|
+
|
69
|
+
export interface ProtocolHandlersData {
|
70
|
+
protocolHandlers: ProtocolHandler[];
|
71
|
+
manifestLink: Platform.DevToolsPath.UrlString;
|
72
|
+
}
|
73
|
+
|
74
|
+
export class ProtocolHandlersView extends HTMLElement {
|
75
|
+
static readonly litTagName = LitHtml.literal`devtools-protocol-handlers-view`;
|
76
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
77
|
+
#protocolHandlers: ProtocolHandler[] = [];
|
78
|
+
#manifestLink: Platform.DevToolsPath.UrlString = Platform.DevToolsPath.EmptyUrlString;
|
79
|
+
#selectedProtocolState: string = '';
|
80
|
+
#queryInputState: string = '';
|
81
|
+
|
82
|
+
set data(data: ProtocolHandlersData) {
|
83
|
+
const isNewManifest = this.#manifestLink !== data.manifestLink;
|
84
|
+
this.#protocolHandlers = data.protocolHandlers;
|
85
|
+
this.#manifestLink = data.manifestLink;
|
86
|
+
if (isNewManifest) {
|
87
|
+
this.#update();
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
#update(): void {
|
92
|
+
this.#queryInputState = '';
|
93
|
+
this.#selectedProtocolState = this.#protocolHandlers[0]?.protocol ?? '';
|
94
|
+
this.#render();
|
95
|
+
}
|
96
|
+
|
97
|
+
#renderStatusMessage(): LitHtml.TemplateResult {
|
98
|
+
const manifestInTextLink = UI.XLink.XLink.create(this.#manifestLink, i18nString(UIStrings.manifest));
|
99
|
+
const statusString = this.#protocolHandlers.length > 0 ? UIStrings.protocolDetected : UIStrings.protocolNotDetected;
|
100
|
+
const iconData: IconButton.Icon.IconData = {
|
101
|
+
iconName: this.#protocolHandlers.length > 0 ? 'ic_checkmark_16x16' : 'ic_info_black_18dp',
|
102
|
+
color: this.#protocolHandlers.length > 0 ? 'var( --color-ic-file-image)' : 'var(--color-link)',
|
103
|
+
width: '16px',
|
104
|
+
};
|
105
|
+
return LitHtml.html`
|
106
|
+
<div class="protocol-handlers-row status">
|
107
|
+
<${IconButton.Icon.Icon.litTagName} class="inline-icon" .data=${iconData as IconButton.Icon.IconData}>
|
108
|
+
</${IconButton.Icon.Icon.litTagName}>
|
109
|
+
${i18n.i18n.getFormatLocalizedString(str_, statusString, {
|
110
|
+
PH1: manifestInTextLink,
|
111
|
+
})}
|
112
|
+
</div>
|
113
|
+
`;
|
114
|
+
}
|
115
|
+
|
116
|
+
#renderProtocolTest(): LitHtml.LitTemplate {
|
117
|
+
if (this.#protocolHandlers.length === 0) {
|
118
|
+
return LitHtml.nothing;
|
119
|
+
}
|
120
|
+
const protocolOptions = this.#protocolHandlers.filter(p => p.protocol)
|
121
|
+
.map(p => LitHtml.html`<option value=${p.protocol}>${p.protocol}://</option>`);
|
122
|
+
return LitHtml.html`
|
123
|
+
<div class="protocol-handlers-row">
|
124
|
+
<select class="chrome-select protocol-select" @change=${this.#handleProtocolSelect}>
|
125
|
+
${protocolOptions}
|
126
|
+
</select>
|
127
|
+
<input .value=${this.#queryInputState} class="devtools-text-input" type="text" @change=${
|
128
|
+
this.#handleQueryInputChange}/>
|
129
|
+
<${Buttons.Button.Button.litTagName} .variant=${Buttons.Button.Variant.PRIMARY} @click=${
|
130
|
+
this.#handleTestProtocolClick}>
|
131
|
+
${i18nString(UIStrings.testProtocol)}
|
132
|
+
</${Buttons.Button.Button.litTagName}>
|
133
|
+
</div>
|
134
|
+
`;
|
135
|
+
}
|
136
|
+
|
137
|
+
#handleProtocolSelect = (evt: HTMLSelectElementEvent): void => {
|
138
|
+
this.#selectedProtocolState = evt.target.value;
|
139
|
+
};
|
140
|
+
|
141
|
+
#handleQueryInputChange = (evt: HTMLInputElementEvent): void => {
|
142
|
+
this.#queryInputState = evt.target.value;
|
143
|
+
this.#render();
|
144
|
+
};
|
145
|
+
|
146
|
+
#handleTestProtocolClick = (): void => {
|
147
|
+
const protocolURL = `${this.#selectedProtocolState}://${this.#queryInputState}` as Platform.DevToolsPath.UrlString;
|
148
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(protocolURL);
|
149
|
+
Host.userMetrics.actionTaken(Host.UserMetrics.Action.CaptureTestProtocolClicked);
|
150
|
+
};
|
151
|
+
|
152
|
+
connectedCallback(): void {
|
153
|
+
this.#shadow.adoptedStyleSheets = [
|
154
|
+
protocolHandlersViewStyles,
|
155
|
+
inspectorCommonStyles,
|
156
|
+
Input.textInputStyles,
|
157
|
+
];
|
158
|
+
}
|
159
|
+
|
160
|
+
#render(): void {
|
161
|
+
const protocolDocLink =
|
162
|
+
UI.XLink.XLink.create(PROTOCOL_DOCUMENT_URL, i18nString(UIStrings.protocolHandlerRegistrations));
|
163
|
+
// clang-format off
|
164
|
+
LitHtml.render(LitHtml.html`
|
165
|
+
${this.#renderStatusMessage()}
|
166
|
+
<div class="protocol-handlers-row">
|
167
|
+
${i18n.i18n.getFormatLocalizedString(str_, UIStrings.needHelpReadOur, {PH1: protocolDocLink})}
|
168
|
+
</div>
|
169
|
+
${this.#renderProtocolTest()}
|
170
|
+
`, this.#shadow, {host: this});
|
171
|
+
// clang-format on
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
ComponentHelpers.CustomElements.defineComponent('devtools-protocol-handlers-view', ProtocolHandlersView);
|
176
|
+
|
177
|
+
declare global {
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
179
|
+
interface HTMLElementTagNameMap {
|
180
|
+
'devtools-protocol-handlers-view': ProtocolHandlersView;
|
181
|
+
}
|
182
|
+
}
|
@@ -7,6 +7,7 @@ import * as EndpointsGrid from './EndpointsGrid.js';
|
|
7
7
|
import * as FrameDetailsView from './FrameDetailsView.js';
|
8
8
|
import * as InterestGroupAccessGrid from './InterestGroupAccessGrid.js';
|
9
9
|
import * as OriginTrialTreeView from './OriginTrialTreeView.js';
|
10
|
+
import * as ProtocolHandlersView from './ProtocolHandlersView.js';
|
10
11
|
import * as ReportsGrid from './ReportsGrid.js';
|
11
12
|
import * as StackTrace from './StackTrace.js';
|
12
13
|
import * as TrustTokensView from './TrustTokensView.js';
|
@@ -17,6 +18,7 @@ export {
|
|
17
18
|
FrameDetailsView,
|
18
19
|
InterestGroupAccessGrid,
|
19
20
|
OriginTrialTreeView,
|
21
|
+
ProtocolHandlersView,
|
20
22
|
ReportsGrid,
|
21
23
|
StackTrace,
|
22
24
|
TrustTokensView,
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2022 The Chromium Authors. All rights reserved.
|
3
|
+
* Use of this source code is governed by a BSD-style license that can be
|
4
|
+
* found in the LICENSE file.
|
5
|
+
*/
|
6
|
+
|
7
|
+
.devtools-link {
|
8
|
+
color: var(--color-link);
|
9
|
+
text-decoration: underline;
|
10
|
+
cursor: pointer;
|
11
|
+
padding: 2px 0; /* adjust focus ring size */
|
12
|
+
}
|
13
|
+
|
14
|
+
input.devtools-text-input[type="text"] {
|
15
|
+
padding: 3px 6px;
|
16
|
+
margin-left: 4px;
|
17
|
+
margin-right: 4px;
|
18
|
+
width: 250px;
|
19
|
+
height: 25px;
|
20
|
+
}
|
21
|
+
|
22
|
+
.protocol-handlers-row {
|
23
|
+
margin: 10px 0 2px 18px;
|
24
|
+
}
|
25
|
+
|
26
|
+
.inline-icon {
|
27
|
+
vertical-align: text-bottom;
|
28
|
+
}
|
29
|
+
|
30
|
+
@media (forced-colors: active) {
|
31
|
+
.devtools-link:not(.devtools-link-prevent-click) {
|
32
|
+
color: linktext;
|
33
|
+
}
|
34
|
+
|
35
|
+
.devtools-link:focus-visible {
|
36
|
+
background: Highlight;
|
37
|
+
color: HighlightText;
|
38
|
+
}
|
39
|
+
}
|