chrome-devtools-frontend 1.0.1669021 → 1.0.1672557

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 (302) hide show
  1. package/.agents/skills/fixing-skipped-tests/SKILL.md +6 -6
  2. package/.agents/skills/gerrit-cli/SKILL.md +4 -10
  3. package/.agents/skills/gerrit-cli/references/commands.md +45 -2
  4. package/.agents/skills/gerrit-cli/references/workflows.md +7 -0
  5. package/.agents/skills/gerrit-cli/scripts/import_upstream.py +34 -152
  6. package/config/typescript/tsconfig.eslint.json +1 -1
  7. package/docs/contributing/settings-experiments-features.md +2 -8
  8. package/docs/ecosystem/automatic_workspace_folders.md +0 -19
  9. package/eslint.config.mjs +5 -5
  10. package/front_end/core/common/Lazy.ts +3 -3
  11. package/front_end/core/common/SettingRegistration.ts +0 -7
  12. package/front_end/core/common/Settings.ts +0 -38
  13. package/front_end/core/host/UserMetrics.ts +187 -953
  14. package/front_end/core/host/UserMetricsEnums.ts +949 -0
  15. package/front_end/core/root/Runtime.ts +21 -138
  16. package/front_end/core/sdk/CSSMetadata.ts +70 -65
  17. package/front_end/core/sdk/CategorizedBreakpoint.ts +0 -1
  18. package/front_end/core/sdk/ChildTargetManager.ts +0 -2
  19. package/front_end/core/sdk/EmulationModel.ts +0 -2
  20. package/front_end/core/sdk/EventBreakpointsModel.ts +0 -4
  21. package/front_end/core/sdk/NetworkManager.ts +0 -3
  22. package/front_end/core/sdk/PageResourceLoader.ts +9 -9
  23. package/front_end/core/sdk/RehydratingConnection.ts +52 -4
  24. package/front_end/core/sdk/Target.ts +0 -4
  25. package/front_end/devtools_compatibility.js +886 -0
  26. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +7 -6
  27. package/front_end/entrypoints/main/ExecutionContextSelector.ts +0 -1
  28. package/front_end/entrypoints/main/MainImpl.ts +18 -22
  29. package/front_end/foundation/Universe.ts +7 -2
  30. package/front_end/generated/InspectorBackendCommands.ts +3 -10
  31. package/front_end/generated/{SupportedCSSProperties.js → SupportedCSSProperties.ts} +16 -0
  32. package/front_end/generated/protocol-mapping.d.ts +0 -42
  33. package/front_end/generated/protocol-proxy-api.d.ts +0 -38
  34. package/front_end/generated/protocol.ts +9 -169
  35. package/front_end/models/ai_assistance/AiAgent2.ts +11 -3
  36. package/front_end/models/ai_assistance/AiConversation.ts +1 -0
  37. package/front_end/models/ai_assistance/AiHistoryStorage.ts +8 -5
  38. package/front_end/models/ai_assistance/AiSetting.ts +108 -0
  39. package/front_end/models/ai_assistance/AiUtils.ts +47 -0
  40. package/front_end/models/ai_assistance/ChangeManager.ts +1 -0
  41. package/front_end/models/ai_assistance/ExtensionScope.ts +3 -12
  42. package/front_end/models/ai_assistance/agents/AiAgent.ts +11 -18
  43. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -0
  44. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +42 -17
  45. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +1 -1
  46. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -2
  47. package/front_end/models/ai_assistance/agents/StorageAgent.ts +253 -155
  48. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
  49. package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
  50. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +12 -6
  51. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +3 -1
  52. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -0
  53. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +4 -3
  54. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +1 -1
  55. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -0
  56. package/front_end/models/ai_assistance/injected.ts +1 -0
  57. package/front_end/models/ai_assistance/performance/AICallTree.ts +1 -0
  58. package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
  59. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
  60. package/front_end/models/ai_assistance/skills/performance.md +10 -0
  61. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +52 -5
  62. package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +4 -4
  63. package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +4 -4
  64. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +5 -4
  65. package/front_end/models/ai_assistance/tools/GetStyles.ts +5 -4
  66. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +5 -4
  67. package/front_end/models/ai_assistance/tools/README.md +1 -1
  68. package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +63 -0
  69. package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +5 -5
  70. package/front_end/models/ai_assistance/tools/Tool.ts +118 -24
  71. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +2 -0
  72. package/front_end/models/badges/UserBadges.ts +2 -0
  73. package/front_end/models/bindings/NetworkProject.ts +5 -0
  74. package/front_end/models/bindings/ResourceScriptMapping.ts +2 -0
  75. package/front_end/models/bindings/ResourceUtils.ts +3 -0
  76. package/front_end/models/crux-manager/CrUXManager.ts +1 -0
  77. package/front_end/models/emulation/DeviceModeModel.ts +140 -7
  78. package/front_end/models/emulation/EmulatedDevices.ts +246 -793
  79. package/front_end/models/issues_manager/IssuesManager.ts +10 -2
  80. package/front_end/models/live-metrics/LiveMetrics.ts +41 -9
  81. package/front_end/models/logs/LogManager.ts +8 -5
  82. package/front_end/models/logs/NetworkLog.ts +1 -0
  83. package/front_end/models/persistence/IsolatedFileSystemManager.ts +21 -3
  84. package/front_end/models/persistence/NetworkPersistenceManager.ts +6 -0
  85. package/front_end/models/project_settings/ProjectSettingsModel.ts +8 -12
  86. package/front_end/models/trace/Processor.ts +42 -10
  87. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +12 -19
  88. package/front_end/models/trace/handlers/MetaHandler.ts +38 -5
  89. package/front_end/models/trace/insights/CLSCulprits.ts +1 -2
  90. package/front_end/models/trace/insights/CharacterSet.ts +1 -1
  91. package/front_end/models/trace/insights/Common.ts +21 -2
  92. package/front_end/models/trace/insights/DocumentLatency.ts +1 -1
  93. package/front_end/models/trace/insights/LCPBreakdown.ts +7 -6
  94. package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
  95. package/front_end/models/trace/insights/ModernHTTP.ts +7 -3
  96. package/front_end/models/trace/insights/NetworkDependencyTree.ts +1 -1
  97. package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
  98. package/front_end/models/trace/insights/ThirdParties.ts +5 -2
  99. package/front_end/models/trace/insights/types.ts +11 -6
  100. package/front_end/models/trace/types/Configuration.ts +5 -0
  101. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +3 -1
  102. package/front_end/models/workspace/IgnoreListManager.ts +2 -0
  103. package/front_end/models/workspace/UISourceCode.ts +2 -0
  104. package/front_end/models/workspace_diff/WorkspaceDiff.ts +4 -0
  105. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +22 -22
  106. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +0 -7
  107. package/front_end/panels/ai_assistance/components/ChatInput.ts +4 -0
  108. package/front_end/panels/ai_assistance/components/ChatMessage.ts +79 -34
  109. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +1 -2
  110. package/front_end/panels/ai_assistance/components/walkthroughView.css +1 -1
  111. package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -106
  112. package/front_end/panels/application/ApplicationPanelTreeElement.ts +1 -1
  113. package/front_end/panels/application/application.ts +0 -10
  114. package/front_end/panels/application/components/components.ts +0 -4
  115. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +0 -5
  116. package/front_end/panels/browser_debugger/EventListenerBreakpointsSidebarPane.ts +6 -12
  117. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +5 -3
  118. package/front_end/panels/console/ConsoleFormat.ts +2 -62
  119. package/front_end/panels/console/ConsoleViewMessage.ts +14 -7
  120. package/front_end/panels/elements/ElementsTreeElement.ts +1 -2
  121. package/front_end/panels/emulation/AdvancedApp.ts +1 -2
  122. package/front_end/panels/emulation/DeviceModeToolbar.ts +83 -69
  123. package/front_end/panels/emulation/DeviceModeView.ts +4 -134
  124. package/front_end/panels/emulation/DeviceModeWrapper.ts +52 -69
  125. package/front_end/panels/emulation/MediaQueryInspector.ts +2 -2
  126. package/front_end/panels/emulation/emulation-meta.ts +12 -12
  127. package/front_end/panels/issues/IssuesPane.ts +3 -1
  128. package/front_end/panels/lighthouse/LighthouseController.ts +6 -0
  129. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +17 -21
  130. package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +206 -126
  131. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +1 -1
  132. package/front_end/panels/mobile_throttling/CalibrationController.ts +1 -1
  133. package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +3 -3
  134. package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +6 -6
  135. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +14 -12
  136. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +13 -13
  137. package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +10 -10
  138. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +28 -28
  139. package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +6 -6
  140. package/front_end/panels/network/RequestHeadersView.ts +1 -1
  141. package/front_end/panels/network/ResourceChunkView.ts +243 -144
  142. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +52 -29
  143. package/front_end/panels/network/ResourceWebSocketFrameView.ts +21 -35
  144. package/front_end/panels/network/resourceChunkView.css +41 -36
  145. package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +21 -12
  146. package/front_end/panels/profiler/profiler.ts +4 -0
  147. package/front_end/panels/recorder/RecorderPanel.ts +6 -14
  148. package/front_end/panels/sensors/LocationsSettingsTab.ts +7 -7
  149. package/front_end/panels/settings/AISettingsTab.ts +75 -31
  150. package/front_end/panels/settings/SettingsScreen.ts +8 -13
  151. package/front_end/panels/settings/components/SyncSection.ts +3 -4
  152. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +650 -18
  153. package/front_end/panels/settings/emulation/devicesSettingsTab.css +18 -0
  154. package/front_end/panels/settings/settings-meta.ts +0 -1
  155. package/front_end/panels/sources/CategorizedBreakpointL10n.ts +0 -2
  156. package/front_end/panels/sources/DebuggerPausedMessage.ts +11 -5
  157. package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
  158. package/front_end/panels/sources/EditingLocationHistoryManager.ts +12 -9
  159. package/front_end/panels/sources/SourcesPanel.ts +19 -17
  160. package/front_end/panels/sources/SourcesView.ts +191 -96
  161. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -4
  162. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -5
  163. package/front_end/panels/timeline/TimelinePanel.ts +2 -0
  164. package/front_end/panels/timeline/TimelineUIUtils.ts +15 -0
  165. package/front_end/panels/timeline/components/CWVMetrics.ts +16 -3
  166. package/front_end/panels/timeline/components/cwvMetrics.css +4 -0
  167. package/front_end/panels/timeline/components/liveMetricsView.css +0 -17
  168. package/front_end/panels/timeline/components/metricValueStyles.css +17 -0
  169. package/front_end/panels/timeline/timeline-meta.ts +3 -5
  170. package/front_end/third_party/chromium/README.chromium +1 -1
  171. package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
  172. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  173. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  174. package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
  175. package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
  176. package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
  177. package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
  178. package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -1
  179. package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
  180. package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
  181. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
  182. package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
  183. package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
  184. package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
  185. package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
  186. package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
  187. package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
  188. package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
  189. package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
  190. package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
  191. package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
  192. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
  193. package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
  194. package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
  195. package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
  196. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1332 -193
  197. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  198. package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
  199. package/front_end/third_party/puppeteer/README.chromium +2 -2
  200. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +64 -15
  201. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +65 -16
  202. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +50 -7
  203. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  204. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  205. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts +2 -1
  206. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
  207. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js +5 -5
  208. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js.map +1 -1
  209. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts +2 -1
  210. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts.map +1 -1
  211. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js +8 -6
  212. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js.map +1 -1
  213. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.d.ts.map +1 -1
  214. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.js +3 -0
  215. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.js.map +1 -1
  216. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
  217. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +16 -1
  218. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
  219. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.d.ts +5 -1
  220. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.d.ts.map +1 -1
  221. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js +11 -6
  222. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js.map +1 -1
  223. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.d.ts.map +1 -1
  224. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.js +5 -0
  225. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.js.map +1 -1
  226. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  227. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js +10 -0
  228. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js.map +1 -1
  229. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +4 -3
  230. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
  231. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts +27 -2
  232. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts.map +1 -1
  233. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js +12 -1
  234. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js.map +1 -1
  235. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts +2 -2
  236. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts.map +1 -1
  237. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js +2 -2
  238. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js.map +1 -1
  239. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  240. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js +2 -0
  241. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js.map +1 -1
  242. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts +2 -1
  243. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
  244. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js +5 -4
  245. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js.map +1 -1
  246. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  247. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  248. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  249. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  250. package/front_end/third_party/puppeteer/package/lib/types.d.ts +64 -15
  251. package/front_end/third_party/puppeteer/package/package.json +2 -2
  252. package/front_end/third_party/puppeteer/package/src/api/Page.ts +50 -7
  253. package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +9 -7
  254. package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +9 -6
  255. package/front_end/third_party/puppeteer/package/src/bidi/Dialog.ts +4 -0
  256. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +24 -1
  257. package/front_end/third_party/puppeteer/package/src/cdp/Connection.ts +11 -6
  258. package/front_end/third_party/puppeteer/package/src/cdp/Dialog.ts +7 -0
  259. package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +11 -0
  260. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +7 -3
  261. package/front_end/third_party/puppeteer/package/src/common/Debug.ts +30 -5
  262. package/front_end/third_party/puppeteer/package/src/common/util.ts +2 -2
  263. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +2 -0
  264. package/front_end/third_party/puppeteer/package/src/node/ScreenRecorder.ts +6 -4
  265. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  266. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  267. package/front_end/tsconfig.compatibility.json +2 -1
  268. package/front_end/tsconfig.json +1 -1
  269. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  270. package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
  271. package/front_end/ui/components/settings/SettingCheckbox.ts +4 -7
  272. package/front_end/ui/components/settings/settings.ts +1 -2
  273. package/front_end/ui/legacy/Treeoutline.ts +52 -30
  274. package/front_end/ui/legacy/components/object_ui/CSSStyleSanitizer.ts +74 -0
  275. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +6 -1
  276. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +47 -54
  277. package/front_end/ui/legacy/components/object_ui/object_ui.ts +2 -0
  278. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +5 -27
  279. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +10 -12
  280. package/front_end/ui/settings/SettingUIRegistration.ts +0 -8
  281. package/front_end/ui/visual_logging/KnownContextValues.ts +37 -0
  282. package/inspector_overlay/tsconfig.json +8 -2
  283. package/package.json +3 -2
  284. package/.agents/skills/gerrit-cli/scripts/gerrit_client_wrapper.py +0 -47
  285. package/front_end/core/sdk/CSSModel.test.api.ts +0 -102
  286. package/front_end/core/sdk/DOMModel.test.api.ts +0 -104
  287. package/front_end/foundation/Universe.test.api.ts +0 -73
  288. package/front_end/panels/application/SharedStorageEventsView.ts +0 -128
  289. package/front_end/panels/application/SharedStorageItemsView.ts +0 -179
  290. package/front_end/panels/application/SharedStorageListTreeElement.ts +0 -65
  291. package/front_end/panels/application/SharedStorageModel.ts +0 -249
  292. package/front_end/panels/application/SharedStorageTreeElement.ts +0 -40
  293. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +0 -191
  294. package/front_end/panels/application/components/SharedStorageMetadataView.ts +0 -133
  295. package/front_end/panels/application/components/sharedStorageAccessGrid.css +0 -29
  296. package/front_end/panels/application/components/sharedStorageMetadataView.css +0 -29
  297. package/front_end/panels/application/sharedStorageEventsView.css +0 -9
  298. package/front_end/panels/network/OriginalResourceChunkView.ts +0 -340
  299. package/front_end/panels/network/originalResourceChunkView.css +0 -49
  300. package/front_end/ui/components/settings/SettingDeprecationWarning.ts +0 -47
  301. package/front_end/ui/components/settings/settingDeprecationWarning.css +0 -14
  302. /package/front_end/generated/{ARIAProperties.js → ARIAProperties.ts} +0 -0
@@ -1,7 +1,6 @@
1
1
  // Copyright 2021 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable @devtools/no-imperative-dom-api */
5
4
 
6
5
  /*
7
6
  * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
@@ -26,11 +25,10 @@ import * as i18n from '../../core/i18n/i18n.js';
26
25
  import * as Platform from '../../core/platform/platform.js';
27
26
  import * as SDK from '../../core/sdk/sdk.js';
28
27
  import * as TextUtils from '../../core/text_utils/text_utils.js';
29
- import * as UI from '../../ui/legacy/legacy.js';
30
28
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
31
29
 
32
30
  import {BinaryResourceView} from './BinaryResourceView.js';
33
- import {DataGridItem, OriginalResourceChunkView} from './OriginalResourceChunkView.js';
31
+ import {DataGridItem, ResourceChunkView} from './ResourceChunkView.js';
34
32
 
35
33
  const UIStrings = {
36
34
  /**
@@ -91,12 +89,11 @@ const str_ = i18n.i18n.registerUIStrings('panels/network/ResourceWebSocketFrameV
91
89
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
92
90
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
93
91
 
94
- export class ResourceWebSocketFrameView extends OriginalResourceChunkView<SDK.NetworkRequest.WebSocketFrame> {
92
+ export class ResourceWebSocketFrameView extends ResourceChunkView<SDK.NetworkRequest.WebSocketFrame> {
95
93
  constructor(request: SDK.NetworkRequest.NetworkRequest) {
96
- super(
97
- request, 'network-web-socket-message-filter', 'resource-web-socket-frame-split-view-state',
98
- i18nString(UIStrings.webSocketFrame), i18nString(UIStrings.filterUsingRegex));
99
- this.element.setAttribute('jslog', `${VisualLogging.pane('web-socket-messages').track({resize: true})}`);
94
+ super(request, 'network-web-socket-message-filter', 'resource-web-socket-frame-split-view-state',
95
+ i18nString(UIStrings.webSocketFrame), i18nString(UIStrings.filterUsingRegex),
96
+ {jslog: `${VisualLogging.pane('web-socket-messages').track({resize: true})}`});
100
97
  }
101
98
 
102
99
  override getRequestChunks(): SDK.NetworkRequest.WebSocketFrame[] {
@@ -115,7 +112,7 @@ export class ResourceWebSocketFrameView extends OriginalResourceChunkView<SDK.Ne
115
112
 
116
113
  override wasShown(): void {
117
114
  super.wasShown();
118
- this.refresh();
115
+ this.requestUpdate();
119
116
  this.request.addEventListener(SDK.NetworkRequest.Events.WEBSOCKET_FRAME_ADDED, this.onWebSocketFrameAdded, this);
120
117
  }
121
118
 
@@ -161,16 +158,13 @@ class ResourceFrameNode extends DataGridItem {
161
158
  readonly frame: SDK.NetworkRequest.WebSocketFrame;
162
159
  override readonly isTextFrame: boolean;
163
160
  #dataText: string;
164
- #binaryView: BinaryResourceView|null;
161
+ #binaryView: BinaryResourceView|null = null;
162
+ override readonly data: Record<string, string|HTMLElement>;
163
+ override readonly cssClass?: string;
165
164
 
166
165
  constructor(frame: SDK.NetworkRequest.WebSocketFrame) {
166
+ super();
167
167
  let length = String(frame.text.length);
168
- const time = new Date(frame.time * 1000);
169
- const timeText = ('0' + time.getHours()).substr(-2) + ':' + ('0' + time.getMinutes()).substr(-2) + ':' +
170
- ('0' + time.getSeconds()).substr(-2) + '.' + ('00' + time.getMilliseconds()).substr(-3);
171
- const timeNode = document.createElement('div');
172
- UI.UIUtils.createTextChild(timeNode, timeText);
173
- UI.Tooltip.Tooltip.install(timeNode, time.toLocaleString());
174
168
 
175
169
  let dataText: string = frame.text;
176
170
  let description = ResourceWebSocketFrameView.opCodeDescription(frame.opCode, frame.mask);
@@ -179,39 +173,31 @@ class ResourceFrameNode extends DataGridItem {
179
173
  if (frame.type === SDK.NetworkRequest.WebSocketFrameType.Error) {
180
174
  description = dataText;
181
175
  length = i18nString(UIStrings.na);
182
-
183
176
  } else if (isTextFrame) {
184
177
  description = dataText;
185
-
186
178
  } else if (frame.opCode === OpCodes.BINARY_FRAME) {
187
179
  length = i18n.ByteUtilities.bytesToString(Platform.StringUtilities.base64ToSize(frame.text));
188
180
  description = opCodeDescriptions[frame.opCode]();
189
-
190
181
  } else {
191
182
  dataText = description;
192
183
  }
193
184
 
194
- super({data: description, length, time: timeNode});
195
-
196
185
  this.frame = frame;
197
186
  this.isTextFrame = isTextFrame;
198
187
  this.#dataText = dataText;
199
188
 
200
- this.#binaryView = null;
201
- }
189
+ this.data = {
190
+ data: description,
191
+ length,
192
+ };
202
193
 
203
- override createCells(element: Element): void {
204
- element.classList.toggle(
205
- 'resource-chunk-view-row-error', this.frame.type === SDK.NetworkRequest.WebSocketFrameType.Error);
206
- element.classList.toggle(
207
- 'resource-chunk-view-row-send', this.frame.type === SDK.NetworkRequest.WebSocketFrameType.Send);
208
- element.classList.toggle(
209
- 'resource-chunk-view-row-receive', this.frame.type === SDK.NetworkRequest.WebSocketFrameType.Receive);
210
- super.createCells(element);
211
- }
212
-
213
- override nodeSelfHeight(): number {
214
- return 21;
194
+ if (frame.type === SDK.NetworkRequest.WebSocketFrameType.Error) {
195
+ this.cssClass = 'resource-chunk-view-row-error';
196
+ } else if (frame.type === SDK.NetworkRequest.WebSocketFrameType.Send) {
197
+ this.cssClass = 'resource-chunk-view-row-send';
198
+ } else if (frame.type === SDK.NetworkRequest.WebSocketFrameType.Receive) {
199
+ this.cssClass = 'resource-chunk-view-row-receive';
200
+ }
215
201
  }
216
202
 
217
203
  override dataText(): string {
@@ -4,46 +4,51 @@
4
4
  * found in the LICENSE file.
5
5
  */
6
6
 
7
- .resource-chunk-view {
8
- user-select: text;
9
- }
10
-
11
- .resource-chunk-view .data-grid {
12
- flex: auto;
13
- border: none;
14
-
15
- .resource-chunk-view-td {
16
- border-bottom: 1px solid var(--sys-color-divider);
7
+ @scope to (devtools-widget > *) {
8
+ :scope {
9
+ overflow: auto;
10
+ height: 100%;
17
11
  }
18
12
 
19
- & tr {
20
- &.resource-chunk-view-row-send td:first-child::before {
21
- content: "\2B06";
22
- color: var(--sys-color-tertiary);
23
- padding-right: 4px;
24
- }
25
-
26
- &.resource-chunk-view-row-receive td:first-child::before {
27
- content: "\2B07";
28
- color: var(--sys-color-error);
29
- padding-right: 4px;
30
- }
13
+ .resource-chunk-view {
14
+ height: 100%;
15
+ display: flex;
16
+ flex-direction: column;
17
+ overflow: hidden;
18
+ user-select: text;
19
+ }
31
20
 
32
- &.resource-chunk-view-row-send {
33
- background-color: color-mix(in srgb, var(--sys-color-tertiary-container), transparent 50%);
34
- }
21
+ devtools-split-view {
22
+ flex: auto;
23
+ height: 100%;
24
+ }
35
25
 
36
- &.resource-chunk-view-row-error {
37
- background-color: var(--sys-color-surface-error);
38
- color: var(--sys-color-on-surface-error);
26
+ .data-grid .data-container table.data {
27
+ tr.data-grid-data-grid-node {
28
+ td.resource-chunk-view-td {
29
+ border-bottom: 1px solid var(--sys-color-divider);
30
+ }
31
+
32
+ &.resource-chunk-view-row-send td:first-child::before {
33
+ content: "\2B06";
34
+ color: var(--sys-color-tertiary);
35
+ padding-right: 4px;
36
+ }
37
+
38
+ &.resource-chunk-view-row-receive td:first-child::before {
39
+ content: "\2B07";
40
+ color: var(--sys-color-error);
41
+ padding-right: 4px;
42
+ }
43
+
44
+ &.resource-chunk-view-row-send {
45
+ background-color: color-mix(in srgb, var(--sys-color-tertiary-container), transparent 50%);
46
+ }
47
+
48
+ &.resource-chunk-view-row-error {
49
+ background-color: var(--sys-color-surface-error);
50
+ color: var(--sys-color-on-surface-error);
51
+ }
39
52
  }
40
53
  }
41
54
  }
42
-
43
- .resource-chunk-view .data-grid .data {
44
- background-image: none;
45
- }
46
-
47
- .resource-chunk-view devtools-toolbar {
48
- border-bottom: 1px solid var(--sys-color-divider);
49
- }
@@ -1,15 +1,17 @@
1
1
  // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable @devtools/no-imperative-dom-api */
5
-
4
+ /* eslint-disable @devtools/no-lit-render-outside-of-view */
6
5
  import * as i18n from '../../core/i18n/i18n.js';
7
6
  import * as SDK from '../../core/sdk/sdk.js';
8
7
  import type * as Protocol from '../../generated/protocol.js';
9
8
  import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
10
9
  import * as UI from '../../ui/legacy/legacy.js';
10
+ import {html, render} from '../../ui/lit/lit.js';
11
11
  import * as Elements from '../elements/elements.js';
12
12
 
13
+ const {widget} = UI.Widget;
14
+
13
15
  const UIStrings = {
14
16
  /**
15
17
  * @description Text in Heap Snapshot View of a profiler tool
@@ -79,7 +81,7 @@ export class HeapDetachedElementsDataGridNode extends DataGrid.DataGrid.DataGrid
79
81
 
80
82
  case 'detached-node-count': {
81
83
  const size = this.#getNodeSize(this.detachedElementInfo);
82
- UI.UIUtils.createTextChild(cell, size.toString());
84
+ render(html`${size}`, cell);
83
85
  return cell;
84
86
  }
85
87
  }
@@ -111,14 +113,21 @@ export class HeapDetachedElementsDataGridNode extends DataGrid.DataGrid.DataGrid
111
113
 
112
114
  // FIXME: is it a partial dupe of front_end/panels/elements/ElementsTreeOutlineRenderer.ts?
113
115
  #renderNode(node: SDK.DOMModel.DOMNode, target: HTMLElement): void {
114
- const domTree = new Elements.ElementsTreeOutline.DOMTreeWidget();
115
- domTree.omitRootDOMNode = false;
116
- domTree.selectEnabled = true;
117
- domTree.hideGutter = true;
118
- domTree.rootDOMNode = node;
119
- domTree.showSelectionOnKeyboardFocus = true;
120
- domTree.preventTabOrder = true;
121
- domTree.deindentSingleNode = true;
122
- domTree.show(target, undefined, true);
116
+ render(
117
+ html`
118
+ <devtools-widget
119
+ ${widget(Elements.ElementsTreeOutline.DOMTreeWidget, {
120
+ omitRootDOMNode: false,
121
+ selectEnabled: true,
122
+ hideGutter: true,
123
+ rootDOMNode: node,
124
+ showSelectionOnKeyboardFocus: true,
125
+ preventTabOrder: true,
126
+ deindentSingleNode: true,
127
+ })}
128
+ ></devtools-widget>
129
+ `,
130
+ target,
131
+ );
123
132
  }
124
133
  }
@@ -3,6 +3,8 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as BottomUpProfileDataGrid from './BottomUpProfileDataGrid.js';
6
+ import * as HeapDetachedElementsDataGrid from './HeapDetachedElementsDataGrid.js';
7
+ import * as HeapDetachedElementsView from './HeapDetachedElementsView.js';
6
8
  import * as HeapProfilerPanel from './HeapProfilerPanel.js';
7
9
  import * as HeapProfileView from './HeapProfileView.js';
8
10
  import * as HeapSnapshotDataGrids from './HeapSnapshotDataGrids.js';
@@ -22,6 +24,8 @@ import * as WritableProfileHeader from './WritableProfileHeader.js';
22
24
 
23
25
  export {
24
26
  BottomUpProfileDataGrid,
27
+ HeapDetachedElementsDataGrid,
28
+ HeapDetachedElementsView,
25
29
  HeapProfilerPanel,
26
30
  HeapProfileView,
27
31
  HeapSnapshotDataGrids,
@@ -10,10 +10,10 @@ import * as Platform from '../../core/platform/platform.js';
10
10
  import * as Root from '../../core/root/root.js';
11
11
  import * as SDK from '../../core/sdk/sdk.js';
12
12
  import * as Bindings from '../../models/bindings/bindings.js';
13
+ import * as EmulationModel from '../../models/emulation/emulation.js';
13
14
  import * as PublicExtensions from '../../models/extensions/extensions.js';
14
15
  import type * as Trace from '../../models/trace/trace.js';
15
16
  import * as PanelCommon from '../../panels/common/common.js';
16
- import * as Emulation from '../../panels/emulation/emulation.js';
17
17
  import * as Tracing from '../../services/tracing/tracing.js';
18
18
  import * as Buttons from '../../ui/components/buttons/buttons.js';
19
19
  import type * as Dialogs from '../../ui/components/dialogs/dialogs.js';
@@ -190,14 +190,6 @@ export const enum Pages {
190
190
  RECORDING_PAGE = 'RecordingPage',
191
191
  }
192
192
 
193
- const CONVERTER_ID_TO_METRIC: Record<string, Host.UserMetrics.RecordingExported|undefined> = {
194
- [Models.ConverterIds.ConverterIds.JSON]: Host.UserMetrics.RecordingExported.TO_JSON,
195
- [Models.ConverterIds.ConverterIds.REPLAY]: Host.UserMetrics.RecordingExported.TO_PUPPETEER_REPLAY,
196
- [Models.ConverterIds.ConverterIds.PUPPETEER]: Host.UserMetrics.RecordingExported.TO_PUPPETEER,
197
- [Models.ConverterIds.ConverterIds.PUPPETEER_FIREFOX]: Host.UserMetrics.RecordingExported.TO_PUPPETEER,
198
- [Models.ConverterIds.ConverterIds.LIGHTHOUSE]: Host.UserMetrics.RecordingExported.TO_LIGHTHOUSE,
199
- };
200
-
201
193
  /** Provide some defaults to prevent OOM issues like crbug.com/491027421 */
202
194
  function verifyFlowSize(flow: Models.Schema.UserFlow): void {
203
195
  if (flow.steps.length > 4096) {
@@ -1248,9 +1240,9 @@ export class RecorderPanel extends UI.Widget.VBox<DocumentFragment> {
1248
1240
 
1249
1241
  async #disableDeviceModeIfEnabled(): Promise<void> {
1250
1242
  try {
1251
- const deviceModeWrapper = Emulation.DeviceModeWrapper.DeviceModeWrapper.instance();
1252
- if (deviceModeWrapper.isDeviceModeOn()) {
1253
- deviceModeWrapper.toggleDeviceMode();
1243
+ const model = EmulationModel.DeviceModeModel.DeviceModeModel.instance();
1244
+ if (model.isDeviceModeOn()) {
1245
+ model.toggleDeviceMode();
1254
1246
  const emulationModel = this.#getMainTarget().model(SDK.EmulationModel.EmulationModel);
1255
1247
  await emulationModel?.emulateDevice(null);
1256
1248
  }
@@ -1615,14 +1607,14 @@ export class RecorderPanel extends UI.Widget.VBox<DocumentFragment> {
1615
1607
  }
1616
1608
  const id = event.itemValue;
1617
1609
  const byId = (converter: Converters.Converter.Converter): boolean => converter.getId() === id;
1610
+ const isBuiltIn = this.#builtInConverters.some(byId);
1618
1611
  const converter = this.#builtInConverters.find(byId) || this.extensionConverters.find(byId);
1619
1612
  if (!converter) {
1620
1613
  throw new Error('No recording selected');
1621
1614
  }
1622
1615
  const [content] = await converter.stringify(this.currentRecording.flow);
1623
1616
  await this.#exportContent(converter.getFilename(this.currentRecording.flow), content);
1624
- const builtInMetric = CONVERTER_ID_TO_METRIC[converter.getId()];
1625
- if (builtInMetric) {
1617
+ if (isBuiltIn) {
1626
1618
  UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.recordingExported));
1627
1619
  } else if (converter.getId().startsWith(Converters.ExtensionConverter.EXTENSION_PREFIX)) {
1628
1620
  UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.recordingExported));
@@ -137,20 +137,20 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
137
137
  function renderItemView(location: LocationDescription): LitTemplate {
138
138
  // clang-format off
139
139
  return html`
140
- <div class="locations-list-item" role="row">
141
- <div class="locations-list-text locations-list-title" role="cell">
140
+ <div class="locations-list-item">
141
+ <div class="locations-list-text locations-list-title">
142
142
  <div class="locations-list-title-text" title=${location.title}>${location.title}</div>
143
143
  </div>
144
144
  <div class="locations-list-separator"></div>
145
- <div class="locations-list-text" role="cell">${location.lat}</div>
145
+ <div class="locations-list-text">${location.lat}</div>
146
146
  <div class="locations-list-separator"></div>
147
- <div class="locations-list-text" role="cell">${location.long}</div>
147
+ <div class="locations-list-text">${location.long}</div>
148
148
  <div class="locations-list-separator"></div>
149
- <div class="locations-list-text" role="cell">${location.timezoneId}</div>
149
+ <div class="locations-list-text">${location.timezoneId}</div>
150
150
  <div class="locations-list-separator"></div>
151
- <div class="locations-list-text" role="cell">${location.locale}</div>
151
+ <div class="locations-list-text">${location.locale}</div>
152
152
  <div class="locations-list-separator"></div>
153
- <div class="locations-list-text" role="cell">${
153
+ <div class="locations-list-text">${
154
154
  location.accuracy ?? SDK.EmulationModel.Location.DEFAULT_ACCURACY}</div>
155
155
  </div>`;
156
156
  // clang-format on
@@ -224,6 +224,21 @@ const UIStrings = {
224
224
  * @description Text informing the user that AI assistance isn't available in Incognito mode or Guest mode.
225
225
  */
226
226
  notAvailableInIncognitoMode: 'AI assistance isn’t available in Incognito mode or Guest mode.',
227
+ /**
228
+ * @description Message shown to the user if the DevTools locale is not
229
+ * supported.
230
+ */
231
+ wrongLocale: 'To use this feature, set your language preference to English in DevTools settings.',
232
+ /**
233
+ * @description Message shown to the user if the user's region is not
234
+ * supported.
235
+ */
236
+ geoRestricted: 'This feature is unavailable in your region.',
237
+ /**
238
+ * @description Message shown to the user if the enterprise policy does
239
+ * not allow this feature.
240
+ */
241
+ policyRestricted: 'This setting is managed by your administrator.',
227
242
  } as const;
228
243
  const str_ = i18n.i18n.registerUIStrings('panels/settings/AISettingsTab.ts', UIStrings);
229
244
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -235,6 +250,7 @@ interface SettingItem {
235
250
 
236
251
  interface AiSettingParams {
237
252
  settingName: Platform.UIString.LocalizedString;
253
+ setting?: Common.Settings.Setting<boolean>;
238
254
  iconName: string;
239
255
  settingDescription: Platform.UIString.LocalizedString;
240
256
  enableSettingText: Common.UIString.LocalizedString;
@@ -250,9 +266,9 @@ interface AiSettingParams {
250
266
  interface ViewInput {
251
267
  disabledReasons: string[];
252
268
  sharedDisclaimerBulletPoints: Array<{icon: string, text: Common.UIString.LocalizedString|Lit.LitTemplate}>;
253
- settingToParams: Map<Common.Settings.Setting<boolean>, AiSettingParams>;
254
- expandSetting(setting: Common.Settings.Setting<boolean>): void;
255
- toggleSetting(setting: Common.Settings.Setting<boolean>, ev: Event): void;
269
+ settingToParams: Map<string, AiSettingParams>;
270
+ expandSetting(settingName: string): void;
271
+ toggleSetting(settingName: string, ev: Event): void;
256
272
  }
257
273
 
258
274
  type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
@@ -297,18 +313,15 @@ export const AI_SETTINGS_TAB_DEFAULT_VIEW: View = (input, _output, target): void
297
313
 
298
314
  const isDisabled = input.disabledReasons.length > 0;
299
315
  const disabledReasonsJoined = input.disabledReasons.join('\n') || undefined;
300
- const settings = Array.from(input.settingToParams.keys()).map(setting => {
301
- const settingData = input.settingToParams.get(setting);
302
- if (!settingData) {
303
- return nothing;
304
- }
316
+ const settings = Array.from(input.settingToParams.entries()).map(([settingName, settingData]) => {
317
+ const isChecked = settingData.setting ? Boolean(settingData.setting.get()) : false;
305
318
  const detailsClasses = {
306
319
  'whole-row': true,
307
320
  open: settingData.settingExpandState.isSettingExpanded,
308
321
  };
309
322
  const tabindex = settingData.settingExpandState.isSettingExpanded ? '0' : '-1';
310
323
  return html`
311
- <div class="accordion-header" @click=${input.expandSetting.bind(this, setting)}>
324
+ <div class="accordion-header" @click=${input.expandSetting.bind(this, settingName)}>
312
325
  <div class="icon-container centered">
313
326
  <devtools-icon name=${settingData.iconName}></devtools-icon>
314
327
  </div>
@@ -334,15 +347,15 @@ export const AI_SETTINGS_TAB_DEFAULT_VIEW: View = (input, _output, target): void
334
347
  <div class="divider"></div>
335
348
  <div class="toggle-container centered"
336
349
  title=${ifDefined(disabledReasonsJoined)}
337
- @click=${input.toggleSetting.bind(this, setting)}
350
+ @click=${settingData.setting ? input.toggleSetting.bind(this, settingName) : nothing}
338
351
  >
339
352
  <devtools-switch
340
- .checked=${Boolean(setting.get()) && !isDisabled}
341
- .jslogContext=${setting.name || ''}
342
- .disabled=${isDisabled}
353
+ .checked=${isChecked && !isDisabled}
354
+ .jslogContext=${settingName}
355
+ .disabled=${isDisabled || !settingData.setting}
343
356
  .label=${disabledReasonsJoined || settingData.enableSettingText}
344
357
  data-testid=${settingData.enableSettingText}
345
- @switchchange=${input.toggleSetting.bind(this, setting)}
358
+ @switchchange=${settingData.setting ? input.toggleSetting.bind(this, settingName) : nothing}
346
359
  ></devtools-switch>
347
360
  </div>
348
361
  <div class=${classMap(detailsClasses)}>
@@ -394,17 +407,18 @@ export class AISettingsTab extends UI.Widget.VBox {
394
407
  (ev: Common.EventTarget.EventTargetEvent<Host.AidaClient.AidaAccessPreconditions>) => void;
395
408
  // Setting to parameters needed to display it in the UI.
396
409
  // To display a a setting, it needs to be added to this map.
397
- #settingToParams = new Map<Common.Settings.Setting<boolean>, AiSettingParams>();
410
+ #settingToParams = new Map<string, AiSettingParams>();
398
411
 
399
412
  constructor(view?: View) {
400
413
  super();
401
414
  try {
402
- this.#consoleInsightsSetting = Common.Settings.Settings.instance().moduleSetting('console-insights-enabled');
415
+ this.#consoleInsightsSetting =
416
+ Common.Settings.Settings.instance().moduleSetting<boolean>('console-insights-enabled');
403
417
  } catch {
404
418
  this.#consoleInsightsSetting = undefined;
405
419
  }
406
420
  try {
407
- this.#aiAssistanceSetting = Common.Settings.Settings.instance().moduleSetting('ai-assistance-enabled');
421
+ this.#aiAssistanceSetting = Common.Settings.Settings.instance().moduleSetting<boolean>('ai-assistance-enabled');
408
422
  } catch {
409
423
  this.#aiAssistanceSetting = undefined;
410
424
  }
@@ -425,6 +439,26 @@ export class AISettingsTab extends UI.Widget.VBox {
425
439
  this.#view = view ?? AI_SETTINGS_TAB_DEFAULT_VIEW;
426
440
  }
427
441
 
442
+ #mapSettingDisabledReasons(reasons: AiAssistanceModel.AiUtils.DisabledReason[]): Platform.UIString.LocalizedString[] {
443
+ const mappedReasons: Platform.UIString.LocalizedString[] = [];
444
+ for (const reason of reasons) {
445
+ switch (reason) {
446
+ case AiAssistanceModel.AiUtils.DisabledReason.GEO_RESTRICTED:
447
+ mappedReasons.push(i18nString(UIStrings.geoRestricted));
448
+ break;
449
+ case AiAssistanceModel.AiUtils.DisabledReason.POLICY_RESTRICTED:
450
+ mappedReasons.push(i18nString(UIStrings.policyRestricted));
451
+ break;
452
+ case AiAssistanceModel.AiUtils.DisabledReason.WRONG_LOCALE:
453
+ mappedReasons.push(i18nString(UIStrings.wrongLocale));
454
+ break;
455
+ case AiAssistanceModel.AiUtils.DisabledReason.NOT_SUPPORTED:
456
+ break;
457
+ }
458
+ }
459
+ return mappedReasons;
460
+ }
461
+
428
462
  #getDisabledReasons(): Platform.UIString.LocalizedString[] {
429
463
  const preconditions = AiAssistanceModel.AiUtils.getDisabledReasons(this.#aidaAvailability);
430
464
  const mappedReasons: Platform.UIString.LocalizedString[] = [];
@@ -447,8 +481,11 @@ export class AISettingsTab extends UI.Widget.VBox {
447
481
  Platform.assertNever(precondition, `Unknown precondition: ${precondition}`);
448
482
  }
449
483
  }
450
- const settingDisabledReasons =
451
- Common.Settings.Settings.instance().moduleSetting('ai-assistance-enabled').disabledReasons();
484
+ const availability =
485
+ AiAssistanceModel.AiUtils.aiAssistanceEnabledSettingDescriptor.isAvailable(Root.Runtime.hostConfig);
486
+ const settingDisabledReasons = availability.status === Common.Settings.SettingAvailability.DISABLED ?
487
+ this.#mapSettingDisabledReasons(availability.reason) :
488
+ [];
452
489
  return [...mappedReasons, ...settingDisabledReasons];
453
490
  }
454
491
 
@@ -488,6 +525,7 @@ export class AISettingsTab extends UI.Widget.VBox {
488
525
  if (this.#consoleInsightsSetting) {
489
526
  const consoleInsightsData: AiSettingParams = {
490
527
  settingName: i18n.i18n.lockedString('Console Insights'),
528
+ setting: this.#consoleInsightsSetting,
491
529
  iconName: 'lightbulb-spark',
492
530
  settingDescription: i18nString(UIStrings.helpUnderstandConsole),
493
531
  enableSettingText: i18nString(UIStrings.enableConsoleInsights),
@@ -510,13 +548,14 @@ export class AISettingsTab extends UI.Widget.VBox {
510
548
  },
511
549
  };
512
550
 
513
- this.#settingToParams.set(this.#consoleInsightsSetting, consoleInsightsData);
551
+ this.#settingToParams.set('console-insights-enabled', consoleInsightsData);
514
552
  }
515
553
 
516
554
  if (this.#aiAssistanceSetting) {
517
555
  const aiAssistanceData: AiSettingParams = {
518
556
  settingName: i18n.i18n.lockedString(AiAssistanceModel.AiUtils.isGeminiBranding() ? 'Gemini in Chrome DevTools' :
519
557
  'AI assistance'),
558
+ setting: this.#aiAssistanceSetting,
520
559
  iconName: AiAssistanceModel.AiUtils.getIconName(),
521
560
  settingDescription: this.#getAiAssistanceSettingDescription(),
522
561
  enableSettingText: i18nString(UIStrings.enableAiAssistance),
@@ -542,12 +581,13 @@ export class AISettingsTab extends UI.Widget.VBox {
542
581
  },
543
582
  };
544
583
 
545
- this.#settingToParams.set(this.#aiAssistanceSetting, aiAssistanceData);
584
+ this.#settingToParams.set('ai-assistance-enabled', aiAssistanceData);
546
585
  }
547
586
 
548
587
  if (this.#aiAnnotationsSetting) {
549
588
  const aiAnnotationsData: AiSettingParams = {
550
589
  settingName: i18n.i18n.lockedString('Auto annotations'),
590
+ setting: this.#aiAnnotationsSetting,
551
591
  iconName: 'pen-spark',
552
592
  settingDescription: i18nString(UIStrings.aIAnnotationsFeatureDescription),
553
593
  enableSettingText: i18nString(UIStrings.enableAiSuggestedAnnotations),
@@ -569,7 +609,7 @@ export class AISettingsTab extends UI.Widget.VBox {
569
609
  },
570
610
  };
571
611
 
572
- this.#settingToParams.set(this.#aiAnnotationsSetting, aiAnnotationsData);
612
+ this.#settingToParams.set('ai-annotations-enabled', aiAnnotationsData);
573
613
  }
574
614
 
575
615
  if (this.#aiCodeCompletionSetting) {
@@ -586,6 +626,7 @@ export class AISettingsTab extends UI.Widget.VBox {
586
626
 
587
627
  const aiCodeCompletionData: AiSettingParams = {
588
628
  settingName: i18n.i18n.lockedString('Code suggestions'),
629
+ setting: this.#aiCodeCompletionSetting,
589
630
  iconName: 'text-analysis',
590
631
  settingDescription: i18nString(UIStrings.helpUnderstandCodeSuggestions),
591
632
  enableSettingText: i18nString(UIStrings.enableAiCodeSuggestions),
@@ -605,7 +646,7 @@ export class AISettingsTab extends UI.Widget.VBox {
605
646
  },
606
647
  };
607
648
 
608
- this.#settingToParams.set(this.#aiCodeCompletionSetting, aiCodeCompletionData);
649
+ this.#settingToParams.set('ai-code-completion-enabled', aiCodeCompletionData);
609
650
  }
610
651
  }
611
652
 
@@ -628,8 +669,8 @@ export class AISettingsTab extends UI.Widget.VBox {
628
669
  return i18nString(UIStrings.aiAssistanceWhenOnItem1);
629
670
  }
630
671
 
631
- #expandSetting(setting: Common.Settings.Setting<boolean>): void {
632
- const settingData = this.#settingToParams.get(setting);
672
+ #expandSetting(settingName: string): void {
673
+ const settingData = this.#settingToParams.get(settingName);
633
674
  if (!settingData) {
634
675
  return;
635
676
  }
@@ -637,18 +678,19 @@ export class AISettingsTab extends UI.Widget.VBox {
637
678
  this.requestUpdate();
638
679
  }
639
680
 
640
- #toggleSetting(setting: Common.Settings.Setting<boolean>, ev: Event): void {
681
+ #toggleSetting(settingName: string, ev: Event): void {
641
682
  // If the switch is being clicked, there is both a click- and a
642
683
  // change-event. Aborting on click avoids running this method twice.
643
684
  if (ev.target instanceof Switch.Switch.Switch && ev.type !== Switch.Switch.SwitchChangeEvent.eventName) {
644
685
  return;
645
686
  }
646
687
 
647
- const settingData = this.#settingToParams.get(setting);
648
- if (!settingData) {
688
+ const settingData = this.#settingToParams.get(settingName);
689
+ if (!settingData || !settingData.setting) {
649
690
  return;
650
691
  }
651
692
 
693
+ const setting = settingData.setting;
652
694
  const oldSettingValue = setting.get();
653
695
  setting.set(!oldSettingValue);
654
696
  if (!oldSettingValue && !settingData.settingExpandState.isSettingExpanded) {
@@ -656,7 +698,7 @@ export class AISettingsTab extends UI.Widget.VBox {
656
698
  }
657
699
 
658
700
  // Custom settings logic
659
- if (setting.name === 'console-insights-enabled') {
701
+ if (settingName === 'console-insights-enabled') {
660
702
  if (oldSettingValue) {
661
703
  // If the user turns the feature off, we want them to go through the full onboarding flow should they later turn
662
704
  // the feature on again. We achieve this by resetting the onboardig setting.
@@ -669,14 +711,16 @@ export class AISettingsTab extends UI.Widget.VBox {
669
711
  .createSetting('console-insights-skip-reminder', true, Common.Settings.SettingStorageType.SESSION)
670
712
  .set(true);
671
713
  }
672
- } else if (setting.name === 'ai-assistance-enabled') {
714
+ } else if (settingName === 'ai-assistance-enabled') {
673
715
  if (!setting.get()) {
674
716
  // If the "AI Assistance" is toggled off, we remove all the history entries related to the feature.
675
717
  void AiAssistanceModel.AiHistoryStorage.AiHistoryStorage.instance().deleteAll();
676
718
  }
677
719
 
678
720
  if (setting.get()) {
679
- Common.Settings.Settings.instance().moduleSetting('ai-assistance-v2-opt-in-change-dialog-seen').set(true);
721
+ Common.Settings.Settings.instance()
722
+ .resolve(AiAssistanceModel.AiUtils.aiAssistanceV2OptInChangeDialogSeenSettingDescriptor)
723
+ .set(true);
680
724
  }
681
725
  }
682
726
  this.requestUpdate();