OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } else { | 56 } else { |
57 configuration = ["components", "main", "elements", "network", "sourc
es", "timeline", "profiler", "resources", "audits", "console", "source_frame", "
extensions", "settings", "search"]; | 57 configuration = ["components", "main", "elements", "network", "sourc
es", "timeline", "profiler", "resources", "audits", "console", "source_frame", "
extensions", "settings", "search"]; |
58 if (WebInspector.experimentsSettings.layersPanel.isEnabled()) | 58 if (WebInspector.experimentsSettings.layersPanel.isEnabled()) |
59 configuration.push("layers"); | 59 configuration.push("layers"); |
60 if (WebInspector.experimentsSettings.devicesPanel.isEnabled()) | 60 if (WebInspector.experimentsSettings.devicesPanel.isEnabled()) |
61 configuration.push("devices"); | 61 configuration.push("devices"); |
62 } | 62 } |
63 WebInspector.moduleManager.registerModules(configuration); | 63 WebInspector.moduleManager.registerModules(configuration); |
64 }, | 64 }, |
65 | 65 |
| 66 _createGlobalStatusBarItems: function() |
| 67 { |
| 68 var extensions = WebInspector.moduleManager.extensions(WebInspector.Stat
usBarButton.Provider); |
| 69 extensions.forEach(function(extension) { |
| 70 var button; |
| 71 switch (extension.descriptor()["location"]) { |
| 72 case "toolbar-left": |
| 73 button = createButton(extension); |
| 74 if (button) |
| 75 WebInspector.inspectorView.appendToLeftToolbar(button.elemen
t); |
| 76 break; |
| 77 case "toolbar-right": |
| 78 button = createButton(extension); |
| 79 if (button) |
| 80 WebInspector.inspectorView.appendToRightToolbar(button.eleme
nt); |
| 81 break; |
| 82 } |
| 83 if (button && extension.descriptor()["actionId"]) { |
| 84 button.addEventListener("click", function() { |
| 85 WebInspector.actionRegistry.execute(extension.descriptor()["a
ctionId"]); |
| 86 }); |
| 87 } |
| 88 }); |
| 89 |
| 90 function createButton(extension) |
| 91 { |
| 92 var descriptor = extension.descriptor(); |
| 93 if (descriptor.className) |
| 94 return extension.instance().button(); |
| 95 return new WebInspector.StatusBarButton(WebInspector.UIString(descri
ptor["title"]), descriptor["elementClass"]); |
| 96 } |
| 97 }, |
| 98 |
66 _calculateWorkerInspectorTitle: function() | 99 _calculateWorkerInspectorTitle: function() |
67 { | 100 { |
68 var expression = "location.href"; | 101 var expression = "location.href"; |
69 if (WebInspector.queryParam("isSharedWorker")) | 102 if (WebInspector.queryParam("isSharedWorker")) |
70 expression += " + (this.name ? ' (' + this.name + ')' : '')"; | 103 expression += " + (this.name ? ' (' + this.name + ')' : '')"; |
71 RuntimeAgent.invoke_evaluate({expression:expression, doNotPauseOnExcepti
onsAndMuteConsole:true, returnByValue: true}, evalCallback); | 104 RuntimeAgent.invoke_evaluate({expression:expression, doNotPauseOnExcepti
onsAndMuteConsole:true, returnByValue: true}, evalCallback); |
72 | 105 |
73 /** | 106 /** |
74 * @param {?Protocol.Error} error | 107 * @param {?Protocol.Error} error |
75 * @param {!RuntimeAgent.RemoteObject} result | 108 * @param {!RuntimeAgent.RemoteObject} result |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 */ | 310 */ |
278 function hideScreen(screen) | 311 function hideScreen(screen) |
279 { | 312 { |
280 mainTarget.debuggerModel.removeEventListener(WebInspector.Debugg
erModel.Events.GlobalObjectCleared, listener); | 313 mainTarget.debuggerModel.removeEventListener(WebInspector.Debugg
erModel.Events.GlobalObjectCleared, listener); |
281 screen.hide(); | 314 screen.hide(); |
282 } | 315 } |
283 | 316 |
284 screen.showModal(); | 317 screen.showModal(); |
285 } | 318 } |
286 | 319 |
287 WebInspector.settingsController = new WebInspector.SettingsController(); | |
288 | |
289 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints
SidebarPane(); | 320 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints
SidebarPane(); |
290 | 321 |
291 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall
y"); | 322 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall
y"); |
292 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope
nLinkHandler", autoselectPanel); | 323 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope
nLinkHandler", autoselectPanel); |
293 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist
ry(openAnchorLocationSetting); | 324 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist
ry(openAnchorLocationSetting); |
294 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel,
function() { return false; }); | 325 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel,
function() { return false; }); |
295 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L
inkHandler()); | 326 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L
inkHandler()); |
296 | 327 |
297 new WebInspector.WorkspaceController(WebInspector.workspace); | 328 new WebInspector.WorkspaceController(WebInspector.workspace); |
298 | 329 |
299 WebInspector.overridesSupport = new WebInspector.OverridesSupport(WebIns
pector.experimentsSettings.responsiveDesign.isEnabled() && WebInspector.dockCont
roller.canDock()); | 330 WebInspector.overridesSupport = new WebInspector.OverridesSupport(WebIns
pector.experimentsSettings.responsiveDesign.isEnabled() && WebInspector.dockCont
roller.canDock()); |
300 | 331 |
301 WebInspector.liveEditSupport = new WebInspector.LiveEditSupport(WebInspe
ctor.workspace); | 332 WebInspector.liveEditSupport = new WebInspector.LiveEditSupport(WebInspe
ctor.workspace); |
302 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto
r.workspace, WebInspector.networkWorkspaceBinding); | 333 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto
r.workspace, WebInspector.networkWorkspaceBinding); |
303 | 334 |
304 // Create settings before loading modules. | 335 // Create settings before loading modules. |
305 WebInspector.settings.initializeBackendSettings(); | 336 WebInspector.settings.initializeBackendSettings(); |
306 | 337 |
307 this._registerModules(); | 338 this._registerModules(); |
308 WebInspector.actionRegistry = new WebInspector.ActionRegistry(); | 339 WebInspector.actionRegistry = new WebInspector.ActionRegistry(); |
309 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns
pector.actionRegistry); | 340 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns
pector.actionRegistry); |
310 this._registerForwardedShortcuts(); | 341 this._registerForwardedShortcuts(); |
311 this._registerMessageSinkListener(); | 342 this._registerMessageSinkListener(); |
312 | 343 |
313 WebInspector.zoomManager = new WebInspector.ZoomManager(); | 344 WebInspector.zoomManager = new WebInspector.ZoomManager(); |
314 WebInspector.inspectorView = new WebInspector.InspectorView(); | 345 WebInspector.inspectorView = new WebInspector.InspectorView(); |
315 WebInspector.app.createRootView(); | 346 WebInspector.app.createRootView(); |
316 WebInspector.app.createGlobalStatusBarItems(); | 347 this._createGlobalStatusBarItems(); |
317 | 348 |
318 this._addMainEventListeners(document); | 349 this._addMainEventListeners(document); |
319 | 350 |
320 function onResize() | |
321 { | |
322 if (WebInspector.settingsController) | |
323 WebInspector.settingsController.resize(); | |
324 } | |
325 window.addEventListener("resize", onResize, true); | |
326 | |
327 var errorWarningCount = document.getElementById("error-warning-count"); | 351 var errorWarningCount = document.getElementById("error-warning-count"); |
328 | 352 |
329 function showConsole() | 353 function showConsole() |
330 { | 354 { |
331 WebInspector.console.show(); | 355 WebInspector.console.show(); |
332 } | 356 } |
333 errorWarningCount.addEventListener("click", showConsole, false); | 357 errorWarningCount.addEventListener("click", showConsole, false); |
334 this._updateErrorAndWarningCounts(); | 358 this._updateErrorAndWarningCounts(); |
335 | 359 |
336 WebInspector.extensionServerProxy.setFrontendReady(); | 360 WebInspector.extensionServerProxy.setFrontendReady(); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 798 |
775 WebInspector.__defineGetter__("inspectedPageURL", function() | 799 WebInspector.__defineGetter__("inspectedPageURL", function() |
776 { | 800 { |
777 return WebInspector.resourceTreeModel.inspectedPageURL(); | 801 return WebInspector.resourceTreeModel.inspectedPageURL(); |
778 }); | 802 }); |
779 | 803 |
780 WebInspector.panel = function(name) | 804 WebInspector.panel = function(name) |
781 { | 805 { |
782 return WebInspector.inspectorView.panel(name); | 806 return WebInspector.inspectorView.panel(name); |
783 } | 807 } |
OLD | NEW |