| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 { | 43 { |
| 44 this._loaded(); | 44 this._loaded(); |
| 45 window.removeEventListener("DOMContentLoaded", boundListener, false); | 45 window.removeEventListener("DOMContentLoaded", boundListener, false); |
| 46 } | 46 } |
| 47 window.addEventListener("DOMContentLoaded", boundListener, false); | 47 window.addEventListener("DOMContentLoaded", boundListener, false); |
| 48 } | 48 } |
| 49 | 49 |
| 50 WebInspector.Main.prototype = { | 50 WebInspector.Main.prototype = { |
| 51 _createGlobalStatusBarItems: function() | 51 _createGlobalStatusBarItems: function() |
| 52 { | 52 { |
| 53 var extensions = WebInspector.moduleManager.extensions(WebInspector.Stat
usBarItem.Provider); | 53 var extensions = WebInspector.moduleManager.extensions(WebInspector.Stat
usBarButton.Provider); |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * @param {!WebInspector.ModuleManager.Extension} left | 56 * @param {!WebInspector.ModuleManager.Extension} left |
| 57 * @param {!WebInspector.ModuleManager.Extension} right | 57 * @param {!WebInspector.ModuleManager.Extension} right |
| 58 */ | 58 */ |
| 59 function orderComparator(left, right) | 59 function orderComparator(left, right) |
| 60 { | 60 { |
| 61 return left.descriptor()["order"] - right.descriptor()["order"]; | 61 return left.descriptor()["order"] - right.descriptor()["order"]; |
| 62 } | 62 } |
| 63 extensions.sort(orderComparator); | 63 extensions.sort(orderComparator); |
| 64 extensions.forEach(function(extension) { | 64 extensions.forEach(function(extension) { |
| 65 var item; | 65 var button; |
| 66 switch (extension.descriptor()["location"]) { | 66 switch (extension.descriptor()["location"]) { |
| 67 case "toolbar-left": | 67 case "toolbar-left": |
| 68 item = createItem(extension); | 68 button = createButton(extension); |
| 69 if (item) | 69 if (button) |
| 70 WebInspector.inspectorView.appendToLeftToolbar(item); | 70 WebInspector.inspectorView.appendToLeftToolbar(button); |
| 71 break; | 71 break; |
| 72 case "toolbar-right": | 72 case "toolbar-right": |
| 73 item = createItem(extension); | 73 button = createButton(extension); |
| 74 if (item) | 74 if (button) |
| 75 WebInspector.inspectorView.appendToRightToolbar(item); | 75 WebInspector.inspectorView.appendToRightToolbar(button); |
| 76 break; | 76 break; |
| 77 } | 77 } |
| 78 if (item && extension.descriptor()["actionId"]) { | 78 if (button && extension.descriptor()["actionId"]) { |
| 79 item.addEventListener("click", function() { | 79 button.addEventListener("click", function() { |
| 80 WebInspector.actionRegistry.execute(extension.descriptor()["
actionId"]); | 80 WebInspector.actionRegistry.execute(extension.descriptor()["
actionId"]); |
| 81 }); | 81 }); |
| 82 } | 82 } |
| 83 }); | 83 }); |
| 84 | 84 |
| 85 function createItem(extension) | 85 function createButton(extension) |
| 86 { | 86 { |
| 87 var descriptor = extension.descriptor(); | 87 var descriptor = extension.descriptor(); |
| 88 if (descriptor.className) | 88 if (descriptor.className) |
| 89 return extension.instance().item(); | 89 return extension.instance().button(); |
| 90 return new WebInspector.StatusBarButton(WebInspector.UIString(descri
ptor["title"]), descriptor["elementClass"]); | 90 return new WebInspector.StatusBarButton(WebInspector.UIString(descri
ptor["title"]), descriptor["elementClass"]); |
| 91 } | 91 } |
| 92 }, | 92 }, |
| 93 | 93 |
| 94 _calculateWorkerInspectorTitle: function() | 94 _calculateWorkerInspectorTitle: function() |
| 95 { | 95 { |
| 96 var expression = "location.href"; | 96 var expression = "location.href"; |
| 97 if (WebInspector.queryParam("isSharedWorker")) | 97 if (WebInspector.queryParam("isSharedWorker")) |
| 98 expression += " + (this.name ? ' (' + this.name + ')' : '')"; | 98 expression += " + (this.name ? ' (' + this.name + ')' : '')"; |
| 99 RuntimeAgent.invoke_evaluate({expression:expression, doNotPauseOnExcepti
onsAndMuteConsole:true, returnByValue: true}, evalCallback); | 99 RuntimeAgent.invoke_evaluate({expression:expression, doNotPauseOnExcepti
onsAndMuteConsole:true, returnByValue: true}, evalCallback); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints
SidebarPane(); | 355 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints
SidebarPane(); |
| 356 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall
y"); | 356 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall
y"); |
| 357 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope
nLinkHandler", autoselectPanel); | 357 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope
nLinkHandler", autoselectPanel); |
| 358 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist
ry(openAnchorLocationSetting); | 358 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist
ry(openAnchorLocationSetting); |
| 359 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel,
function() { return false; }); | 359 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel,
function() { return false; }); |
| 360 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L
inkHandler()); | 360 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L
inkHandler()); |
| 361 new WebInspector.WorkspaceController(WebInspector.workspace); | 361 new WebInspector.WorkspaceController(WebInspector.workspace); |
| 362 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto
r.workspace, WebInspector.networkWorkspaceBinding); | 362 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto
r.workspace, WebInspector.networkWorkspaceBinding); |
| 363 new WebInspector.RenderingOptions(); | 363 new WebInspector.RenderingOptions(); |
| 364 new WebInspector.Main.PauseListener(); | 364 new WebInspector.Main.PauseListener(); |
| 365 new WebInspector.Main.WarningErrorCounter(); |
| 365 new WebInspector.Main.InspectedNodeRevealer(); | 366 new WebInspector.Main.InspectedNodeRevealer(); |
| 366 | 367 |
| 367 this._addMainEventListeners(document); | 368 this._addMainEventListeners(document); |
| 368 | 369 |
| 370 var errorWarningCount = document.getElementById("error-warning-count"); |
| 371 function showConsole() |
| 372 { |
| 373 WebInspector.console.show(); |
| 374 } |
| 375 errorWarningCount.addEventListener("click", showConsole, false); |
| 376 |
| 369 WebInspector.extensionServerProxy.setFrontendReady(); | 377 WebInspector.extensionServerProxy.setFrontendReady(); |
| 370 | 378 |
| 371 InspectorAgent.enable(inspectorAgentEnableCallback); | 379 InspectorAgent.enable(inspectorAgentEnableCallback); |
| 372 | 380 |
| 373 function inspectorAgentEnableCallback() | 381 function inspectorAgentEnableCallback() |
| 374 { | 382 { |
| 375 console.timeStamp("Main.inspectorAgentEnableCallback"); | 383 console.timeStamp("Main.inspectorAgentEnableCallback"); |
| 376 WebInspector.app.presentUI(mainTarget); | 384 WebInspector.app.presentUI(mainTarget); |
| 377 console.timeStamp("Main.inspectorAgentEnableCallbackPresentUI"); | 385 console.timeStamp("Main.inspectorAgentEnableCallbackPresentUI"); |
| 378 } | 386 } |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 * @param {string} name | 829 * @param {string} name |
| 822 * @return {?WebInspector.Panel} | 830 * @return {?WebInspector.Panel} |
| 823 */ | 831 */ |
| 824 WebInspector.panel = function(name) | 832 WebInspector.panel = function(name) |
| 825 { | 833 { |
| 826 return WebInspector.inspectorView.panel(name); | 834 return WebInspector.inspectorView.panel(name); |
| 827 } | 835 } |
| 828 | 836 |
| 829 /** | 837 /** |
| 830 * @constructor | 838 * @constructor |
| 831 * @implements {WebInspector.StatusBarItem.Provider} | |
| 832 */ | 839 */ |
| 833 WebInspector.Main.WarningErrorCounter = function() | 840 WebInspector.Main.WarningErrorCounter = function() |
| 834 { | 841 { |
| 835 this._counter = new WebInspector.StatusBarCounter(["error-icon-small", "warn
ing-icon-small"]); | |
| 836 this._counter.addEventListener("click", showConsole); | |
| 837 | |
| 838 function showConsole() | |
| 839 { | |
| 840 WebInspector.console.show(); | |
| 841 } | |
| 842 | |
| 843 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this); | 842 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this); |
| 844 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._updateErrorAndWarningCounts, this); | 843 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._updateErrorAndWarningCounts, this); |
| 845 } | 844 } |
| 846 | 845 |
| 847 WebInspector.Main.WarningErrorCounter.prototype = { | 846 WebInspector.Main.WarningErrorCounter.prototype = { |
| 848 _updateErrorAndWarningCounts: function() | 847 _updateErrorAndWarningCounts: function() |
| 849 { | 848 { |
| 850 var errors = 0; | 849 var errors = 0; |
| 851 var warnings = 0; | 850 var warnings = 0; |
| 852 var targets = WebInspector.targetManager.targets(); | 851 var targets = WebInspector.targetManager.targets(); |
| 853 for (var i = 0; i < targets.length; ++i) { | 852 for (var i = 0; i < targets.length; ++i) { |
| 854 errors = errors + targets[i].consoleModel.errors; | 853 errors = errors + targets[i].consoleModel.errors; |
| 855 warnings = warnings + targets[i].consoleModel.warnings; | 854 warnings = warnings + targets[i].consoleModel.warnings; |
| 856 } | 855 } |
| 857 this._counter.setCounter("error-icon-small", errors, WebInspector.UIStri
ng(errors > 1 ? "%d errors" : "%d error", errors)); | 856 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings); |
| 858 this._counter.setCounter("warning-icon-small", warnings, WebInspector.UI
String(warnings > 1 ? "%d warnings" : "%d warning", warnings)); | |
| 859 WebInspector.inspectorView.toolbarItemResized(); | |
| 860 }, | |
| 861 | |
| 862 /** | |
| 863 * @return {?WebInspector.StatusBarItem} | |
| 864 */ | |
| 865 item: function() | |
| 866 { | |
| 867 return this._counter; | |
| 868 } | 857 } |
| 869 } | 858 } |
| 870 | 859 |
| 871 /** | 860 /** |
| 872 * @constructor | 861 * @constructor |
| 873 */ | 862 */ |
| 874 WebInspector.Main.PauseListener = function() | 863 WebInspector.Main.PauseListener = function() |
| 875 { | 864 { |
| 876 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); | 865 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); |
| 877 } | 866 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 899 | 888 |
| 900 WebInspector.Main.InspectedNodeRevealer.prototype = { | 889 WebInspector.Main.InspectedNodeRevealer.prototype = { |
| 901 /** | 890 /** |
| 902 * @param {!WebInspector.Event} event | 891 * @param {!WebInspector.Event} event |
| 903 */ | 892 */ |
| 904 _inspectNode: function(event) | 893 _inspectNode: function(event) |
| 905 { | 894 { |
| 906 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event
.data)); | 895 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event
.data)); |
| 907 } | 896 } |
| 908 } | 897 } |
| OLD | NEW |