Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 13 matching lines...) Expand all
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 WebInspector.Main = class { 34 Main.Main = class {
35 /** 35 /**
36 * @suppressGlobalPropertiesCheck 36 * @suppressGlobalPropertiesCheck
37 */ 37 */
38 constructor() { 38 constructor() {
39 WebInspector.Main._instanceForTest = this; 39 Main.Main._instanceForTest = this;
40 runOnWindowLoad(this._loaded.bind(this)); 40 runOnWindowLoad(this._loaded.bind(this));
41 } 41 }
42 42
43 /** 43 /**
44 * @param {boolean} hard 44 * @param {boolean} hard
45 */ 45 */
46 static _reloadPage(hard) { 46 static _reloadPage(hard) {
47 var mainTarget = WebInspector.targetManager.mainTarget(); 47 var mainTarget = SDK.targetManager.mainTarget();
48 if (mainTarget && mainTarget.hasBrowserCapability()) 48 if (mainTarget && mainTarget.hasBrowserCapability())
49 WebInspector.targetManager.reloadPage(hard); 49 SDK.targetManager.reloadPage(hard);
50 } 50 }
51 51
52 _loaded() { 52 _loaded() {
53 console.timeStamp('Main._loaded'); 53 console.timeStamp('Main._loaded');
54 54
55 if (InspectorFrontendHost.isUnderTest()) 55 if (InspectorFrontendHost.isUnderTest())
56 self.runtime.useTestBase(); 56 self.runtime.useTestBase();
57 Runtime.setPlatform(WebInspector.platform()); 57 Runtime.setPlatform(Host.platform());
58 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); 58 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this));
59 } 59 }
60 60
61 /** 61 /**
62 * @param {!Object<string, string>} prefs 62 * @param {!Object<string, string>} prefs
63 */ 63 */
64 _gotPreferences(prefs) { 64 _gotPreferences(prefs) {
65 console.timeStamp('Main._gotPreferences'); 65 console.timeStamp('Main._gotPreferences');
66 this._createSettings(prefs); 66 this._createSettings(prefs);
67 this._createAppUI(); 67 this._createAppUI();
68 } 68 }
69 69
70 /** 70 /**
71 * @param {!Object<string, string>} prefs 71 * @param {!Object<string, string>} prefs
72 * Note: this function is called from testSettings in Tests.js. 72 * Note: this function is called from testSettings in Tests.js.
73 */ 73 */
74 _createSettings(prefs) { 74 _createSettings(prefs) {
75 this._initializeExperiments(prefs); 75 this._initializeExperiments(prefs);
76 var storagePrefix = WebInspector.isCustomDevtoolsFrontend() ? '__custom__' : ''; 76 var storagePrefix = Host.isCustomDevtoolsFrontend() ? '__custom__' : '';
77 var clearLocalStorage = window.localStorage ? window.localStorage.clear.bind (window.localStorage) : undefined; 77 var clearLocalStorage = window.localStorage ? window.localStorage.clear.bind (window.localStorage) : undefined;
78 var localStorage = 78 var localStorage =
79 new WebInspector.SettingsStorage(window.localStorage || {}, undefined, u ndefined, clearLocalStorage, storagePrefix); 79 new Common.SettingsStorage(window.localStorage || {}, undefined, undefin ed, clearLocalStorage, storagePrefix);
80 var globalStorage = new WebInspector.SettingsStorage( 80 var globalStorage = new Common.SettingsStorage(
81 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remove Preference, 81 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remove Preference,
82 InspectorFrontendHost.clearPreferences, storagePrefix); 82 InspectorFrontendHost.clearPreferences, storagePrefix);
83 WebInspector.settings = new WebInspector.Settings(globalStorage, localStorag e); 83 Common.settings = new Common.Settings(globalStorage, localStorage);
84 84
85 if (!InspectorFrontendHost.isUnderTest()) 85 if (!InspectorFrontendHost.isUnderTest())
86 new WebInspector.VersionController().updateVersion(); 86 new Common.VersionController().updateVersion();
87 } 87 }
88 88
89 /** 89 /**
90 * @param {!Object<string, string>} prefs 90 * @param {!Object<string, string>} prefs
91 */ 91 */
92 _initializeExperiments(prefs) { 92 _initializeExperiments(prefs) {
93 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe ction'); 93 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe ction');
94 Runtime.experiments.register('applyCustomStylesheet', 'Allow custom UI theme s'); 94 Runtime.experiments.register('applyCustomStylesheet', 'Allow custom UI theme s');
95 Runtime.experiments.register('audits2', 'Audits 2.0', true); 95 Runtime.experiments.register('audits2', 'Audits 2.0', true);
96 Runtime.experiments.register('autoAttachToCrossProcessSubframes', 'Auto-atta ch to cross-process subframes', true); 96 Runtime.experiments.register('autoAttachToCrossProcessSubframes', 'Auto-atta ch to cross-process subframes', true);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 Runtime.experiments.setDefaultExperiments(['inspectTooltip', 'securityPanel' , 'resolveVariableNames']); 139 Runtime.experiments.setDefaultExperiments(['inspectTooltip', 'securityPanel' , 'resolveVariableNames']);
140 } 140 }
141 141
142 /** 142 /**
143 * @suppressGlobalPropertiesCheck 143 * @suppressGlobalPropertiesCheck
144 */ 144 */
145 _createAppUI() { 145 _createAppUI() {
146 console.time('Main._createAppUI'); 146 console.time('Main._createAppUI');
147 147
148 WebInspector.viewManager = new WebInspector.ViewManager(); 148 UI.viewManager = new UI.ViewManager();
149 149
150 // Request filesystems early, we won't create connections until callback is fired. Things will happen in parallel. 150 // Request filesystems early, we won't create connections until callback is fired. Things will happen in parallel.
151 WebInspector.isolatedFileSystemManager = new WebInspector.IsolatedFileSystem Manager(); 151 Workspace.isolatedFileSystemManager = new Workspace.IsolatedFileSystemManage r();
152 152
153 var themeSetting = WebInspector.settings.createSetting('uiTheme', 'default') ; 153 var themeSetting = Common.settings.createSetting('uiTheme', 'default');
154 WebInspector.initializeUIUtils(document, themeSetting); 154 UI.initializeUIUtils(document, themeSetting);
155 themeSetting.addChangeListener(WebInspector.reload.bind(WebInspector)); 155 themeSetting.addChangeListener(Components.reload.bind(Components));
156 156
157 WebInspector.installComponentRootStyles(/** @type {!Element} */ (document.bo dy)); 157 UI.installComponentRootStyles(/** @type {!Element} */ (document.body));
158 158
159 this._addMainEventListeners(document); 159 this._addMainEventListeners(document);
160 160
161 var canDock = !!Runtime.queryParam('can_dock'); 161 var canDock = !!Runtime.queryParam('can_dock');
162 WebInspector.zoomManager = new WebInspector.ZoomManager(window, InspectorFro ntendHost); 162 UI.zoomManager = new UI.ZoomManager(window, InspectorFrontendHost);
163 WebInspector.inspectorView = WebInspector.InspectorView.instance(); 163 UI.inspectorView = UI.InspectorView.instance();
164 WebInspector.ContextMenu.initialize(); 164 UI.ContextMenu.initialize();
165 WebInspector.ContextMenu.installHandler(document); 165 UI.ContextMenu.installHandler(document);
166 WebInspector.Tooltip.installHandler(document); 166 UI.Tooltip.installHandler(document);
167 WebInspector.dockController = new WebInspector.DockController(canDock); 167 Components.dockController = new Components.DockController(canDock);
168 WebInspector.multitargetConsoleModel = new WebInspector.MultitargetConsoleMo del(); 168 SDK.multitargetConsoleModel = new SDK.MultitargetConsoleModel();
169 WebInspector.multitargetNetworkManager = new WebInspector.MultitargetNetwork Manager(); 169 SDK.multitargetNetworkManager = new SDK.MultitargetNetworkManager();
170 WebInspector.targetManager.addEventListener( 170 SDK.targetManager.addEventListener(
171 WebInspector.TargetManager.Events.SuspendStateChanged, this._onSuspendSt ateChanged.bind(this)); 171 SDK.TargetManager.Events.SuspendStateChanged, this._onSuspendStateChange d.bind(this));
172 172
173 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); 173 Components.shortcutsScreen = new Components.ShortcutsScreen();
174 // set order of some sections explicitly 174 // set order of some sections explicitly
175 WebInspector.shortcutsScreen.section(WebInspector.UIString('Elements Panel') ); 175 Components.shortcutsScreen.section(Common.UIString('Elements Panel'));
176 WebInspector.shortcutsScreen.section(WebInspector.UIString('Styles Pane')); 176 Components.shortcutsScreen.section(Common.UIString('Styles Pane'));
177 WebInspector.shortcutsScreen.section(WebInspector.UIString('Debugger')); 177 Components.shortcutsScreen.section(Common.UIString('Debugger'));
178 WebInspector.shortcutsScreen.section(WebInspector.UIString('Console')); 178 Components.shortcutsScreen.section(Common.UIString('Console'));
179 179
180 WebInspector.fileManager = new WebInspector.FileManager(); 180 Workspace.fileManager = new Workspace.FileManager();
181 WebInspector.workspace = new WebInspector.Workspace(); 181 Workspace.workspace = new Workspace.Workspace();
182 WebInspector.formatterWorkerPool = new WebInspector.FormatterWorkerPool(); 182 Common.formatterWorkerPool = new Common.FormatterWorkerPool();
183 WebInspector.fileSystemMapping = new WebInspector.FileSystemMapping(); 183 Workspace.fileSystemMapping = new Workspace.FileSystemMapping();
184 184
185 var fileSystemWorkspaceBinding = 185 var fileSystemWorkspaceBinding =
186 new WebInspector.FileSystemWorkspaceBinding(WebInspector.isolatedFileSys temManager, WebInspector.workspace); 186 new Bindings.FileSystemWorkspaceBinding(Workspace.isolatedFileSystemMana ger, Workspace.workspace);
187 WebInspector.networkMapping = new WebInspector.NetworkMapping( 187 Bindings.networkMapping = new Bindings.NetworkMapping(
188 WebInspector.targetManager, WebInspector.workspace, fileSystemWorkspaceB inding, WebInspector.fileSystemMapping); 188 SDK.targetManager, Workspace.workspace, fileSystemWorkspaceBinding, Work space.fileSystemMapping);
189 WebInspector.networkProjectManager = 189 Main.networkProjectManager =
190 new WebInspector.NetworkProjectManager(WebInspector.targetManager, WebIn spector.workspace); 190 new Bindings.NetworkProjectManager(SDK.targetManager, Workspace.workspac e);
191 WebInspector.presentationConsoleMessageHelper = 191 Bindings.presentationConsoleMessageHelper =
192 new WebInspector.PresentationConsoleMessageHelper(WebInspector.workspace ); 192 new Bindings.PresentationConsoleMessageHelper(Workspace.workspace);
193 WebInspector.cssWorkspaceBinding = new WebInspector.CSSWorkspaceBinding( 193 Bindings.cssWorkspaceBinding = new Bindings.CSSWorkspaceBinding(
194 WebInspector.targetManager, WebInspector.workspace, WebInspector.network Mapping); 194 SDK.targetManager, Workspace.workspace, Bindings.networkMapping);
195 WebInspector.debuggerWorkspaceBinding = new WebInspector.DebuggerWorkspaceBi nding( 195 Bindings.debuggerWorkspaceBinding = new Bindings.DebuggerWorkspaceBinding(
196 WebInspector.targetManager, WebInspector.workspace, WebInspector.network Mapping); 196 SDK.targetManager, Workspace.workspace, Bindings.networkMapping);
197 WebInspector.breakpointManager = new WebInspector.BreakpointManager( 197 Bindings.breakpointManager = new Bindings.BreakpointManager(
198 null, WebInspector.workspace, WebInspector.targetManager, WebInspector.d ebuggerWorkspaceBinding); 198 null, Workspace.workspace, SDK.targetManager, Bindings.debuggerWorkspace Binding);
199 WebInspector.extensionServer = new WebInspector.ExtensionServer(); 199 Extensions.extensionServer = new Extensions.ExtensionServer();
200 200
201 WebInspector.persistence = new WebInspector.Persistence( 201 Persistence.persistence = new Persistence.Persistence(
202 WebInspector.workspace, WebInspector.breakpointManager, WebInspector.fil eSystemMapping); 202 Workspace.workspace, Bindings.breakpointManager, Workspace.fileSystemMap ping);
203 203
204 new WebInspector.OverlayController(); 204 new Main.OverlayController();
205 new WebInspector.ExecutionContextSelector(WebInspector.targetManager, WebIns pector.context); 205 new Components.ExecutionContextSelector(SDK.targetManager, UI.context);
206 WebInspector.blackboxManager = new WebInspector.BlackboxManager(WebInspector .debuggerWorkspaceBinding); 206 Bindings.blackboxManager = new Bindings.BlackboxManager(Bindings.debuggerWor kspaceBinding);
207 207
208 var autoselectPanel = WebInspector.UIString('auto'); 208 var autoselectPanel = Common.UIString('auto');
209 var openAnchorLocationSetting = WebInspector.settings.createSetting('openLin kHandler', autoselectPanel); 209 var openAnchorLocationSetting = Common.settings.createSetting('openLinkHandl er', autoselectPanel);
210 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegistry(o penAnchorLocationSetting); 210 Components.openAnchorLocationRegistry = new Components.HandlerRegistry(openA nchorLocationSetting);
211 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel, fun ction() { 211 Components.openAnchorLocationRegistry.registerHandler(autoselectPanel, funct ion() {
212 return false; 212 return false;
213 }); 213 });
214 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.LinkH andler()); 214 Components.Linkifier.setLinkHandler(new Components.HandlerRegistry.LinkHandl er());
215 215
216 new WebInspector.Main.PauseListener(); 216 new Main.Main.PauseListener();
217 new WebInspector.Main.InspectedNodeRevealer(); 217 new Main.Main.InspectedNodeRevealer();
218 new WebInspector.NetworkPanelIndicator(); 218 new Main.NetworkPanelIndicator();
219 new WebInspector.SourcesPanelIndicator(); 219 new Main.SourcesPanelIndicator();
220 new WebInspector.BackendSettingsSync(); 220 new Main.BackendSettingsSync();
221 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpointsSide barPane(); 221 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane();
222 222
223 WebInspector.actionRegistry = new WebInspector.ActionRegistry(); 223 UI.actionRegistry = new UI.ActionRegistry();
224 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebInspect or.actionRegistry, document); 224 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document);
225 WebInspector.ShortcutsScreen.registerShortcuts(); 225 Components.ShortcutsScreen.registerShortcuts();
226 this._registerForwardedShortcuts(); 226 this._registerForwardedShortcuts();
227 this._registerMessageSinkListener(); 227 this._registerMessageSinkListener();
228 new WebInspector.Main.InspectorDomainObserver(); 228 new Main.Main.InspectorDomainObserver();
229 229
230 self.runtime.extension(WebInspector.AppProvider).instance().then(this._showA ppUI.bind(this)); 230 self.runtime.extension(Common.AppProvider).instance().then(this._showAppUI.b ind(this));
231 console.timeEnd('Main._createAppUI'); 231 console.timeEnd('Main._createAppUI');
232 } 232 }
233 233
234 /** 234 /**
235 * @param {!Object} appProvider 235 * @param {!Object} appProvider
236 * @suppressGlobalPropertiesCheck 236 * @suppressGlobalPropertiesCheck
237 */ 237 */
238 _showAppUI(appProvider) { 238 _showAppUI(appProvider) {
239 console.time('Main._showAppUI'); 239 console.time('Main._showAppUI');
240 var app = /** @type {!WebInspector.AppProvider} */ (appProvider).createApp() ; 240 var app = /** @type {!Common.AppProvider} */ (appProvider).createApp();
241 // It is important to kick controller lifetime after apps are instantiated. 241 // It is important to kick controller lifetime after apps are instantiated.
242 WebInspector.dockController.initialize(); 242 Components.dockController.initialize();
243 app.presentUI(document); 243 app.presentUI(document);
244 244
245 var toggleSearchNodeAction = WebInspector.actionRegistry.action('elements.to ggle-element-search'); 245 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme nt-search');
246 // TODO: we should not access actions from other modules. 246 // TODO: we should not access actions from other modules.
247 if (toggleSearchNodeAction) 247 if (toggleSearchNodeAction)
248 InspectorFrontendHost.events.addEventListener( 248 InspectorFrontendHost.events.addEventListener(
249 InspectorFrontendHostAPI.Events.EnterInspectElementMode, 249 InspectorFrontendHostAPI.Events.EnterInspectElementMode,
250 toggleSearchNodeAction.execute.bind(toggleSearchNodeAction), this); 250 toggleSearchNodeAction.execute.bind(toggleSearchNodeAction), this);
251 WebInspector.inspectorView.createToolbars(); 251 UI.inspectorView.createToolbars();
252 InspectorFrontendHost.loadCompleted(); 252 InspectorFrontendHost.loadCompleted();
253 253
254 InspectorFrontendHost.events.addEventListener( 254 InspectorFrontendHost.events.addEventListener(
255 InspectorFrontendHostAPI.Events.ReloadInspectedPage, this._reloadInspect edPage, this); 255 InspectorFrontendHostAPI.Events.ReloadInspectedPage, this._reloadInspect edPage, this);
256 256
257 var extensions = self.runtime.extensions(WebInspector.QueryParamHandler); 257 var extensions = self.runtime.extensions(Common.QueryParamHandler);
258 for (var extension of extensions) { 258 for (var extension of extensions) {
259 var value = Runtime.queryParam(extension.descriptor()['name']); 259 var value = Runtime.queryParam(extension.descriptor()['name']);
260 if (value !== null) 260 if (value !== null)
261 extension.instance().then(handleQueryParam.bind(null, value)); 261 extension.instance().then(handleQueryParam.bind(null, value));
262 } 262 }
263 263
264 /** 264 /**
265 * @param {string} value 265 * @param {string} value
266 * @param {!WebInspector.QueryParamHandler} handler 266 * @param {!Common.QueryParamHandler} handler
267 */ 267 */
268 function handleQueryParam(value, handler) { 268 function handleQueryParam(value, handler) {
269 handler.handleQueryParam(value); 269 handler.handleQueryParam(value);
270 } 270 }
271 271
272 // Allow UI cycles to repaint prior to creating connection. 272 // Allow UI cycles to repaint prior to creating connection.
273 setTimeout(this._initializeTarget.bind(this), 0); 273 setTimeout(this._initializeTarget.bind(this), 0);
274 console.timeEnd('Main._showAppUI'); 274 console.timeEnd('Main._showAppUI');
275 } 275 }
276 276
277 _initializeTarget() { 277 _initializeTarget() {
278 console.time('Main._initializeTarget'); 278 console.time('Main._initializeTarget');
279 WebInspector.targetManager.connectToMainTarget(webSocketConnectionLost); 279 SDK.targetManager.connectToMainTarget(webSocketConnectionLost);
280 280
281 InspectorFrontendHost.readyForTest(); 281 InspectorFrontendHost.readyForTest();
282 // Asynchronously run the extensions. 282 // Asynchronously run the extensions.
283 setTimeout(this._lateInitialization.bind(this), 100); 283 setTimeout(this._lateInitialization.bind(this), 100);
284 console.timeEnd('Main._initializeTarget'); 284 console.timeEnd('Main._initializeTarget');
285 285
286 function webSocketConnectionLost() { 286 function webSocketConnectionLost() {
287 if (!WebInspector._disconnectedScreenWithReasonWasShown) 287 if (!Main._disconnectedScreenWithReasonWasShown)
288 WebInspector.RemoteDebuggingTerminatedScreen.show('WebSocket disconnecte d'); 288 Main.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected');
289 } 289 }
290 } 290 }
291 291
292 _lateInitialization() { 292 _lateInitialization() {
293 console.timeStamp('Main._lateInitialization'); 293 console.timeStamp('Main._lateInitialization');
294 this._registerShortcuts(); 294 this._registerShortcuts();
295 WebInspector.extensionServer.initializeExtensions(); 295 Extensions.extensionServer.initializeExtensions();
296 } 296 }
297 297
298 _registerForwardedShortcuts() { 298 _registerForwardedShortcuts() {
299 /** @const */ var forwardedActions = 299 /** @const */ var forwardedActions =
300 ['main.toggle-dock', 'debugger.toggle-breakpoints-active', 'debugger.tog gle-pause', 'commandMenu.show']; 300 ['main.toggle-dock', 'debugger.toggle-breakpoints-active', 'debugger.tog gle-pause', 'commandMenu.show'];
301 var actionKeys = WebInspector.shortcutRegistry.keysForActions(forwardedActio ns) 301 var actionKeys = UI.shortcutRegistry.keysForActions(forwardedActions)
302 .map(WebInspector.KeyboardShortcut.keyCodeAndModifiersF romKey); 302 .map(UI.KeyboardShortcut.keyCodeAndModifiersFromKey);
303 InspectorFrontendHost.setWhitelistedShortcuts(JSON.stringify(actionKeys)); 303 InspectorFrontendHost.setWhitelistedShortcuts(JSON.stringify(actionKeys));
304 } 304 }
305 305
306 _registerMessageSinkListener() { 306 _registerMessageSinkListener() {
307 WebInspector.console.addEventListener(WebInspector.Console.Events.MessageAdd ed, messageAdded); 307 Common.console.addEventListener(Common.Console.Events.MessageAdded, messageA dded);
308 308
309 /** 309 /**
310 * @param {!WebInspector.Event} event 310 * @param {!Common.Event} event
311 */ 311 */
312 function messageAdded(event) { 312 function messageAdded(event) {
313 var message = /** @type {!WebInspector.Console.Message} */ (event.data); 313 var message = /** @type {!Common.Console.Message} */ (event.data);
314 if (message.show) 314 if (message.show)
315 WebInspector.console.show(); 315 Common.console.show();
316 } 316 }
317 } 317 }
318 318
319 _documentClick(event) { 319 _documentClick(event) {
320 var target = event.target; 320 var target = event.target;
321 if (target.shadowRoot) 321 if (target.shadowRoot)
322 target = event.deepElementFromPoint(); 322 target = event.deepElementFromPoint();
323 if (!target) 323 if (!target)
324 return; 324 return;
325 325
326 var anchor = target.enclosingNodeOrSelfWithNodeName('a'); 326 var anchor = target.enclosingNodeOrSelfWithNodeName('a');
327 if (!anchor || !anchor.href) 327 if (!anchor || !anchor.href)
328 return; 328 return;
329 329
330 // Prevent the link from navigating, since we don't do any navigation by fol lowing links normally. 330 // Prevent the link from navigating, since we don't do any navigation by fol lowing links normally.
331 event.consume(true); 331 event.consume(true);
332 332
333 if (anchor.preventFollow) 333 if (anchor.preventFollow)
334 return; 334 return;
335 335
336 function followLink() { 336 function followLink() {
337 if (WebInspector.isBeingEdited(target)) 337 if (UI.isBeingEdited(target))
338 return; 338 return;
339 if (WebInspector.openAnchorLocationRegistry.dispatch({url: anchor.href, li neNumber: anchor.lineNumber})) 339 if (Components.openAnchorLocationRegistry.dispatch({url: anchor.href, line Number: anchor.lineNumber}))
340 return; 340 return;
341 341
342 var uiSourceCode = WebInspector.networkMapping.uiSourceCodeForURLForAnyTar get(anchor.href); 342 var uiSourceCode = Bindings.networkMapping.uiSourceCodeForURLForAnyTarget( anchor.href);
343 if (uiSourceCode) { 343 if (uiSourceCode) {
344 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(anchor.lineNumber | | 0, anchor.columnNumber || 0)); 344 Common.Revealer.reveal(uiSourceCode.uiLocation(anchor.lineNumber || 0, a nchor.columnNumber || 0));
345 return; 345 return;
346 } 346 }
347 347
348 var resource = WebInspector.resourceForURL(anchor.href); 348 var resource = Bindings.resourceForURL(anchor.href);
349 if (resource) { 349 if (resource) {
350 WebInspector.Revealer.reveal(resource); 350 Common.Revealer.reveal(resource);
351 return; 351 return;
352 } 352 }
353 353
354 var request = WebInspector.NetworkLog.requestForURL(anchor.href); 354 var request = SDK.NetworkLog.requestForURL(anchor.href);
355 if (request) { 355 if (request) {
356 WebInspector.Revealer.reveal(request); 356 Common.Revealer.reveal(request);
357 return; 357 return;
358 } 358 }
359 InspectorFrontendHost.openInNewTab(anchor.href); 359 InspectorFrontendHost.openInNewTab(anchor.href);
360 } 360 }
361 361
362 if (WebInspector.followLinkTimeout) 362 if (Main.followLinkTimeout)
363 clearTimeout(WebInspector.followLinkTimeout); 363 clearTimeout(Main.followLinkTimeout);
364 364
365 if (anchor.preventFollowOnDoubleClick) { 365 if (anchor.preventFollowOnDoubleClick) {
366 // Start a timeout if this is the first click, if the timeout is canceled 366 // Start a timeout if this is the first click, if the timeout is canceled
367 // before it fires, then a double clicked happened or another link was cli cked. 367 // before it fires, then a double clicked happened or another link was cli cked.
368 if (event.detail === 1) 368 if (event.detail === 1)
369 WebInspector.followLinkTimeout = setTimeout(followLink, 333); 369 Main.followLinkTimeout = setTimeout(followLink, 333);
370 return; 370 return;
371 } 371 }
372 372
373 if (!anchor.classList.contains('webkit-html-external-link')) 373 if (!anchor.classList.contains('webkit-html-external-link'))
374 followLink(); 374 followLink();
375 else 375 else
376 InspectorFrontendHost.openInNewTab(anchor.href); 376 InspectorFrontendHost.openInNewTab(anchor.href);
377 } 377 }
378 378
379 _registerShortcuts() { 379 _registerShortcuts() {
380 var shortcut = WebInspector.KeyboardShortcut; 380 var shortcut = UI.KeyboardShortcut;
381 var section = WebInspector.shortcutsScreen.section(WebInspector.UIString('Al l Panels')); 381 var section = Components.shortcutsScreen.section(Common.UIString('All Panels '));
382 var keys = [ 382 var keys = [
383 shortcut.makeDescriptor('[', shortcut.Modifiers.CtrlOrMeta), 383 shortcut.makeDescriptor('[', shortcut.Modifiers.CtrlOrMeta),
384 shortcut.makeDescriptor(']', shortcut.Modifiers.CtrlOrMeta) 384 shortcut.makeDescriptor(']', shortcut.Modifiers.CtrlOrMeta)
385 ]; 385 ];
386 section.addRelatedKeys(keys, WebInspector.UIString('Go to the panel to the l eft/right')); 386 section.addRelatedKeys(keys, Common.UIString('Go to the panel to the left/ri ght'));
387 387
388 keys = [ 388 keys = [
389 shortcut.makeDescriptor('[', shortcut.Modifiers.CtrlOrMeta | shortcut.Modi fiers.Alt), 389 shortcut.makeDescriptor('[', shortcut.Modifiers.CtrlOrMeta | shortcut.Modi fiers.Alt),
390 shortcut.makeDescriptor(']', shortcut.Modifiers.CtrlOrMeta | shortcut.Modi fiers.Alt) 390 shortcut.makeDescriptor(']', shortcut.Modifiers.CtrlOrMeta | shortcut.Modi fiers.Alt)
391 ]; 391 ];
392 section.addRelatedKeys(keys, WebInspector.UIString('Go back/forward in panel history')); 392 section.addRelatedKeys(keys, Common.UIString('Go back/forward in panel histo ry'));
393 393
394 var toggleConsoleLabel = WebInspector.UIString('Show console'); 394 var toggleConsoleLabel = Common.UIString('Show console');
395 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Tilde, shortcut.Modifie rs.Ctrl), toggleConsoleLabel); 395 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Tilde, shortcut.Modifie rs.Ctrl), toggleConsoleLabel);
396 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Esc), WebInspector.UISt ring('Toggle drawer')); 396 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Esc), Common.UIString(' Toggle drawer'));
397 if (WebInspector.dockController.canDock()) { 397 if (Components.dockController.canDock()) {
398 section.addKey( 398 section.addKey(
399 shortcut.makeDescriptor('M', shortcut.Modifiers.CtrlOrMeta | shortcut. Modifiers.Shift), 399 shortcut.makeDescriptor('M', shortcut.Modifiers.CtrlOrMeta | shortcut. Modifiers.Shift),
400 WebInspector.UIString('Toggle device mode')); 400 Common.UIString('Toggle device mode'));
401 section.addKey( 401 section.addKey(
402 shortcut.makeDescriptor('D', shortcut.Modifiers.CtrlOrMeta | shortcut. Modifiers.Shift), 402 shortcut.makeDescriptor('D', shortcut.Modifiers.CtrlOrMeta | shortcut. Modifiers.Shift),
403 WebInspector.UIString('Toggle dock side')); 403 Common.UIString('Toggle dock side'));
404 } 404 }
405 section.addKey(shortcut.makeDescriptor('f', shortcut.Modifiers.CtrlOrMeta), WebInspector.UIString('Search')); 405 section.addKey(shortcut.makeDescriptor('f', shortcut.Modifiers.CtrlOrMeta), Common.UIString('Search'));
406 406
407 var advancedSearchShortcutModifier = WebInspector.isMac() ? 407 var advancedSearchShortcutModifier = Host.isMac() ?
408 WebInspector.KeyboardShortcut.Modifiers.Meta | WebInspector.KeyboardShor tcut.Modifiers.Alt : 408 UI.KeyboardShortcut.Modifiers.Meta | UI.KeyboardShortcut.Modifiers.Alt :
409 WebInspector.KeyboardShortcut.Modifiers.Ctrl | WebInspector.KeyboardShor tcut.Modifiers.Shift; 409 UI.KeyboardShortcut.Modifiers.Ctrl | UI.KeyboardShortcut.Modifiers.Shift ;
410 var advancedSearchShortcut = shortcut.makeDescriptor('f', advancedSearchShor tcutModifier); 410 var advancedSearchShortcut = shortcut.makeDescriptor('f', advancedSearchShor tcutModifier);
411 section.addKey(advancedSearchShortcut, WebInspector.UIString('Search across all sources')); 411 section.addKey(advancedSearchShortcut, Common.UIString('Search across all so urces'));
412 412
413 var inspectElementModeShortcuts = 413 var inspectElementModeShortcuts =
414 WebInspector.shortcutRegistry.shortcutDescriptorsForAction('elements.tog gle-element-search'); 414 UI.shortcutRegistry.shortcutDescriptorsForAction('elements.toggle-elemen t-search');
415 if (inspectElementModeShortcuts.length) 415 if (inspectElementModeShortcuts.length)
416 section.addKey(inspectElementModeShortcuts[0], WebInspector.UIString('Sele ct node to inspect')); 416 section.addKey(inspectElementModeShortcuts[0], Common.UIString('Select nod e to inspect'));
417 417
418 var openResourceShortcut = 418 var openResourceShortcut =
419 WebInspector.KeyboardShortcut.makeDescriptor('p', WebInspector.KeyboardS hortcut.Modifiers.CtrlOrMeta); 419 UI.KeyboardShortcut.makeDescriptor('p', UI.KeyboardShortcut.Modifiers.Ct rlOrMeta);
420 section.addKey(openResourceShortcut, WebInspector.UIString('Go to source')); 420 section.addKey(openResourceShortcut, Common.UIString('Go to source'));
421 421
422 if (WebInspector.isMac()) { 422 if (Host.isMac()) {
423 keys = [ 423 keys = [
424 shortcut.makeDescriptor('g', shortcut.Modifiers.Meta), 424 shortcut.makeDescriptor('g', shortcut.Modifiers.Meta),
425 shortcut.makeDescriptor('g', shortcut.Modifiers.Meta | shortcut.Modifier s.Shift) 425 shortcut.makeDescriptor('g', shortcut.Modifiers.Meta | shortcut.Modifier s.Shift)
426 ]; 426 ];
427 section.addRelatedKeys(keys, WebInspector.UIString('Find next/previous')); 427 section.addRelatedKeys(keys, Common.UIString('Find next/previous'));
428 } 428 }
429 } 429 }
430 430
431 _postDocumentKeyDown(event) { 431 _postDocumentKeyDown(event) {
432 if (event.handled) 432 if (event.handled)
433 return; 433 return;
434 434
435 var document = event.target && event.target.ownerDocument; 435 var document = event.target && event.target.ownerDocument;
436 var target = document ? document.deepActiveElement() : null; 436 var target = document ? document.deepActiveElement() : null;
437 if (target) { 437 if (target) {
438 var anchor = target.enclosingNodeOrSelfWithNodeName('a'); 438 var anchor = target.enclosingNodeOrSelfWithNodeName('a');
439 if (anchor && anchor.preventFollow) 439 if (anchor && anchor.preventFollow)
440 event.preventDefault(); 440 event.preventDefault();
441 } 441 }
442 442
443 if (!WebInspector.Dialog.hasInstance() && WebInspector.inspectorView.current PanelDeprecated()) { 443 if (!UI.Dialog.hasInstance() && UI.inspectorView.currentPanelDeprecated()) {
444 WebInspector.inspectorView.currentPanelDeprecated().handleShortcut(event); 444 UI.inspectorView.currentPanelDeprecated().handleShortcut(event);
445 if (event.handled) { 445 if (event.handled) {
446 event.consume(true); 446 event.consume(true);
447 return; 447 return;
448 } 448 }
449 } 449 }
450 450
451 WebInspector.shortcutRegistry.handleShortcut(event); 451 UI.shortcutRegistry.handleShortcut(event);
452 } 452 }
453 453
454 /** 454 /**
455 * @param {!Event} event 455 * @param {!Event} event
456 */ 456 */
457 _redispatchClipboardEvent(event) { 457 _redispatchClipboardEvent(event) {
458 var eventCopy = new CustomEvent('clipboard-' + event.type); 458 var eventCopy = new CustomEvent('clipboard-' + event.type);
459 eventCopy['original'] = event; 459 eventCopy['original'] = event;
460 var document = event.target && event.target.ownerDocument; 460 var document = event.target && event.target.ownerDocument;
461 var target = document ? document.deepActiveElement() : null; 461 var target = document ? document.deepActiveElement() : null;
(...skipping 15 matching lines...) Expand all
477 document.addEventListener('keydown', this._postDocumentKeyDown.bind(this), f alse); 477 document.addEventListener('keydown', this._postDocumentKeyDown.bind(this), f alse);
478 document.addEventListener('beforecopy', this._redispatchClipboardEvent.bind( this), true); 478 document.addEventListener('beforecopy', this._redispatchClipboardEvent.bind( this), true);
479 document.addEventListener('copy', this._redispatchClipboardEvent.bind(this), false); 479 document.addEventListener('copy', this._redispatchClipboardEvent.bind(this), false);
480 document.addEventListener('cut', this._redispatchClipboardEvent.bind(this), false); 480 document.addEventListener('cut', this._redispatchClipboardEvent.bind(this), false);
481 document.addEventListener('paste', this._redispatchClipboardEvent.bind(this) , false); 481 document.addEventListener('paste', this._redispatchClipboardEvent.bind(this) , false);
482 document.addEventListener('contextmenu', this._contextMenuEventFired.bind(th is), true); 482 document.addEventListener('contextmenu', this._contextMenuEventFired.bind(th is), true);
483 document.addEventListener('click', this._documentClick.bind(this), false); 483 document.addEventListener('click', this._documentClick.bind(this), false);
484 } 484 }
485 485
486 /** 486 /**
487 * @param {!WebInspector.Event} event 487 * @param {!Common.Event} event
488 */ 488 */
489 _reloadInspectedPage(event) { 489 _reloadInspectedPage(event) {
490 var hard = /** @type {boolean} */ (event.data); 490 var hard = /** @type {boolean} */ (event.data);
491 WebInspector.Main._reloadPage(hard); 491 Main.Main._reloadPage(hard);
492 } 492 }
493 493
494 _onSuspendStateChanged() { 494 _onSuspendStateChanged() {
495 var suspended = WebInspector.targetManager.allTargetsSuspended(); 495 var suspended = SDK.targetManager.allTargetsSuspended();
496 WebInspector.inspectorView.onSuspendStateChanged(suspended); 496 UI.inspectorView.onSuspendStateChanged(suspended);
497 } 497 }
498 }; 498 };
499 499
500 /** 500 /**
501 * @implements {WebInspector.TargetManager.Observer} 501 * @implements {SDK.TargetManager.Observer}
502 * @unrestricted 502 * @unrestricted
503 */ 503 */
504 WebInspector.Main.InspectorDomainObserver = class { 504 Main.Main.InspectorDomainObserver = class {
505 constructor() { 505 constructor() {
506 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili ty.Browser); 506 SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser);
507 } 507 }
508 508
509 /** 509 /**
510 * @override 510 * @override
511 * @param {!WebInspector.Target} target 511 * @param {!SDK.Target} target
512 */ 512 */
513 targetAdded(target) { 513 targetAdded(target) {
514 target.registerInspectorDispatcher(new WebInspector.Main.InspectorDomainDisp atcher(target)); 514 target.registerInspectorDispatcher(new Main.Main.InspectorDomainDispatcher(t arget));
515 target.inspectorAgent().enable(); 515 target.inspectorAgent().enable();
516 } 516 }
517 517
518 /** 518 /**
519 * @override 519 * @override
520 * @param {!WebInspector.Target} target 520 * @param {!SDK.Target} target
521 */ 521 */
522 targetRemoved(target) { 522 targetRemoved(target) {
523 } 523 }
524 }; 524 };
525 525
526 /** 526 /**
527 * @implements {Protocol.InspectorDispatcher} 527 * @implements {Protocol.InspectorDispatcher}
528 * @unrestricted 528 * @unrestricted
529 */ 529 */
530 WebInspector.Main.InspectorDomainDispatcher = class { 530 Main.Main.InspectorDomainDispatcher = class {
531 /** 531 /**
532 * @param {!WebInspector.Target} target 532 * @param {!SDK.Target} target
533 */ 533 */
534 constructor(target) { 534 constructor(target) {
535 this._target = target; 535 this._target = target;
536 } 536 }
537 537
538 /** 538 /**
539 * @override 539 * @override
540 * @param {string} reason 540 * @param {string} reason
541 */ 541 */
542 detached(reason) { 542 detached(reason) {
543 WebInspector._disconnectedScreenWithReasonWasShown = true; 543 Main._disconnectedScreenWithReasonWasShown = true;
544 WebInspector.RemoteDebuggingTerminatedScreen.show(reason); 544 Main.RemoteDebuggingTerminatedScreen.show(reason);
545 } 545 }
546 546
547 /** 547 /**
548 * @override 548 * @override
549 */ 549 */
550 targetCrashed() { 550 targetCrashed() {
551 var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._target); 551 var debuggerModel = SDK.DebuggerModel.fromTarget(this._target);
552 if (debuggerModel) 552 if (debuggerModel)
553 WebInspector.TargetCrashedScreen.show(debuggerModel); 553 Main.TargetCrashedScreen.show(debuggerModel);
554 } 554 }
555 }; 555 };
556 556
557 /** 557 /**
558 * @implements {WebInspector.ActionDelegate} 558 * @implements {UI.ActionDelegate}
559 * @unrestricted 559 * @unrestricted
560 */ 560 */
561 WebInspector.Main.ReloadActionDelegate = class { 561 Main.Main.ReloadActionDelegate = class {
562 /** 562 /**
563 * @override 563 * @override
564 * @param {!WebInspector.Context} context 564 * @param {!UI.Context} context
565 * @param {string} actionId 565 * @param {string} actionId
566 * @return {boolean} 566 * @return {boolean}
567 */ 567 */
568 handleAction(context, actionId) { 568 handleAction(context, actionId) {
569 switch (actionId) { 569 switch (actionId) {
570 case 'main.reload': 570 case 'main.reload':
571 WebInspector.Main._reloadPage(false); 571 Main.Main._reloadPage(false);
572 return true; 572 return true;
573 case 'main.hard-reload': 573 case 'main.hard-reload':
574 WebInspector.Main._reloadPage(true); 574 Main.Main._reloadPage(true);
575 return true; 575 return true;
576 case 'main.debug-reload': 576 case 'main.debug-reload':
577 WebInspector.reload(); 577 Components.reload();
578 return true; 578 return true;
579 } 579 }
580 return false; 580 return false;
581 } 581 }
582 }; 582 };
583 583
584 /** 584 /**
585 * @implements {WebInspector.ActionDelegate} 585 * @implements {UI.ActionDelegate}
586 * @unrestricted 586 * @unrestricted
587 */ 587 */
588 WebInspector.Main.ZoomActionDelegate = class { 588 Main.Main.ZoomActionDelegate = class {
589 /** 589 /**
590 * @override 590 * @override
591 * @param {!WebInspector.Context} context 591 * @param {!UI.Context} context
592 * @param {string} actionId 592 * @param {string} actionId
593 * @return {boolean} 593 * @return {boolean}
594 */ 594 */
595 handleAction(context, actionId) { 595 handleAction(context, actionId) {
596 if (InspectorFrontendHost.isHostedMode()) 596 if (InspectorFrontendHost.isHostedMode())
597 return false; 597 return false;
598 598
599 switch (actionId) { 599 switch (actionId) {
600 case 'main.zoom-in': 600 case 'main.zoom-in':
601 InspectorFrontendHost.zoomIn(); 601 InspectorFrontendHost.zoomIn();
602 return true; 602 return true;
603 case 'main.zoom-out': 603 case 'main.zoom-out':
604 InspectorFrontendHost.zoomOut(); 604 InspectorFrontendHost.zoomOut();
605 return true; 605 return true;
606 case 'main.zoom-reset': 606 case 'main.zoom-reset':
607 InspectorFrontendHost.resetZoom(); 607 InspectorFrontendHost.resetZoom();
608 return true; 608 return true;
609 } 609 }
610 return false; 610 return false;
611 } 611 }
612 }; 612 };
613 613
614 /** 614 /**
615 * @implements {WebInspector.ActionDelegate} 615 * @implements {UI.ActionDelegate}
616 * @unrestricted 616 * @unrestricted
617 */ 617 */
618 WebInspector.Main.SearchActionDelegate = class { 618 Main.Main.SearchActionDelegate = class {
619 /** 619 /**
620 * @override 620 * @override
621 * @param {!WebInspector.Context} context 621 * @param {!UI.Context} context
622 * @param {string} actionId 622 * @param {string} actionId
623 * @return {boolean} 623 * @return {boolean}
624 * @suppressGlobalPropertiesCheck 624 * @suppressGlobalPropertiesCheck
625 */ 625 */
626 handleAction(context, actionId) { 626 handleAction(context, actionId) {
627 var searchableView = WebInspector.SearchableView.fromElement(document.deepAc tiveElement()) || 627 var searchableView = UI.SearchableView.fromElement(document.deepActiveElemen t()) ||
628 WebInspector.inspectorView.currentPanelDeprecated().searchableView(); 628 UI.inspectorView.currentPanelDeprecated().searchableView();
629 if (!searchableView) 629 if (!searchableView)
630 return false; 630 return false;
631 switch (actionId) { 631 switch (actionId) {
632 case 'main.search-in-panel.find': 632 case 'main.search-in-panel.find':
633 return searchableView.handleFindShortcut(); 633 return searchableView.handleFindShortcut();
634 case 'main.search-in-panel.cancel': 634 case 'main.search-in-panel.cancel':
635 return searchableView.handleCancelSearchShortcut(); 635 return searchableView.handleCancelSearchShortcut();
636 case 'main.search-in-panel.find-next': 636 case 'main.search-in-panel.find-next':
637 return searchableView.handleFindNextShortcut(); 637 return searchableView.handleFindNextShortcut();
638 case 'main.search-in-panel.find-previous': 638 case 'main.search-in-panel.find-previous':
639 return searchableView.handleFindPreviousShortcut(); 639 return searchableView.handleFindPreviousShortcut();
640 } 640 }
641 return false; 641 return false;
642 } 642 }
643 }; 643 };
644 644
645 645
646 /** 646 /**
647 * @implements {WebInspector.ToolbarItem.Provider} 647 * @implements {UI.ToolbarItem.Provider}
648 * @unrestricted 648 * @unrestricted
649 */ 649 */
650 WebInspector.Main.WarningErrorCounter = class { 650 Main.Main.WarningErrorCounter = class {
651 constructor() { 651 constructor() {
652 WebInspector.Main.WarningErrorCounter._instanceForTest = this; 652 Main.Main.WarningErrorCounter._instanceForTest = this;
653 653
654 this._counter = createElement('div'); 654 this._counter = createElement('div');
655 this._counter.addEventListener('click', WebInspector.console.show.bind(WebIn spector.console), false); 655 this._counter.addEventListener('click', Common.console.show.bind(Common.cons ole), false);
656 this._toolbarItem = new WebInspector.ToolbarItem(this._counter); 656 this._toolbarItem = new UI.ToolbarItem(this._counter);
657 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(this._counter, 'main/errorWarningCounter.css'); 657 var shadowRoot = UI.createShadowRootWithCoreStyles(this._counter, 'main/erro rWarningCounter.css');
658 658
659 this._errors = this._createItem(shadowRoot, 'smallicon-error'); 659 this._errors = this._createItem(shadowRoot, 'smallicon-error');
660 this._revokedErrors = this._createItem(shadowRoot, 'smallicon-revoked-error' ); 660 this._revokedErrors = this._createItem(shadowRoot, 'smallicon-revoked-error' );
661 this._warnings = this._createItem(shadowRoot, 'smallicon-warning'); 661 this._warnings = this._createItem(shadowRoot, 'smallicon-warning');
662 this._titles = []; 662 this._titles = [];
663 663
664 WebInspector.multitargetConsoleModel.addEventListener( 664 SDK.multitargetConsoleModel.addEventListener(
665 WebInspector.ConsoleModel.Events.ConsoleCleared, this._update, this); 665 SDK.ConsoleModel.Events.ConsoleCleared, this._update, this);
666 WebInspector.multitargetConsoleModel.addEventListener( 666 SDK.multitargetConsoleModel.addEventListener(
667 WebInspector.ConsoleModel.Events.MessageAdded, this._update, this); 667 SDK.ConsoleModel.Events.MessageAdded, this._update, this);
668 WebInspector.multitargetConsoleModel.addEventListener( 668 SDK.multitargetConsoleModel.addEventListener(
669 WebInspector.ConsoleModel.Events.MessageUpdated, this._update, this); 669 SDK.ConsoleModel.Events.MessageUpdated, this._update, this);
670 this._update(); 670 this._update();
671 } 671 }
672 672
673 /** 673 /**
674 * @param {!Node} shadowRoot 674 * @param {!Node} shadowRoot
675 * @param {string} iconType 675 * @param {string} iconType
676 * @return {!{item: !Element, text: !Element}} 676 * @return {!{item: !Element, text: !Element}}
677 */ 677 */
678 _createItem(shadowRoot, iconType) { 678 _createItem(shadowRoot, iconType) {
679 var item = createElementWithClass('span', 'counter-item'); 679 var item = createElementWithClass('span', 'counter-item');
(...skipping 15 matching lines...) Expand all
695 item.item.classList.toggle('counter-item-first', first); 695 item.item.classList.toggle('counter-item-first', first);
696 item.text.textContent = count; 696 item.text.textContent = count;
697 if (count) 697 if (count)
698 this._titles.push(title); 698 this._titles.push(title);
699 } 699 }
700 700
701 _update() { 701 _update() {
702 var errors = 0; 702 var errors = 0;
703 var revokedErrors = 0; 703 var revokedErrors = 0;
704 var warnings = 0; 704 var warnings = 0;
705 var targets = WebInspector.targetManager.targets(); 705 var targets = SDK.targetManager.targets();
706 for (var i = 0; i < targets.length; ++i) { 706 for (var i = 0; i < targets.length; ++i) {
707 errors += targets[i].consoleModel.errors(); 707 errors += targets[i].consoleModel.errors();
708 revokedErrors += targets[i].consoleModel.revokedErrors(); 708 revokedErrors += targets[i].consoleModel.revokedErrors();
709 warnings += targets[i].consoleModel.warnings(); 709 warnings += targets[i].consoleModel.warnings();
710 } 710 }
711 711
712 this._titles = []; 712 this._titles = [];
713 this._toolbarItem.setVisible(!!(errors || revokedErrors || warnings)); 713 this._toolbarItem.setVisible(!!(errors || revokedErrors || warnings));
714 this._updateItem( 714 this._updateItem(
715 this._errors, errors, false, WebInspector.UIString(errors === 1 ? '%d er ror' : '%d errors', errors)); 715 this._errors, errors, false, Common.UIString(errors === 1 ? '%d error' : '%d errors', errors));
716 this._updateItem( 716 this._updateItem(
717 this._revokedErrors, revokedErrors, !errors, 717 this._revokedErrors, revokedErrors, !errors,
718 WebInspector.UIString( 718 Common.UIString(
719 revokedErrors === 1 ? '%d handled promise rejection' : '%d handled p romise rejections', revokedErrors)); 719 revokedErrors === 1 ? '%d handled promise rejection' : '%d handled p romise rejections', revokedErrors));
720 this._updateItem( 720 this._updateItem(
721 this._warnings, warnings, !errors && !revokedErrors, 721 this._warnings, warnings, !errors && !revokedErrors,
722 WebInspector.UIString(warnings === 1 ? '%d warning' : '%d warnings', war nings)); 722 Common.UIString(warnings === 1 ? '%d warning' : '%d warnings', warnings) );
723 this._counter.title = this._titles.join(', '); 723 this._counter.title = this._titles.join(', ');
724 WebInspector.inspectorView.toolbarItemResized(); 724 UI.inspectorView.toolbarItemResized();
725 } 725 }
726 726
727 /** 727 /**
728 * @override 728 * @override
729 * @return {?WebInspector.ToolbarItem} 729 * @return {?UI.ToolbarItem}
730 */ 730 */
731 item() { 731 item() {
732 return this._toolbarItem; 732 return this._toolbarItem;
733 } 733 }
734 }; 734 };
735 735
736 /** 736 /**
737 * @implements {WebInspector.ToolbarItem.Provider} 737 * @implements {UI.ToolbarItem.Provider}
738 * @unrestricted 738 * @unrestricted
739 */ 739 */
740 WebInspector.Main.MainMenuItem = class { 740 Main.Main.MainMenuItem = class {
741 constructor() { 741 constructor() {
742 this._item = 742 this._item =
743 new WebInspector.ToolbarButton(WebInspector.UIString('Customize and cont rol DevTools'), 'largeicon-menu'); 743 new UI.ToolbarButton(Common.UIString('Customize and control DevTools'), 'largeicon-menu');
744 this._item.addEventListener('mousedown', this._mouseDown, this); 744 this._item.addEventListener('mousedown', this._mouseDown, this);
745 } 745 }
746 746
747 /** 747 /**
748 * @override 748 * @override
749 * @return {?WebInspector.ToolbarItem} 749 * @return {?UI.ToolbarItem}
750 */ 750 */
751 item() { 751 item() {
752 return this._item; 752 return this._item;
753 } 753 }
754 754
755 /** 755 /**
756 * @param {!WebInspector.Event} event 756 * @param {!Common.Event} event
757 */ 757 */
758 _mouseDown(event) { 758 _mouseDown(event) {
759 var contextMenu = new WebInspector.ContextMenu( 759 var contextMenu = new UI.ContextMenu(
760 /** @type {!Event} */ (event.data), true, this._item.element.totalOffset Left(), 760 /** @type {!Event} */ (event.data), true, this._item.element.totalOffset Left(),
761 this._item.element.totalOffsetTop() + this._item.element.offsetHeight); 761 this._item.element.totalOffsetTop() + this._item.element.offsetHeight);
762 762
763 if (WebInspector.dockController.canDock()) { 763 if (Components.dockController.canDock()) {
764 var dockItemElement = createElementWithClass('div', 'flex-centered flex-au to'); 764 var dockItemElement = createElementWithClass('div', 'flex-centered flex-au to');
765 var titleElement = dockItemElement.createChild('span', 'flex-auto'); 765 var titleElement = dockItemElement.createChild('span', 'flex-auto');
766 titleElement.textContent = WebInspector.UIString('Dock side'); 766 titleElement.textContent = Common.UIString('Dock side');
767 var toggleDockSideShorcuts = WebInspector.shortcutRegistry.shortcutDescrip torsForAction('main.toggle-dock'); 767 var toggleDockSideShorcuts = UI.shortcutRegistry.shortcutDescriptorsForAct ion('main.toggle-dock');
768 titleElement.title = WebInspector.UIString( 768 titleElement.title = Common.UIString(
769 'Placement of DevTools relative to the page. (%s to restore last posit ion)', toggleDockSideShorcuts[0].name); 769 'Placement of DevTools relative to the page. (%s to restore last posit ion)', toggleDockSideShorcuts[0].name);
770 dockItemElement.appendChild(titleElement); 770 dockItemElement.appendChild(titleElement);
771 var dockItemToolbar = new WebInspector.Toolbar('', dockItemElement); 771 var dockItemToolbar = new UI.Toolbar('', dockItemElement);
772 dockItemToolbar.makeBlueOnHover(); 772 dockItemToolbar.makeBlueOnHover();
773 var undock = new WebInspector.ToolbarToggle( 773 var undock = new UI.ToolbarToggle(
774 WebInspector.UIString('Undock into separate window'), 'largeicon-undoc k'); 774 Common.UIString('Undock into separate window'), 'largeicon-undock');
775 var bottom = new WebInspector.ToolbarToggle(WebInspector.UIString('Dock to bottom'), 'largeicon-dock-to-bottom'); 775 var bottom = new UI.ToolbarToggle(Common.UIString('Dock to bottom'), 'larg eicon-dock-to-bottom');
776 var right = new WebInspector.ToolbarToggle(WebInspector.UIString('Dock to right'), 'largeicon-dock-to-right'); 776 var right = new UI.ToolbarToggle(Common.UIString('Dock to right'), 'largei con-dock-to-right');
777 undock.addEventListener('mouseup', setDockSide.bind(null, WebInspector.Doc kController.State.Undocked)); 777 undock.addEventListener('mouseup', setDockSide.bind(null, Components.DockC ontroller.State.Undocked));
778 bottom.addEventListener('mouseup', setDockSide.bind(null, WebInspector.Doc kController.State.DockedToBottom)); 778 bottom.addEventListener('mouseup', setDockSide.bind(null, Components.DockC ontroller.State.DockedToBottom));
779 right.addEventListener('mouseup', setDockSide.bind(null, WebInspector.Dock Controller.State.DockedToRight)); 779 right.addEventListener('mouseup', setDockSide.bind(null, Components.DockCo ntroller.State.DockedToRight));
780 undock.setToggled(WebInspector.dockController.dockSide() === WebInspector. DockController.State.Undocked); 780 undock.setToggled(Components.dockController.dockSide() === Components.Dock Controller.State.Undocked);
781 bottom.setToggled(WebInspector.dockController.dockSide() === WebInspector. DockController.State.DockedToBottom); 781 bottom.setToggled(Components.dockController.dockSide() === Components.Dock Controller.State.DockedToBottom);
782 right.setToggled(WebInspector.dockController.dockSide() === WebInspector.D ockController.State.DockedToRight); 782 right.setToggled(Components.dockController.dockSide() === Components.DockC ontroller.State.DockedToRight);
783 dockItemToolbar.appendToolbarItem(undock); 783 dockItemToolbar.appendToolbarItem(undock);
784 dockItemToolbar.appendToolbarItem(bottom); 784 dockItemToolbar.appendToolbarItem(bottom);
785 dockItemToolbar.appendToolbarItem(right); 785 dockItemToolbar.appendToolbarItem(right);
786 contextMenu.appendCustomItem(dockItemElement); 786 contextMenu.appendCustomItem(dockItemElement);
787 contextMenu.appendSeparator(); 787 contextMenu.appendSeparator();
788 } 788 }
789 789
790 /** 790 /**
791 * @param {string} side 791 * @param {string} side
792 */ 792 */
793 function setDockSide(side) { 793 function setDockSide(side) {
794 WebInspector.dockController.setDockSide(side); 794 Components.dockController.setDockSide(side);
795 contextMenu.discard(); 795 contextMenu.discard();
796 } 796 }
797 797
798 contextMenu.appendAction( 798 contextMenu.appendAction(
799 'main.toggle-drawer', WebInspector.inspectorView.drawerVisible() ? 799 'main.toggle-drawer', UI.inspectorView.drawerVisible() ?
800 WebInspector.UIString('Hide console drawer') : 800 Common.UIString('Hide console drawer') :
801 WebInspector.UIString('Show console drawer')); 801 Common.UIString('Show console drawer'));
802 contextMenu.appendItemsAtLocation('mainMenu'); 802 contextMenu.appendItemsAtLocation('mainMenu');
803 var moreTools = contextMenu.namedSubMenu('mainMenuMoreTools'); 803 var moreTools = contextMenu.namedSubMenu('mainMenuMoreTools');
804 var extensions = self.runtime.extensions('view', undefined, true); 804 var extensions = self.runtime.extensions('view', undefined, true);
805 for (var extension of extensions) { 805 for (var extension of extensions) {
806 var descriptor = extension.descriptor(); 806 var descriptor = extension.descriptor();
807 if (descriptor['persistence'] !== 'closeable') 807 if (descriptor['persistence'] !== 'closeable')
808 continue; 808 continue;
809 if (descriptor['location'] !== 'drawer-view' && descriptor['location'] !== 'panel') 809 if (descriptor['location'] !== 'drawer-view' && descriptor['location'] !== 'panel')
810 continue; 810 continue;
811 moreTools.appendItem( 811 moreTools.appendItem(
812 extension.title(), WebInspector.viewManager.showView.bind(WebInspector .viewManager, descriptor['id'])); 812 extension.title(), UI.viewManager.showView.bind(UI.viewManager, descri ptor['id']));
813 } 813 }
814 814
815 contextMenu.show(); 815 contextMenu.show();
816 } 816 }
817 }; 817 };
818 818
819 /** 819 /**
820 * @unrestricted 820 * @unrestricted
821 */ 821 */
822 WebInspector.NetworkPanelIndicator = class { 822 Main.NetworkPanelIndicator = class {
823 constructor() { 823 constructor() {
824 // TODO: we should not access network from other modules. 824 // TODO: we should not access network from other modules.
825 if (!WebInspector.inspectorView.hasPanel('network')) 825 if (!UI.inspectorView.hasPanel('network'))
826 return; 826 return;
827 var manager = WebInspector.multitargetNetworkManager; 827 var manager = SDK.multitargetNetworkManager;
828 manager.addEventListener(WebInspector.MultitargetNetworkManager.Events.Condi tionsChanged, updateVisibility); 828 manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChan ged, updateVisibility);
829 var blockedURLsSetting = WebInspector.moduleSetting('blockedURLs'); 829 var blockedURLsSetting = Common.moduleSetting('blockedURLs');
830 blockedURLsSetting.addChangeListener(updateVisibility); 830 blockedURLsSetting.addChangeListener(updateVisibility);
831 updateVisibility(); 831 updateVisibility();
832 832
833 function updateVisibility() { 833 function updateVisibility() {
834 if (manager.isThrottling()) { 834 if (manager.isThrottling()) {
835 WebInspector.inspectorView.setPanelIcon( 835 UI.inspectorView.setPanelIcon(
836 'network', 'smallicon-warning', WebInspector.UIString('Network throt tling is enabled')); 836 'network', 'smallicon-warning', Common.UIString('Network throttling is enabled'));
837 } else if (blockedURLsSetting.get().length) { 837 } else if (blockedURLsSetting.get().length) {
838 WebInspector.inspectorView.setPanelIcon( 838 UI.inspectorView.setPanelIcon(
839 'network', 'smallicon-warning', WebInspector.UIString('Requests may be blocked')); 839 'network', 'smallicon-warning', Common.UIString('Requests may be blo cked'));
840 } else { 840 } else {
841 WebInspector.inspectorView.setPanelIcon('network', '', ''); 841 UI.inspectorView.setPanelIcon('network', '', '');
842 } 842 }
843 } 843 }
844 } 844 }
845 }; 845 };
846 846
847 /** 847 /**
848 * @unrestricted 848 * @unrestricted
849 */ 849 */
850 WebInspector.SourcesPanelIndicator = class { 850 Main.SourcesPanelIndicator = class {
851 constructor() { 851 constructor() {
852 WebInspector.moduleSetting('javaScriptDisabled').addChangeListener(javaScrip tDisabledChanged); 852 Common.moduleSetting('javaScriptDisabled').addChangeListener(javaScriptDisab ledChanged);
853 javaScriptDisabledChanged(); 853 javaScriptDisabledChanged();
854 854
855 function javaScriptDisabledChanged() { 855 function javaScriptDisabledChanged() {
856 var javaScriptDisabled = WebInspector.moduleSetting('javaScriptDisabled'). get(); 856 var javaScriptDisabled = Common.moduleSetting('javaScriptDisabled').get();
857 if (javaScriptDisabled) { 857 if (javaScriptDisabled) {
858 WebInspector.inspectorView.setPanelIcon( 858 UI.inspectorView.setPanelIcon(
859 'sources', 'smallicon-warning', WebInspector.UIString('JavaScript is disabled')); 859 'sources', 'smallicon-warning', Common.UIString('JavaScript is disab led'));
860 } else { 860 } else {
861 WebInspector.inspectorView.setPanelIcon('sources', '', ''); 861 UI.inspectorView.setPanelIcon('sources', '', '');
862 } 862 }
863 } 863 }
864 } 864 }
865 }; 865 };
866 866
867 /** 867 /**
868 * @unrestricted 868 * @unrestricted
869 */ 869 */
870 WebInspector.Main.PauseListener = class { 870 Main.Main.PauseListener = class {
871 constructor() { 871 constructor() {
872 WebInspector.targetManager.addModelListener( 872 SDK.targetManager.addModelListener(
873 WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerPa used, this._debuggerPaused, this); 873 SDK.DebuggerModel, SDK.DebuggerModel.Events.DebuggerPaused, this._debugg erPaused, this);
874 } 874 }
875 875
876 /** 876 /**
877 * @param {!WebInspector.Event} event 877 * @param {!Common.Event} event
878 */ 878 */
879 _debuggerPaused(event) { 879 _debuggerPaused(event) {
880 WebInspector.targetManager.removeModelListener( 880 SDK.targetManager.removeModelListener(
881 WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerPa used, this._debuggerPaused, this); 881 SDK.DebuggerModel, SDK.DebuggerModel.Events.DebuggerPaused, this._debugg erPaused, this);
882 var debuggerPausedDetails = /** @type {!WebInspector.DebuggerPausedDetails} */ (event.data); 882 var debuggerPausedDetails = /** @type {!SDK.DebuggerPausedDetails} */ (event .data);
883 var debuggerModel = /** @type {!WebInspector.DebuggerModel} */ (event.target ); 883 var debuggerModel = /** @type {!SDK.DebuggerModel} */ (event.target);
884 WebInspector.context.setFlavor(WebInspector.Target, debuggerModel.target()); 884 UI.context.setFlavor(SDK.Target, debuggerModel.target());
885 WebInspector.Revealer.reveal(debuggerPausedDetails); 885 Common.Revealer.reveal(debuggerPausedDetails);
886 } 886 }
887 }; 887 };
888 888
889 /** 889 /**
890 * @unrestricted 890 * @unrestricted
891 */ 891 */
892 WebInspector.Main.InspectedNodeRevealer = class { 892 Main.Main.InspectedNodeRevealer = class {
893 constructor() { 893 constructor() {
894 WebInspector.targetManager.addModelListener( 894 SDK.targetManager.addModelListener(
895 WebInspector.DOMModel, WebInspector.DOMModel.Events.NodeInspected, this. _inspectNode, this); 895 SDK.DOMModel, SDK.DOMModel.Events.NodeInspected, this._inspectNode, this );
896 } 896 }
897 897
898 /** 898 /**
899 * @param {!WebInspector.Event} event 899 * @param {!Common.Event} event
900 */ 900 */
901 _inspectNode(event) { 901 _inspectNode(event) {
902 var deferredNode = /** @type {!WebInspector.DeferredDOMNode} */ (event.data) ; 902 var deferredNode = /** @type {!SDK.DeferredDOMNode} */ (event.data);
903 WebInspector.Revealer.reveal(deferredNode); 903 Common.Revealer.reveal(deferredNode);
904 } 904 }
905 }; 905 };
906 906
907 /** 907 /**
908 * @param {string} method 908 * @param {string} method
909 * @param {?Object} params 909 * @param {?Object} params
910 * @return {!Promise} 910 * @return {!Promise}
911 */ 911 */
912 WebInspector.sendOverProtocol = function(method, params) { 912 Main.sendOverProtocol = function(method, params) {
913 return new Promise((resolve, reject) => { 913 return new Promise((resolve, reject) => {
914 InspectorBackendClass.sendRawMessageForTesting(method, params, (err, result) => { 914 InspectorBackendClass.sendRawMessageForTesting(method, params, (err, result) => {
915 if (err) 915 if (err)
916 return reject(err); 916 return reject(err);
917 return resolve(result); 917 return resolve(result);
918 }); 918 });
919 }); 919 });
920 }; 920 };
921 921
922 /** 922 /**
923 * @unrestricted 923 * @unrestricted
924 */ 924 */
925 WebInspector.RemoteDebuggingTerminatedScreen = class extends WebInspector.VBox { 925 Main.RemoteDebuggingTerminatedScreen = class extends UI.VBox {
926 /** 926 /**
927 * @param {string} reason 927 * @param {string} reason
928 */ 928 */
929 constructor(reason) { 929 constructor(reason) {
930 super(true); 930 super(true);
931 this.registerRequiredCSS('main/remoteDebuggingTerminatedScreen.css'); 931 this.registerRequiredCSS('main/remoteDebuggingTerminatedScreen.css');
932 var message = this.contentElement.createChild('div', 'message'); 932 var message = this.contentElement.createChild('div', 'message');
933 message.createChild('span').textContent = WebInspector.UIString('Debugging c onnection was closed. Reason: '); 933 message.createChild('span').textContent = Common.UIString('Debugging connect ion was closed. Reason: ');
934 message.createChild('span', 'reason').textContent = reason; 934 message.createChild('span', 'reason').textContent = reason;
935 this.contentElement.createChild('div', 'message').textContent = 935 this.contentElement.createChild('div', 'message').textContent =
936 WebInspector.UIString('Reconnect when ready by reopening DevTools.'); 936 Common.UIString('Reconnect when ready by reopening DevTools.');
937 var button = createTextButton(WebInspector.UIString('Reconnect DevTools'), ( ) => window.location.reload()); 937 var button = createTextButton(Common.UIString('Reconnect DevTools'), () => w indow.location.reload());
938 this.contentElement.createChild('div', 'button').appendChild(button); 938 this.contentElement.createChild('div', 'button').appendChild(button);
939 } 939 }
940 940
941 /** 941 /**
942 * @param {string} reason 942 * @param {string} reason
943 */ 943 */
944 static show(reason) { 944 static show(reason) {
945 var dialog = new WebInspector.Dialog(); 945 var dialog = new UI.Dialog();
946 dialog.setWrapsContent(true); 946 dialog.setWrapsContent(true);
947 dialog.addCloseButton(); 947 dialog.addCloseButton();
948 dialog.setDimmed(true); 948 dialog.setDimmed(true);
949 new WebInspector.RemoteDebuggingTerminatedScreen(reason).show(dialog.element ); 949 new Main.RemoteDebuggingTerminatedScreen(reason).show(dialog.element);
950 dialog.show(); 950 dialog.show();
951 } 951 }
952 }; 952 };
953 953
954 954
955 /** 955 /**
956 * @unrestricted 956 * @unrestricted
957 */ 957 */
958 WebInspector.TargetCrashedScreen = class extends WebInspector.VBox { 958 Main.TargetCrashedScreen = class extends UI.VBox {
959 /** 959 /**
960 * @param {function()} hideCallback 960 * @param {function()} hideCallback
961 */ 961 */
962 constructor(hideCallback) { 962 constructor(hideCallback) {
963 super(true); 963 super(true);
964 this.registerRequiredCSS('main/targetCrashedScreen.css'); 964 this.registerRequiredCSS('main/targetCrashedScreen.css');
965 this.contentElement.createChild('div', 'message').textContent = 965 this.contentElement.createChild('div', 'message').textContent =
966 WebInspector.UIString('DevTools was disconnected from the page.'); 966 Common.UIString('DevTools was disconnected from the page.');
967 this.contentElement.createChild('div', 'message').textContent = 967 this.contentElement.createChild('div', 'message').textContent =
968 WebInspector.UIString('Once page is reloaded, DevTools will automaticall y reconnect.'); 968 Common.UIString('Once page is reloaded, DevTools will automatically reco nnect.');
969 this._hideCallback = hideCallback; 969 this._hideCallback = hideCallback;
970 } 970 }
971 971
972 /** 972 /**
973 * @param {!WebInspector.DebuggerModel} debuggerModel 973 * @param {!SDK.DebuggerModel} debuggerModel
974 */ 974 */
975 static show(debuggerModel) { 975 static show(debuggerModel) {
976 var dialog = new WebInspector.Dialog(); 976 var dialog = new UI.Dialog();
977 dialog.setWrapsContent(true); 977 dialog.setWrapsContent(true);
978 dialog.addCloseButton(); 978 dialog.addCloseButton();
979 dialog.setDimmed(true); 979 dialog.setDimmed(true);
980 var hideBound = dialog.detach.bind(dialog); 980 var hideBound = dialog.detach.bind(dialog);
981 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec tCleared, hideBound); 981 debuggerModel.addEventListener(SDK.DebuggerModel.Events.GlobalObjectCleared, hideBound);
982 982
983 new WebInspector.TargetCrashedScreen(onHide).show(dialog.element); 983 new Main.TargetCrashedScreen(onHide).show(dialog.element);
984 dialog.show(); 984 dialog.show();
985 985
986 function onHide() { 986 function onHide() {
987 debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.Global ObjectCleared, hideBound); 987 debuggerModel.removeEventListener(SDK.DebuggerModel.Events.GlobalObjectCle ared, hideBound);
988 } 988 }
989 } 989 }
990 990
991 /** 991 /**
992 * @override 992 * @override
993 */ 993 */
994 willHide() { 994 willHide() {
995 this._hideCallback.call(null); 995 this._hideCallback.call(null);
996 } 996 }
997 }; 997 };
998 998
999 999
1000 /** 1000 /**
1001 * @implements {WebInspector.TargetManager.Observer} 1001 * @implements {SDK.TargetManager.Observer}
1002 * @unrestricted 1002 * @unrestricted
1003 */ 1003 */
1004 WebInspector.BackendSettingsSync = class { 1004 Main.BackendSettingsSync = class {
1005 constructor() { 1005 constructor() {
1006 this._autoAttachSetting = WebInspector.settings.moduleSetting('autoAttachToC reatedPages'); 1006 this._autoAttachSetting = Common.settings.moduleSetting('autoAttachToCreated Pages');
1007 this._autoAttachSetting.addChangeListener(this._update, this); 1007 this._autoAttachSetting.addChangeListener(this._update, this);
1008 this._disableJavascriptSetting = WebInspector.settings.moduleSetting('javaSc riptDisabled'); 1008 this._disableJavascriptSetting = Common.settings.moduleSetting('javaScriptDi sabled');
1009 this._disableJavascriptSetting.addChangeListener(this._update, this); 1009 this._disableJavascriptSetting.addChangeListener(this._update, this);
1010 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili ty.Browser); 1010 SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser);
1011 } 1011 }
1012 1012
1013 /** 1013 /**
1014 * @param {!WebInspector.Target} target 1014 * @param {!SDK.Target} target
1015 */ 1015 */
1016 _updateTarget(target) { 1016 _updateTarget(target) {
1017 target.pageAgent().setAutoAttachToCreatedPages(this._autoAttachSetting.get() ); 1017 target.pageAgent().setAutoAttachToCreatedPages(this._autoAttachSetting.get() );
1018 target.emulationAgent().setScriptExecutionDisabled(this._disableJavascriptSe tting.get()); 1018 target.emulationAgent().setScriptExecutionDisabled(this._disableJavascriptSe tting.get());
1019 } 1019 }
1020 1020
1021 _update() { 1021 _update() {
1022 WebInspector.targetManager.targets(WebInspector.Target.Capability.Browser).f orEach(this._updateTarget, this); 1022 SDK.targetManager.targets(SDK.Target.Capability.Browser).forEach(this._updat eTarget, this);
1023 } 1023 }
1024 1024
1025 /** 1025 /**
1026 * @param {!WebInspector.Target} target 1026 * @param {!SDK.Target} target
1027 * @override 1027 * @override
1028 */ 1028 */
1029 targetAdded(target) { 1029 targetAdded(target) {
1030 this._updateTarget(target); 1030 this._updateTarget(target);
1031 target.renderingAgent().setShowViewportSizeOnResize(true); 1031 target.renderingAgent().setShowViewportSizeOnResize(true);
1032 } 1032 }
1033 1033
1034 /** 1034 /**
1035 * @param {!WebInspector.Target} target 1035 * @param {!SDK.Target} target
1036 * @override 1036 * @override
1037 */ 1037 */
1038 targetRemoved(target) { 1038 targetRemoved(target) {
1039 } 1039 }
1040 }; 1040 };
1041 1041
1042 /** 1042 /**
1043 * @implements {WebInspector.SettingUI} 1043 * @implements {UI.SettingUI}
1044 * @unrestricted 1044 * @unrestricted
1045 */ 1045 */
1046 WebInspector.ShowMetricsRulersSettingUI = class { 1046 Main.ShowMetricsRulersSettingUI = class {
1047 /** 1047 /**
1048 * @override 1048 * @override
1049 * @return {?Element} 1049 * @return {?Element}
1050 */ 1050 */
1051 settingElement() { 1051 settingElement() {
1052 return WebInspector.SettingsUI.createSettingCheckbox( 1052 return UI.SettingsUI.createSettingCheckbox(
1053 WebInspector.UIString('Show rulers'), WebInspector.moduleSetting('showMe tricsRulers')); 1053 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' ));
1054 } 1054 }
1055 }; 1055 };
1056 1056
1057 new WebInspector.Main(); 1057 new Main.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698