Chromium Code Reviews| 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 usBarButton.Provider); | 53 var extensions = WebInspector.moduleManager.extensions(WebInspector.Stat usBarItem.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 button; | 65 var item; |
| 66 switch (extension.descriptor()["location"]) { | 66 switch (extension.descriptor()["location"]) { |
| 67 case "toolbar-left": | 67 case "toolbar-left": |
| 68 button = createButton(extension); | 68 item = createItem(extension); |
| 69 if (button) | 69 if (item) |
| 70 WebInspector.inspectorView.appendToLeftToolbar(button); | 70 WebInspector.inspectorView.appendToLeftToolbar(item); |
| 71 break; | 71 break; |
| 72 case "toolbar-right": | 72 case "toolbar-right": |
| 73 button = createButton(extension); | 73 item = createItem(extension); |
| 74 if (button) | 74 if (item) |
| 75 WebInspector.inspectorView.appendToRightToolbar(button); | 75 WebInspector.inspectorView.appendToRightToolbar(item); |
| 76 break; | 76 break; |
| 77 } | 77 } |
| 78 if (button && extension.descriptor()["actionId"]) { | 78 if (item && extension.descriptor()["actionId"]) { |
| 79 button.addEventListener("click", function() { | 79 item.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 createButton(extension) | 85 function createItem(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().button(); | 89 return extension.instance().item(); |
| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints SidebarPane(); | 353 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints SidebarPane(); |
| 354 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall y"); | 354 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall y"); |
| 355 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope nLinkHandler", autoselectPanel); | 355 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope nLinkHandler", autoselectPanel); |
| 356 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist ry(openAnchorLocationSetting); | 356 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist ry(openAnchorLocationSetting); |
| 357 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; }); | 357 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; }); |
| 358 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L inkHandler()); | 358 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L inkHandler()); |
| 359 new WebInspector.WorkspaceController(WebInspector.workspace); | 359 new WebInspector.WorkspaceController(WebInspector.workspace); |
| 360 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto r.workspace, WebInspector.networkWorkspaceBinding); | 360 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto r.workspace, WebInspector.networkWorkspaceBinding); |
| 361 new WebInspector.RenderingOptions(); | 361 new WebInspector.RenderingOptions(); |
| 362 new WebInspector.Main.PauseListener(); | 362 new WebInspector.Main.PauseListener(); |
| 363 new WebInspector.Main.WarningErrorCounter(); | |
| 364 new WebInspector.Main.InspectedNodeRevealer(); | 363 new WebInspector.Main.InspectedNodeRevealer(); |
| 365 | 364 |
| 366 this._addMainEventListeners(document); | 365 this._addMainEventListeners(document); |
| 367 | 366 |
| 368 var errorWarningCount = document.getElementById("error-warning-count"); | |
| 369 function showConsole() | |
| 370 { | |
| 371 WebInspector.console.show(); | |
| 372 } | |
| 373 errorWarningCount.addEventListener("click", showConsole, false); | |
| 374 | |
| 375 WebInspector.extensionServerProxy.setFrontendReady(); | 367 WebInspector.extensionServerProxy.setFrontendReady(); |
| 376 | 368 |
| 377 InspectorAgent.enable(inspectorAgentEnableCallback); | 369 InspectorAgent.enable(inspectorAgentEnableCallback); |
| 378 | 370 |
| 379 function inspectorAgentEnableCallback() | 371 function inspectorAgentEnableCallback() |
| 380 { | 372 { |
| 381 console.timeStamp("Main.inspectorAgentEnableCallback"); | 373 console.timeStamp("Main.inspectorAgentEnableCallback"); |
| 382 WebInspector.app.presentUI(mainTarget); | 374 WebInspector.app.presentUI(mainTarget); |
| 383 console.timeStamp("Main.inspectorAgentEnableCallbackPresentUI"); | 375 console.timeStamp("Main.inspectorAgentEnableCallbackPresentUI"); |
| 384 } | 376 } |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 824 * @param {string} name | 816 * @param {string} name |
| 825 * @return {?WebInspector.Panel} | 817 * @return {?WebInspector.Panel} |
| 826 */ | 818 */ |
| 827 WebInspector.panel = function(name) | 819 WebInspector.panel = function(name) |
| 828 { | 820 { |
| 829 return WebInspector.inspectorView.panel(name); | 821 return WebInspector.inspectorView.panel(name); |
| 830 } | 822 } |
| 831 | 823 |
| 832 /** | 824 /** |
| 833 * @constructor | 825 * @constructor |
| 826 * @implements {WebInspector.StatusBarItem.Provider} | |
| 834 */ | 827 */ |
| 835 WebInspector.Main.WarningErrorCounter = function() | 828 WebInspector.Main.WarningErrorCounter = function() |
| 836 { | 829 { |
| 830 this._counter = new WebInspector.StatusBarCounter(["error-icon-small", "warn ing-icon-small"]); | |
| 831 this._counter.addEventListener("click", showConsole); | |
| 832 | |
| 833 function showConsole() | |
| 834 { | |
| 835 WebInspector.console.show(); | |
| 836 } | |
| 837 | |
| 837 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this); | 838 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this); |
| 838 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageAdded, this._updateErrorAndWarningCounts, this); | 839 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageAdded, this._updateErrorAndWarningCounts, this); |
| 839 } | 840 } |
| 840 | 841 |
| 841 WebInspector.Main.WarningErrorCounter.prototype = { | 842 WebInspector.Main.WarningErrorCounter.prototype = { |
| 842 _updateErrorAndWarningCounts: function() | 843 _updateErrorAndWarningCounts: function() |
| 843 { | 844 { |
| 844 var errors = 0; | 845 var errors = 0; |
| 845 var warnings = 0; | 846 var warnings = 0; |
| 846 var targets = WebInspector.targetManager.targets(); | 847 var targets = WebInspector.targetManager.targets(); |
| 847 for (var i = 0; i < targets.length; ++i) { | 848 for (var i = 0; i < targets.length; ++i) { |
| 848 errors = errors + targets[i].consoleModel.errors; | 849 errors = errors + targets[i].consoleModel.errors; |
| 849 warnings = warnings + targets[i].consoleModel.warnings; | 850 warnings = warnings + targets[i].consoleModel.warnings; |
| 850 } | 851 } |
| 851 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings); | 852 this._counter.setCounter("error-icon-small", errors, WebInspector.UIStri ng("%d error%s", errors, errors > 1 ? "s" : "")); |
|
apavlov
2014/07/21 13:34:06
I believe this should be String.sprintf() rather t
dgozman
2014/07/21 14:24:34
Did the same as device counter.
| |
| 853 this._counter.setCounter("warning-icon-small", warnings, WebInspector.UI String("%d warning%s", warnings, warnings > 1 ? "s" : "")); | |
|
apavlov
2014/07/21 13:34:06
ditto
dgozman
2014/07/21 14:24:34
Done.
| |
| 854 WebInspector.inspectorView.toolbarItemResized(); | |
| 855 }, | |
| 856 | |
| 857 /** | |
| 858 * @return {?WebInspector.StatusBarItem} | |
| 859 */ | |
| 860 item: function() | |
| 861 { | |
| 862 return this._counter; | |
| 852 } | 863 } |
| 853 } | 864 } |
| 854 | 865 |
| 855 /** | 866 /** |
| 856 * @constructor | 867 * @constructor |
| 857 */ | 868 */ |
| 858 WebInspector.Main.PauseListener = function() | 869 WebInspector.Main.PauseListener = function() |
| 859 { | 870 { |
| 860 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); | 871 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); |
| 861 } | 872 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 883 | 894 |
| 884 WebInspector.Main.InspectedNodeRevealer.prototype = { | 895 WebInspector.Main.InspectedNodeRevealer.prototype = { |
| 885 /** | 896 /** |
| 886 * @param {!WebInspector.Event} event | 897 * @param {!WebInspector.Event} event |
| 887 */ | 898 */ |
| 888 _inspectNode: function(event) | 899 _inspectNode: function(event) |
| 889 { | 900 { |
| 890 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data)); | 901 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data)); |
| 891 } | 902 } |
| 892 } | 903 } |
| OLD | NEW |