chrome-devtools-frontend 1.0.1573331 → 1.0.1575174

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.
Files changed (132) hide show
  1. package/AUTHORS +1 -0
  2. package/docs/contributing/settings-experiments-features.md +5 -2
  3. package/front_end/Images/src/account-tree.svg +10 -1
  4. package/front_end/Images/src/arrow-right-circle.svg +2 -7
  5. package/front_end/Images/src/center-focus-weak.svg +3 -1
  6. package/front_end/Images/src/dog-paw.svg +10 -3
  7. package/front_end/Images/src/group.svg +3 -1
  8. package/front_end/Images/src/home.svg +3 -1
  9. package/front_end/Images/src/spark-info.svg +3 -3
  10. package/front_end/Images/src/spark.svg +2 -9
  11. package/front_end/core/common/Settings.ts +1 -1
  12. package/front_end/core/host/InspectorFrontendHostAPI.ts +5 -1
  13. package/front_end/core/host/InspectorFrontendHostStub.ts +10 -0
  14. package/front_end/core/host/UserMetrics.ts +15 -0
  15. package/front_end/core/root/Runtime.ts +119 -39
  16. package/front_end/core/sdk/AnimationModel.ts +0 -6
  17. package/front_end/devtools_compatibility.js +16 -1
  18. package/front_end/entrypoints/main/GlobalAiButton.ts +18 -3
  19. package/front_end/entrypoints/main/MainImpl.ts +13 -1
  20. package/front_end/generated/InspectorBackendCommands.ts +6 -4
  21. package/front_end/generated/SupportedCSSProperties.js +17 -4
  22. package/front_end/generated/protocol-mapping.d.ts +2 -0
  23. package/front_end/generated/protocol-proxy-api.d.ts +2 -0
  24. package/front_end/generated/protocol.ts +37 -7
  25. package/front_end/models/ai_assistance/AiUtils.ts +8 -0
  26. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +3 -3
  27. package/front_end/models/ai_assistance/agents/StylingAgent.ts +5 -4
  28. package/front_end/models/issues_manager/CorsIssue.ts +1 -44
  29. package/front_end/models/logs/NetworkLog.ts +0 -9
  30. package/front_end/models/stack_trace/StackTrace.ts +40 -0
  31. package/front_end/panels/ai_assistance/PatchWidget.ts +2 -1
  32. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +34 -13
  33. package/front_end/panels/ai_assistance/components/ChatInput.ts +24 -2
  34. package/front_end/panels/ai_assistance/components/ChatMessage.ts +3 -1
  35. package/front_end/panels/ai_assistance/components/ChatView.ts +20 -3
  36. package/front_end/panels/ai_assistance/components/chatView.css +20 -0
  37. package/front_end/panels/common/AiCodeCompletionTeaser.ts +3 -1
  38. package/front_end/panels/common/AiCodeGenerationUpgradeDialog.ts +32 -16
  39. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +1 -1
  40. package/front_end/panels/console/ConsoleFormat.ts +31 -2
  41. package/front_end/panels/console/ConsoleInsightTeaser.ts +8 -2
  42. package/front_end/panels/elements/ElementsTreeElement.ts +47 -1
  43. package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
  44. package/front_end/panels/issues/CorsIssueDetailsView.ts +0 -46
  45. package/front_end/panels/network/NetworkDataGridNode.ts +3 -1
  46. package/front_end/panels/profiler/HeapDetachedElementsView.ts +0 -5
  47. package/front_end/panels/profiler/HeapProfileView.ts +0 -6
  48. package/front_end/panels/profiler/HeapSnapshotView.ts +0 -14
  49. package/front_end/panels/settings/AISettingsTab.ts +1 -1
  50. package/front_end/panels/settings/SettingsScreen.ts +12 -6
  51. package/front_end/panels/settings/settings-meta.ts +1 -0
  52. package/front_end/panels/sources/NavigatorView.ts +3 -1
  53. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -1
  54. package/front_end/panels/whats_new/ReleaseNoteText.ts +11 -11
  55. package/front_end/panels/whats_new/resources/WNDT.md +6 -6
  56. package/front_end/third_party/chromium/README.chromium +1 -1
  57. package/front_end/third_party/puppeteer/README.chromium +2 -2
  58. package/front_end/third_party/puppeteer/package/README.md +5 -0
  59. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/HTTPResponse.d.ts +6 -1
  60. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/HTTPResponse.d.ts.map +1 -1
  61. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/HTTPResponse.js +5 -1
  62. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/HTTPResponse.js.map +1 -1
  63. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +3 -0
  64. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  65. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +53 -55
  66. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  67. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +2 -0
  68. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  69. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +25 -0
  70. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  71. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts +7 -1
  72. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
  73. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +3 -0
  74. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
  75. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
  76. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js +2 -0
  77. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js.map +1 -1
  78. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  79. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +2 -0
  80. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  81. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  82. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  83. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  84. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  85. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  86. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  87. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  88. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +7 -1
  89. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +21 -8
  90. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/HTTPResponse.d.ts +6 -1
  91. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/HTTPResponse.d.ts.map +1 -1
  92. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/HTTPResponse.js +5 -1
  93. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/HTTPResponse.js.map +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +3 -0
  95. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +54 -56
  97. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +2 -0
  99. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +25 -0
  101. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts +7 -1
  103. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +3 -0
  105. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js +2 -0
  108. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js.map +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  110. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +2 -0
  111. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  113. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  114. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  116. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/types.d.ts +7 -1
  118. package/front_end/third_party/puppeteer/package/package.json +5 -5
  119. package/front_end/third_party/puppeteer/package/src/api/HTTPResponse.ts +7 -2
  120. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +62 -71
  121. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +29 -0
  122. package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +12 -1
  123. package/front_end/third_party/puppeteer/package/src/cdp/BrowserContext.ts +2 -0
  124. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +2 -0
  125. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  126. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  127. package/front_end/ui/components/buttons/Button.ts +26 -14
  128. package/front_end/ui/components/buttons/FloatingButton.ts +7 -3
  129. package/front_end/ui/components/buttons/floatingButton.css +44 -0
  130. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  131. package/mcp/HostBindings.ts +6 -0
  132. package/package.json +3 -2
@@ -5,7 +5,7 @@
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as i18n from '../../core/i18n/i18n.js';
7
7
  import type * as Platform from '../../core/platform/platform.js';
8
- import type * as Root from '../../core/root/root.js';
8
+ import * as Root from '../../core/root/root.js';
9
9
  import * as UI from '../../ui/legacy/legacy.js';
10
10
 
11
11
  import type * as AiAssistance from './ai_assistance.js';
@@ -34,6 +34,22 @@ const UIStrings = {
34
34
  * the current context
35
35
  */
36
36
  debugWithAi: 'Debug with AI',
37
+ /**
38
+ * @description The title of the Gemini panel.
39
+ */
40
+ gemini: 'Gemini',
41
+ /**
42
+ * @description The title of the command menu action for showing the Gemini panel.
43
+ */
44
+ showGemini: 'Show Gemini',
45
+ /**
46
+ * @description The setting title to enable the Gemini via the settings tab.
47
+ */
48
+ enableGemini: 'Enable Gemini',
49
+ /**
50
+ * @description Text of a context menu item to redirect to the Gemini panel with the current context
51
+ */
52
+ debugWithGemini: 'Debug with Gemini',
37
53
  /**
38
54
  * @description Message shown to the user if the DevTools locale is not
39
55
  * supported.
@@ -53,7 +69,12 @@ const UIStrings = {
53
69
 
54
70
  const str_ = i18n.i18n.registerUIStrings('panels/ai_assistance/ai_assistance-meta.ts', UIStrings);
55
71
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
56
- const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
72
+
73
+ // Host config is initialized after this module executes, so need to lazily select the string.
74
+ function i18nAiBrandedString(gemini: string, assistance: string) {
75
+ // eslint-disable-next-line @devtools/l10n-i18nString-call-only-with-uistrings
76
+ return () => Root.Runtime.hostConfig.devToolsGeminiRebranding?.enabled ? i18nString(gemini) : i18nString(assistance);
77
+ }
57
78
 
58
79
  const setting = 'ai-assistance-enabled';
59
80
 
@@ -102,8 +123,8 @@ function isAnyFeatureAvailable(config?: Root.Runtime.HostConfig): boolean {
102
123
  UI.ViewManager.registerViewExtension({
103
124
  location: UI.ViewManager.ViewLocationValues.DRAWER_VIEW,
104
125
  id: 'freestyler',
105
- commandPrompt: i18nLazyString(UIStrings.showAiAssistance),
106
- title: i18nLazyString(UIStrings.aiAssistance),
126
+ commandPrompt: i18nAiBrandedString(UIStrings.showGemini, UIStrings.showAiAssistance),
127
+ title: i18nAiBrandedString(UIStrings.gemini, UIStrings.aiAssistance),
107
128
  order: 10,
108
129
  persistence: UI.ViewManager.ViewPersistence.CLOSEABLE,
109
130
  hasToolbar: false,
@@ -118,7 +139,7 @@ Common.Settings.registerSettingExtension({
118
139
  category: Common.Settings.SettingCategory.AI,
119
140
  settingName: setting,
120
141
  settingType: Common.Settings.SettingType.BOOLEAN,
121
- title: i18nLazyString(UIStrings.enableAiAssistance),
142
+ title: i18nAiBrandedString(UIStrings.enableGemini, UIStrings.enableAiAssistance),
122
143
  defaultValue: false,
123
144
  reloadRequired: false,
124
145
  condition: isAnyFeatureAvailable,
@@ -146,7 +167,7 @@ UI.ActionRegistration.registerActionExtension({
146
167
  return [];
147
168
  },
148
169
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
149
- title: i18nLazyString(UIStrings.debugWithAi),
170
+ title: i18nAiBrandedString(UIStrings.debugWithGemini, UIStrings.debugWithAi),
150
171
  configurableBindings: false,
151
172
  async loadActionDelegate() {
152
173
  const AiAssistance = await loadAiAssistanceModule();
@@ -161,7 +182,7 @@ UI.ActionRegistration.registerActionExtension({
161
182
  return [];
162
183
  },
163
184
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
164
- title: i18nLazyString(UIStrings.debugWithAi),
185
+ title: i18nAiBrandedString(UIStrings.debugWithGemini, UIStrings.debugWithAi),
165
186
  configurableBindings: false,
166
187
  async loadActionDelegate() {
167
188
  const AiAssistance = await loadAiAssistanceModule();
@@ -177,7 +198,7 @@ UI.ActionRegistration.registerActionExtension({
177
198
  return [];
178
199
  },
179
200
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
180
- title: i18nLazyString(UIStrings.debugWithAi),
201
+ title: i18nAiBrandedString(UIStrings.debugWithGemini, UIStrings.debugWithAi),
181
202
  configurableBindings: false,
182
203
  async loadActionDelegate() {
183
204
  const AiAssistance = await loadAiAssistanceModule();
@@ -193,7 +214,7 @@ UI.ActionRegistration.registerActionExtension({
193
214
  return [];
194
215
  },
195
216
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
196
- title: i18nLazyString(UIStrings.debugWithAi),
217
+ title: i18nAiBrandedString(UIStrings.debugWithGemini, UIStrings.debugWithAi),
197
218
  configurableBindings: false,
198
219
  async loadActionDelegate() {
199
220
  const AiAssistance = await loadAiAssistanceModule();
@@ -209,7 +230,7 @@ UI.ActionRegistration.registerActionExtension({
209
230
  return [];
210
231
  },
211
232
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
212
- title: i18nLazyString(UIStrings.debugWithAi),
233
+ title: i18nAiBrandedString(UIStrings.debugWithGemini, UIStrings.debugWithAi),
213
234
  configurableBindings: false,
214
235
  async loadActionDelegate() {
215
236
  const AiAssistance = await loadAiAssistanceModule();
@@ -225,7 +246,7 @@ UI.ActionRegistration.registerActionExtension({
225
246
  return [];
226
247
  },
227
248
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
228
- title: i18nLazyString(UIStrings.debugWithAi),
249
+ title: i18nAiBrandedString(UIStrings.debugWithGemini, UIStrings.debugWithAi),
229
250
  configurableBindings: false,
230
251
  async loadActionDelegate() {
231
252
  const AiAssistance = await loadAiAssistanceModule();
@@ -241,7 +262,7 @@ UI.ActionRegistration.registerActionExtension({
241
262
  return [];
242
263
  },
243
264
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
244
- title: i18nLazyString(UIStrings.debugWithAi),
265
+ title: i18nAiBrandedString(UIStrings.debugWithGemini, UIStrings.debugWithAi),
245
266
  configurableBindings: false,
246
267
  async loadActionDelegate() {
247
268
  const AiAssistance = await loadAiAssistanceModule();
@@ -256,7 +277,7 @@ UI.ActionRegistration.registerActionExtension({
256
277
  return [];
257
278
  },
258
279
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
259
- title: i18nLazyString(UIStrings.debugWithAi),
280
+ title: i18nAiBrandedString(UIStrings.debugWithGemini, UIStrings.debugWithAi),
260
281
  configurableBindings: false,
261
282
  async loadActionDelegate() {
262
283
  const AiAssistance = await loadAiAssistanceModule();
@@ -135,6 +135,8 @@ export interface ViewInput {
135
135
  onRemoveImageInput: () => void;
136
136
  onImageUpload: (ev: Event) => void;
137
137
  onImagePaste: (event: ClipboardEvent) => void;
138
+ onImageDragOver: (event: DragEvent) => void;
139
+ onImageDrop: (event: DragEvent) => void;
138
140
  }
139
141
 
140
142
  export type ViewOutput = undefined;
@@ -289,6 +291,8 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
289
291
  maxlength="10000"
290
292
  @keydown=${input.onTextAreaKeyDown}
291
293
  @paste=${input.onImagePaste}
294
+ @dragover=${input.onImageDragOver}
295
+ @drop=${input.onImageDrop}
292
296
  @input=${(event: KeyboardEvent) => {
293
297
  input.onTextInputChange((event.target as HTMLInputElement).value);
294
298
  }}
@@ -550,12 +554,12 @@ export class ChatInput extends UI.Widget.Widget implements SDK.TargetManager.Obs
550
554
  });
551
555
  }
552
556
 
553
- #handleImagePaste = (event: ClipboardEvent): void => {
557
+ #handleImageDataTransferEvent(dataTransfer: DataTransfer|null, event: Event): void {
554
558
  if (this.conversationType !== AiAssistanceModel.AiHistoryStorage.ConversationType.STYLING) {
555
559
  return;
556
560
  }
557
561
 
558
- const files = event.clipboardData?.files;
562
+ const files = dataTransfer?.files;
559
563
  if (!files || files.length === 0) {
560
564
  return;
561
565
  }
@@ -567,6 +571,22 @@ export class ChatInput extends UI.Widget.Widget implements SDK.TargetManager.Obs
567
571
 
568
572
  event.preventDefault();
569
573
  void this.#handleLoadImage(imageFile);
574
+ }
575
+
576
+ #handleImagePaste = (event: ClipboardEvent): void => {
577
+ this.#handleImageDataTransferEvent(event.clipboardData, event);
578
+ };
579
+
580
+ #handleImageDragOver = (event: DragEvent): void => {
581
+ if (this.conversationType !== AiAssistanceModel.AiHistoryStorage.ConversationType.STYLING) {
582
+ return;
583
+ }
584
+
585
+ event.preventDefault();
586
+ };
587
+
588
+ #handleImageDrop = (event: DragEvent): void => {
589
+ this.#handleImageDataTransferEvent(event.dataTransfer, event);
570
590
  };
571
591
 
572
592
  async #handleLoadImage(file: File): Promise<void> {
@@ -663,6 +683,8 @@ export class ChatInput extends UI.Widget.Widget implements SDK.TargetManager.Obs
663
683
  onTextAreaKeyDown: this.onTextAreaKeyDown,
664
684
  onCancel: this.onCancel,
665
685
  onImageUpload: this.onImageUpload,
686
+ onImageDragOver: this.#handleImageDragOver,
687
+ onImageDrop: this.#handleImageDrop,
666
688
  },
667
689
  undefined, this.contentElement);
668
690
  }
@@ -292,6 +292,8 @@ export const DEFAULT_VIEW = (input: ChatMessageViewInput, output: ViewOutput, ta
292
292
  return;
293
293
  }
294
294
 
295
+ const icon = AiAssistanceModel.AiUtils.getIconName();
296
+
295
297
  // clang-format off
296
298
  Lit.render(html`
297
299
  <style>${Input.textInputStyles}</style>
@@ -301,7 +303,7 @@ export const DEFAULT_VIEW = (input: ChatMessageViewInput, output: ViewOutput, ta
301
303
  jslog=${VisualLogging.section('answer')}
302
304
  >
303
305
  <div class="message-info">
304
- <devtools-icon name="smart-assistant"></devtools-icon>
306
+ <devtools-icon name=${icon}></devtools-icon>
305
307
  <div class="message-name">
306
308
  <h2>${lockedString(UIStringsNotTranslate.ai)}</h2>
307
309
  </div>
@@ -7,7 +7,7 @@ import '../../../ui/components/spinners/spinners.js';
7
7
  import * as Host from '../../../core/host/host.js';
8
8
  import * as i18n from '../../../core/i18n/i18n.js';
9
9
  import type * as Platform from '../../../core/platform/platform.js';
10
- import type * as AiAssistanceModel from '../../../models/ai_assistance/ai_assistance.js';
10
+ import * as AiAssistanceModel from '../../../models/ai_assistance/ai_assistance.js';
11
11
  import * as Buttons from '../../../ui/components/buttons/buttons.js';
12
12
  import type {MarkdownLitRenderer} from '../../../ui/components/markdown_view/MarkdownView.js';
13
13
  import * as UI from '../../../ui/legacy/legacy.js';
@@ -30,6 +30,10 @@ const UIStringsNotTranslate = {
30
30
  * @description Text for the empty state of the AI assistance panel.
31
31
  */
32
32
  emptyStateText: 'How can I help you?',
33
+ /**
34
+ * @description Text for the empty state of the Gemini panel.
35
+ */
36
+ emptyStateTextGemini: 'Where should we start?',
33
37
  } as const;
34
38
 
35
39
  const lockedString = i18n.i18n.lockedString;
@@ -74,12 +78,18 @@ export interface Props {
74
78
  }
75
79
 
76
80
  interface ChatWidgetInput extends Props {
81
+ accountName: string;
77
82
  handleScroll: (ev: Event) => void;
78
83
  handleSuggestionClick: (title: string) => void;
79
84
  handleMessageContainerRef: (el: Element|undefined) => void;
80
85
  }
81
86
 
82
87
  const DEFAULT_VIEW: View = (input, output, target) => {
88
+ const chatUiClasses = classMap({
89
+ 'chat-ui': true,
90
+ gemini: AiAssistanceModel.AiUtils.isGeminiBranding(),
91
+ });
92
+
83
93
  const inputWidgetClasses = classMap({
84
94
  'chat-input-widget': true,
85
95
  sticky: !input.isReadOnly,
@@ -88,7 +98,7 @@ const DEFAULT_VIEW: View = (input, output, target) => {
88
98
  // clang-format off
89
99
  render(html`
90
100
  <style>${chatViewStyles}</style>
91
- <div class="chat-ui">
101
+ <div class=${chatUiClasses}>
92
102
  <main @scroll=${input.handleScroll} ${ref(element => { output.mainElement = element as HTMLElement; } )}>
93
103
  ${input.messages.length > 0 ? html`
94
104
  <div class="messages-container" ${ref(input.handleMessageContainerRef)}>
@@ -121,7 +131,12 @@ const DEFAULT_VIEW: View = (input, output, target) => {
121
131
  name="smart-assistant"
122
132
  ></devtools-icon>
123
133
  </div>
124
- <h1>${lockedString(UIStringsNotTranslate.emptyStateText)}</h1>
134
+ ${AiAssistanceModel.AiUtils.isGeminiBranding() ?
135
+ html`
136
+ <h1 class='greeting'>Hello, ${input.accountName}</h1>
137
+ <h1>${lockedString(UIStringsNotTranslate.emptyStateTextGemini)}</h1>
138
+ ` : html`<h1>${lockedString(UIStringsNotTranslate.emptyStateText)}</h1>`
139
+ }
125
140
  </div>
126
141
  <div class="empty-state-content">
127
142
  ${input.emptyStateSuggestions.map(({title, jslogContext}) => {
@@ -308,6 +323,8 @@ export class ChatView extends HTMLElement {
308
323
  this.#view(
309
324
  {
310
325
  ...this.#props,
326
+ // TODO(b/468206227): This needs to be a first name.
327
+ accountName: this.#props.userInfo.accountFullName ?? '',
311
328
  handleScroll: this.#handleScroll,
312
329
  handleSuggestionClick: this.#handleSuggestionClick,
313
330
  handleMessageContainerRef: this.#handleMessageContainerRef,
@@ -165,7 +165,27 @@ main {
165
165
  }
166
166
  }
167
167
 
168
+ .gemini {
169
+ .empty-state-container .icon {
170
+ display: none;
171
+ }
172
+
173
+ .empty-state-container .header {
174
+ align-items: flex-start;
175
+ }
176
+
177
+ .empty-state-content {
178
+ align-items: flex-start
179
+ }
180
+
181
+ .empty-state-container .greeting {
182
+ color: var(--sys-color-primary);
183
+ }
168
184
 
185
+ main {
186
+ align-items: flex-start;
187
+ }
188
+ }
169
189
 
170
190
  .change-summary {
171
191
  background-color: var(--sys-color-surface3);
@@ -8,6 +8,7 @@ import * as Common from '../../core/common/common.js';
8
8
  import * as Host from '../../core/host/host.js';
9
9
  import * as i18n from '../../core/i18n/i18n.js';
10
10
  import * as Root from '../../core/root/root.js';
11
+ import * as AIAssistance from '../../models/ai_assistance/ai_assistance.js';
11
12
  import * as AiCodeGeneration from '../../models/ai_code_generation/ai_code_generation.js';
12
13
  import * as Snackbars from '../../ui/components/snackbars/snackbars.js';
13
14
  import * as UI from '../../ui/legacy/legacy.js';
@@ -259,8 +260,9 @@ export class AiCodeCompletionTeaser extends UI.Widget.Widget {
259
260
  onAction = async(event: Event): Promise<void> => {
260
261
  event.preventDefault();
261
262
 
263
+ const iconName = AIAssistance.AiUtils.getIconName();
262
264
  const result = await FreDialog.show({
263
- header: {iconName: 'smart-assistant', text: lockedString(UIStringsNotTranslate.freDisclaimerHeader)},
265
+ header: {iconName, text: lockedString(UIStringsNotTranslate.freDisclaimerHeader)},
264
266
  reminderItems: this.#createReminderItems(),
265
267
  onLearnMoreClick: () => {
266
268
  void UI.ViewManager.ViewManager.instance().showView('chrome-ai');
@@ -19,33 +19,43 @@ const UIStringsNotTranslate = {
19
19
  */
20
20
  codeCompletionJustGotBetter: 'Code completion just got better',
21
21
  /**
22
- * @description First item in the description
23
- */
24
- asYouType: 'As you type, DevTools generates code suggestions to help you code faster.',
25
- /**
26
- * @description Second item in the description
22
+ * @description First item in the description.
27
23
  */
28
24
  describeCodeInComment:
29
- 'In Console and Sources, you can now describe the code you need in a comment, then press Ctrl+I to generate it.',
25
+ 'Pressing Ctrl+I on a comment in the Console and Sources panels now generates entire code blocks based on the instructions in the comment.',
30
26
  /**
31
- * @description Second item in the description
27
+ * @description First item in the description.
32
28
  */
33
29
  describeCodeInCommentForMacOs:
34
- 'In Console and Sources, you can now describe the code you need in a comment, then press Cmd+I to generate it.',
30
+ 'Pressing Cmd+I on a comment in the Console and Sources panels now generates entire code blocks based on the instructions in the comment.',
31
+ /**
32
+ * @description Second item in the description.
33
+ */
34
+ asYouType: 'You will still receive the real-time, as-you-type suggestions to help you code faster.',
35
+ /**
36
+ * @description Third item in the description.
37
+ */
38
+ disclaimerTextPrivacy:
39
+ 'To generate code suggestions, your console input, the history of your current console session, the currently inspected CSS, and the contents of the currently open file are shared with Google. This data may be seen by human reviewers to improve this feature.',
40
+ /**
41
+ * @description Third item in the description.
42
+ */
43
+ disclaimerTextPrivacyNoLogging:
44
+ 'To generate code suggestions, your console input, the history of your current console session, the currently inspected CSS, and the contents of the currently open file are shared with Google. This data will not be used to improve Google’s AI models. Your organization may change these settings at any time.',
35
45
  /**
36
46
  * @description Text for the manage in settings button in the upgrade notice dialog.
37
47
  */
38
48
  manageInSettings: 'Manage in settings',
39
49
  /**
40
- * @description Text for the got it button in the upgrade notice dialog.
50
+ * @description Text for the generate code button in the upgrade notice dialog.
41
51
  */
42
- gotIt: 'Got it',
52
+ generateCode: 'Generate code',
43
53
  } as const;
44
54
 
45
55
  const lockedString = i18n.i18n.lockedString;
46
56
 
47
57
  export class AiCodeGenerationUpgradeDialog {
48
- static show(): void {
58
+ static show({noLogging}: {noLogging: boolean}): void {
49
59
  const dialog = new UI.Dialog.Dialog();
50
60
  dialog.setAriaLabel(lockedString(UIStringsNotTranslate.codeCompletionJustGotBetter));
51
61
  // clang-format off
@@ -63,10 +73,6 @@ export class AiCodeGenerationUpgradeDialog {
63
73
  </h2>
64
74
  </header>
65
75
  <main class="reminder-container">
66
- <div class="reminder-item">
67
- <devtools-icon class="reminder-icon" name="code"></devtools-icon>
68
- <span>${lockedString(UIStringsNotTranslate.asYouType)}</span>
69
- </div>
70
76
  <div class="reminder-item">
71
77
  <devtools-icon class="reminder-icon" name="text-analysis"></devtools-icon>
72
78
  <span>
@@ -75,6 +81,16 @@ export class AiCodeGenerationUpgradeDialog {
75
81
  lockedString(UIStringsNotTranslate.describeCodeInComment)}
76
82
  </span>
77
83
  </div>
84
+ <div class="reminder-item">
85
+ <devtools-icon class="reminder-icon" name="code"></devtools-icon>
86
+ <span>${lockedString(UIStringsNotTranslate.asYouType)}</span>
87
+ </div>
88
+ <div class="reminder-item">
89
+ <devtools-icon class="reminder-icon" name="google"></devtools-icon>
90
+ <span>${noLogging ? lockedString(UIStringsNotTranslate.disclaimerTextPrivacyNoLogging) :
91
+ lockedString(UIStringsNotTranslate.disclaimerTextPrivacy)}
92
+ </span>
93
+ </div>
78
94
  </main>
79
95
  <footer>
80
96
  <div class="right-buttons">
@@ -93,7 +109,7 @@ export class AiCodeGenerationUpgradeDialog {
93
109
  }}
94
110
  jslogcontext="ai-code-generation-upgrade-dialog.continue"
95
111
  .variant=${Buttons.Button.Variant.PRIMARY}>
96
- ${lockedString(UIStringsNotTranslate.gotIt)}
112
+ ${lockedString(UIStringsNotTranslate.generateCode)}
97
113
  </devtools-button>
98
114
  </div>
99
115
  </footer>
@@ -82,7 +82,7 @@ export const DEFAULT_VIEW: View = (input, _output, target): void => {
82
82
  .size=${Buttons.Button.Size.REGULAR}
83
83
  .title=${i18nString(UIStrings.dismiss)}
84
84
  jslog=${VisualLogging.close().track({click: true})}
85
- @click=${() => {}}
85
+ @click=${() => input.onCancelClick()}
86
86
  ></devtools-button>
87
87
  </div>
88
88
  </div>
@@ -199,11 +199,34 @@ export const format = (fmt: string, args: SDK.RemoteObject.RemoteObject[]): {
199
199
  return {tokens, args: args.slice(argIndex)};
200
200
  };
201
201
 
202
+ /**
203
+ * This function converts a string into a partial regex string that
204
+ * case-insensitively matches it in CSS, even if CSS escapes are used.
205
+ *
206
+ * @param cssString the target string.
207
+ * @returns a partial regex matching the string in CSS.
208
+ */
209
+ const cssEscapeRegex = (cssString: string): string => {
210
+ return [...cssString]
211
+ .map(char => {
212
+ const charCodes = new Set([char.toLowerCase(), char.toUpperCase()].map(c => c.charCodeAt(0).toString(16)));
213
+ const charCodeRegex =
214
+ [...charCodes].map(charCode => `\\\\0{0,${6 - charCode.length}}${charCode}[ \\n\\t]?`).join('|');
215
+ return `\\\\?(?:${charCodeRegex}|${char})`;
216
+ })
217
+ .join('');
218
+ };
219
+
202
220
  export const updateStyle = (currentStyle: Map<string, {value: string, priority: string}>, styleToAdd: string): void => {
203
221
  const ALLOWED_PROPERTY_PREFIXES = ['background', 'border', 'color', 'font', 'line', 'margin', 'padding', 'text'];
204
222
  // We only allow data URLs with the `url()` CSS function.
205
223
  // The capture group is not intended to grab the whole URL exactly, just enough so we can check the scheme.
206
- const URL_REGEX = /url\([\'\"]?([^\)]*)/g;
224
+ // The regex also covers CSS hex-escaped variations of `url()`.
225
+ const URL_REGEX = new RegExp(`(?=${cssEscapeRegex('url')}\\(['"]?([^\\)]*))`, 'gi');
226
+ // We greedily capture all `image-set()`s to make sure that all of
227
+ // them properly use `url()`s to enforce the data URL check later.
228
+ const IMAGESET_REGEX = new RegExp(`(?=(${cssEscapeRegex('image-set')}\\(.*))`, 'gi');
229
+ const GOOD_IMAGESET_REGEX = /^image-set\((?:(?:(?:url|type)\("[^\\"]*"\)|[\d.]+(?:x|dpi|dpcm|dppx)),?\s*)+\)/i;
207
230
 
208
231
  currentStyle.clear();
209
232
  /* eslint-disable-next-line @devtools/no-imperative-dom-api --
@@ -218,9 +241,15 @@ export const updateStyle = (currentStyle: Map<string, {value: string, priority:
218
241
  continue;
219
242
  }
220
243
 
244
+ const value = buffer.style.getPropertyValue(property);
245
+ // We make sure every `image-set()` only uses `url()`s for its images.
246
+ // If any of them seem malformed, we skip the whole property.
247
+ const imageSets = [...value.matchAll(IMAGESET_REGEX)];
248
+ if (imageSets.some(match => !GOOD_IMAGESET_REGEX.test(match[1]))) {
249
+ continue;
250
+ }
221
251
  // There could be multiple `url()` functions, so we check them all.
222
252
  // If any of them is not a `data` URL, we skip the whole property.
223
- const value = buffer.style.getPropertyValue(property);
224
253
  const potentialUrls = [...value.matchAll(URL_REGEX)].map(match => match[1]);
225
254
  if (potentialUrls.some(
226
255
  potentialUrl => !Common.ParsedURL.schemeIs(potentialUrl as Platform.DevToolsPath.UrlString, 'data:'))) {
@@ -495,8 +495,9 @@ export class ConsoleInsightTeaser extends UI.Widget.Widget {
495
495
  async #showFreDialog(): Promise<void> {
496
496
  const noLogging = Root.Runtime.hostConfig.aidaAvailability?.enterprisePolicyValue ===
497
497
  Root.Runtime.GenAiEnterprisePolicyValue.ALLOW_WITHOUT_LOGGING;
498
+ const iconName = AiAssistanceModel.AiUtils.getIconName();
498
499
  const result = await PanelCommon.FreDialog.show({
499
- header: {iconName: 'smart-assistant', text: lockedString(UIStringsNotTranslate.freDisclaimerHeader)},
500
+ header: {iconName, text: lockedString(UIStringsNotTranslate.freDisclaimerHeader)},
500
501
  reminderItems: [
501
502
  {
502
503
  iconName: 'psychiatry',
@@ -625,6 +626,7 @@ export class ConsoleInsightTeaser extends UI.Widget.Widget {
625
626
  this.#startTime = performance.now();
626
627
  let teaserText = '';
627
628
  let firstChunkReceived = false;
629
+ let firstChunkTime = 0;
628
630
  try {
629
631
  for await (const chunk of this.#getOnDeviceInsight()) {
630
632
  teaserText += chunk;
@@ -633,7 +635,9 @@ export class ConsoleInsightTeaser extends UI.Widget.Widget {
633
635
  this.requestUpdate();
634
636
  if (!firstChunkReceived) {
635
637
  firstChunkReceived = true;
636
- Host.userMetrics.consoleInsightTeaserFirstChunkGenerated(performance.now() - this.#startTime);
638
+ firstChunkTime = performance.now();
639
+ Host.userMetrics.consoleInsightTeaserFirstChunkGenerated(firstChunkTime - this.#startTime);
640
+ Host.userMetrics.consoleInsightTeaserFirstChunkGeneratedMedium(firstChunkTime - this.#startTime);
637
641
  }
638
642
  }
639
643
  } catch (err) {
@@ -653,6 +657,8 @@ export class ConsoleInsightTeaser extends UI.Widget.Widget {
653
657
  clearTimeout(this.#timeoutId);
654
658
  const duration = performance.now() - this.#startTime;
655
659
  Host.userMetrics.consoleInsightTeaserGenerated(duration);
660
+ Host.userMetrics.consoleInsightTeaserGeneratedMedium(duration);
661
+ Host.userMetrics.consoleInsightTeaserChunkToEndMedium(performance.now() - firstChunkTime);
656
662
  if (teaserText.length > 300) {
657
663
  Host.userMetrics.consoleInsightLongTeaserGenerated(duration);
658
664
  } else {
@@ -42,6 +42,7 @@ import * as Platform from '../../core/platform/platform.js';
42
42
  import * as Root from '../../core/root/root.js';
43
43
  import * as SDK from '../../core/sdk/sdk.js';
44
44
  import * as Protocol from '../../generated/protocol.js';
45
+ import * as AIAssistance from '../../models/ai_assistance/ai_assistance.js';
45
46
  import * as Badges from '../../models/badges/badges.js';
46
47
  import type * as Elements from '../../models/elements/elements.js';
47
48
  import type * as IssuesManager from '../../models/issues_manager/issues_manager.js';
@@ -1076,7 +1077,8 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1076
1077
  const action = UI.ActionRegistry.ActionRegistry.instance().getAction('freestyler.elements-floating-button');
1077
1078
  if (this.contentElement && !this.aiButtonContainer) {
1078
1079
  this.aiButtonContainer = this.contentElement.createChild('span', 'ai-button-container');
1079
- const floatingButton = Buttons.FloatingButton.create('smart-assistant', action.title(), 'ask-ai');
1080
+ const floatingButton =
1081
+ Buttons.FloatingButton.create(AIAssistance.AiUtils.getIconName(), action.title(), 'ask-ai');
1080
1082
  floatingButton.addEventListener('click', ev => {
1081
1083
  ev.stopPropagation();
1082
1084
  this.select(true, false);
@@ -1090,6 +1092,7 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1090
1092
  }
1091
1093
 
1092
1094
  override onbind(): void {
1095
+ this.performUpdate();
1093
1096
  if (this.treeOutline && !this.isClosingTag()) {
1094
1097
  this.treeOutline.treeElementByNode.set(this.nodeInternal, this);
1095
1098
  this.nodeInternal.addEventListener(SDK.DOMModel.DOMNodeEvents.TOP_LAYER_INDEX_CHANGED, this.performUpdate, this);
@@ -1113,6 +1116,49 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1113
1116
  if (this.editing) {
1114
1117
  this.editing.cancel();
1115
1118
  }
1119
+ // Update the element to clean up adorner registrations with the
1120
+ // ElementsPanel.
1121
+ // We do not change the ElementsTreeElement state in case the
1122
+ // element is bound again.
1123
+ DEFAULT_VIEW(
1124
+ {
1125
+ containerAdornerActive: false,
1126
+ showAdAdorner: false,
1127
+ showContainerAdorner: false,
1128
+ containerType: this.#layout?.containerType,
1129
+ showFlexAdorner: false,
1130
+ flexAdornerActive: false,
1131
+ showGridAdorner: false,
1132
+ showGridLanesAdorner: false,
1133
+ showMediaAdorner: false,
1134
+ showPopoverAdorner: false,
1135
+ showTopLayerAdorner: false,
1136
+ gridAdornerActive: false,
1137
+ popoverAdornerActive: false,
1138
+ isSubgrid: false,
1139
+ showViewSourceAdorner: false,
1140
+ showScrollAdorner: false,
1141
+ showScrollSnapAdorner: false,
1142
+ scrollSnapAdornerActive: false,
1143
+ showSlotAdorner: false,
1144
+ showStartingStyleAdorner: false,
1145
+ startingStyleAdornerActive: false,
1146
+ nodeInfo: this.#nodeInfo,
1147
+ onStartingStyleAdornerClick: () => {},
1148
+ onSlotAdornerClick: () => {},
1149
+ topLayerIndex: -1,
1150
+ onViewSourceAdornerClick: () => {},
1151
+ onGutterClick: () => {},
1152
+ onContainerAdornerClick: () => {},
1153
+ onFlexAdornerClick: () => {},
1154
+ onGridAdornerClick: () => {},
1155
+ onMediaAdornerClick: () => {},
1156
+ onPopoverAdornerClick: () => {},
1157
+ onScrollSnapAdornerClick: () => {},
1158
+ onTopLayerAdornerClick: () => {},
1159
+ },
1160
+ this, this.listItemElement);
1161
+
1116
1162
  if (this.treeOutline && this.treeOutline.treeElementByNode.get(this.nodeInternal) === this) {
1117
1163
  this.treeOutline.treeElementByNode.delete(this.nodeInternal);
1118
1164
  }
@@ -80,7 +80,7 @@ const str_ = i18n.i18n.registerUIStrings('panels/elements/ElementsTreeOutline.ts
80
80
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
81
81
  const elementsTreeOutlineByDOMModel = new WeakMap<SDK.DOMModel.DOMModel, ElementsTreeOutline>();
82
82
 
83
- const populatedTreeElements = new Set<ElementsTreeElement>();
83
+ const populatedTreeElements = new WeakSet<ElementsTreeElement>();
84
84
 
85
85
  export type View = typeof DEFAULT_VIEW;
86
86