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

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

Issue 2205123003: DevTools: introduce view locations, allow opening views by id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 4 months 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 * @constructor 32 * @constructor
33 * @implements {InspectorAgent.Dispatcher} 33 * @implements {InspectorAgent.Dispatcher}
34 * @implements {WebInspector.Console.UIDelegate}
35 * @suppressGlobalPropertiesCheck 34 * @suppressGlobalPropertiesCheck
36 */ 35 */
37 WebInspector.Main = function() 36 WebInspector.Main = function()
38 { 37 {
39 WebInspector.console.setUIDelegate(this);
40 WebInspector.Main._instanceForTest = this; 38 WebInspector.Main._instanceForTest = this;
41 runOnWindowLoad(this._loaded.bind(this)); 39 runOnWindowLoad(this._loaded.bind(this));
42 } 40 }
43 41
44 WebInspector.Main.prototype = { 42 WebInspector.Main.prototype = {
45 /**
46 * @override
47 * @return {!Promise.<undefined>}
48 */
49 showConsole: function()
50 {
51 return WebInspector.Revealer.revealPromise(WebInspector.console);
52 },
53
54 _loaded: function() 43 _loaded: function()
55 { 44 {
56 console.timeStamp("Main._loaded"); 45 console.timeStamp("Main._loaded");
57 46
58 if (InspectorFrontendHost.isUnderTest()) 47 if (InspectorFrontendHost.isUnderTest())
59 self.runtime.useTestBase(); 48 self.runtime.useTestBase();
60 Runtime.setPlatform(WebInspector.platform()); 49 Runtime.setPlatform(WebInspector.platform());
61 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); 50 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this));
62 }, 51 },
63 52
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 var themeSetting = WebInspector.settings.createSetting("uiTheme", "defau lt"); 138 var themeSetting = WebInspector.settings.createSetting("uiTheme", "defau lt");
150 WebInspector.initializeUIUtils(document, themeSetting); 139 WebInspector.initializeUIUtils(document, themeSetting);
151 themeSetting.addChangeListener(WebInspector.reload.bind(WebInspector)); 140 themeSetting.addChangeListener(WebInspector.reload.bind(WebInspector));
152 141
153 WebInspector.installComponentRootStyles(/** @type {!Element} */ (documen t.body)); 142 WebInspector.installComponentRootStyles(/** @type {!Element} */ (documen t.body));
154 143
155 this._addMainEventListeners(document); 144 this._addMainEventListeners(document);
156 145
157 var canDock = !!Runtime.queryParam("can_dock"); 146 var canDock = !!Runtime.queryParam("can_dock");
158 WebInspector.zoomManager = new WebInspector.ZoomManager(window, Inspecto rFrontendHost); 147 WebInspector.zoomManager = new WebInspector.ZoomManager(window, Inspecto rFrontendHost);
159 WebInspector.inspectorView = new WebInspector.InspectorView(); 148 WebInspector.inspectorView = WebInspector.InspectorView.instance();
160 WebInspector.ContextMenu.initialize(); 149 WebInspector.ContextMenu.initialize();
161 WebInspector.ContextMenu.installHandler(document); 150 WebInspector.ContextMenu.installHandler(document);
162 WebInspector.Tooltip.installHandler(document); 151 WebInspector.Tooltip.installHandler(document);
163 WebInspector.dockController = new WebInspector.DockController(canDock); 152 WebInspector.dockController = new WebInspector.DockController(canDock);
164 WebInspector.multitargetConsoleModel = new WebInspector.MultitargetConso leModel(); 153 WebInspector.multitargetConsoleModel = new WebInspector.MultitargetConso leModel();
165 WebInspector.multitargetNetworkManager = new WebInspector.MultitargetNet workManager(); 154 WebInspector.multitargetNetworkManager = new WebInspector.MultitargetNet workManager();
166 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E vents.SuspendStateChanged, this._onSuspendStateChanged.bind(this)); 155 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E vents.SuspendStateChanged, this._onSuspendStateChanged.bind(this));
167 156
168 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); 157 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
169 // set order of some sections explicitly 158 // set order of some sections explicitly
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 } 828 }
840 829
841 contextMenu.appendAction("main.toggle-drawer", WebInspector.inspectorVie w.drawerVisible() ? WebInspector.UIString("Hide console drawer") : WebInspector. UIString("Show console drawer")); 830 contextMenu.appendAction("main.toggle-drawer", WebInspector.inspectorVie w.drawerVisible() ? WebInspector.UIString("Hide console drawer") : WebInspector. UIString("Show console drawer"));
842 contextMenu.appendItemsAtLocation("mainMenu"); 831 contextMenu.appendItemsAtLocation("mainMenu");
843 var moreTools = contextMenu.namedSubMenu("mainMenuMoreTools"); 832 var moreTools = contextMenu.namedSubMenu("mainMenuMoreTools");
844 var extensions = self.runtime.extensions("view", undefined, true); 833 var extensions = self.runtime.extensions("view", undefined, true);
845 for (var extension of extensions) { 834 for (var extension of extensions) {
846 var descriptor = extension.descriptor(); 835 var descriptor = extension.descriptor();
847 if (descriptor["location"] !== "drawer-view") 836 if (descriptor["location"] !== "drawer-view")
848 continue; 837 continue;
849 moreTools.appendItem(extension.title(), WebInspector.inspectorView.s howViewInDrawer.bind(WebInspector.inspectorView, descriptor["name"])); 838 moreTools.appendItem(extension.title(), WebInspector.viewManager.sho wView.bind(WebInspector.viewManager, descriptor["id"]));
850 } 839 }
851 840
852 contextMenu.show(); 841 contextMenu.show();
853 } 842 }
854 } 843 }
855 844
856 /** 845 /**
857 * @constructor 846 * @constructor
858 */ 847 */
859 WebInspector.NetworkPanelIndicator = function() 848 WebInspector.NetworkPanelIndicator = function()
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 * @return {?Element} 1091 * @return {?Element}
1103 */ 1092 */
1104 settingElement: function() 1093 settingElement: function()
1105 { 1094 {
1106 return WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStri ng("Show rulers"), WebInspector.moduleSetting("showMetricsRulers")); 1095 return WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStri ng("Show rulers"), WebInspector.moduleSetting("showMetricsRulers"));
1107 } 1096 }
1108 } 1097 }
1109 1098
1110 1099
1111 new WebInspector.Main(); 1100 new WebInspector.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698