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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js

Issue 2217783002: DevTools: use view locations in the elements and sources sidebars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 this._splitWidget.show(this.element); 57 this._splitWidget.show(this.element);
58 58
59 // Create scripts navigator 59 // Create scripts navigator
60 const initialNavigatorWidth = 225; 60 const initialNavigatorWidth = 225;
61 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth); 61 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth);
62 this.editorView.enableShowModeSaving(); 62 this.editorView.enableShowModeSaving();
63 this.editorView.element.tabIndex = 0; 63 this.editorView.element.tabIndex = 0;
64 this._splitWidget.setMainWidget(this.editorView); 64 this._splitWidget.setMainWidget(this.editorView);
65 65
66 // Create navigator tabbed pane with toolbar. 66 // Create navigator tabbed pane with toolbar.
67 this._navigatorTabbedLocation = WebInspector.viewManager.createTabbedLocatio n("navigator-view", true); 67 this._navigatorTabbedLocation = WebInspector.viewManager.createTabbedLocatio n(this._setAsCurrentPanel.bind(this), "navigator-view", true);
68 var tabbedPane = this._navigatorTabbedLocation.tabbedPane(); 68 var tabbedPane = this._navigatorTabbedLocation.tabbedPane();
69 tabbedPane.setMinimumSize(100, 25); 69 tabbedPane.setMinimumSize(100, 25);
70 tabbedPane.setShrinkableTabs(true); 70 tabbedPane.setShrinkableTabs(true);
71 tabbedPane.element.classList.add("navigator-tabbed-pane"); 71 tabbedPane.element.classList.add("navigator-tabbed-pane");
72 var navigatorToolbar = new WebInspector.Toolbar(""); 72 var navigatorToolbar = new WebInspector.Toolbar("");
73 var navigatorMenuButton = new WebInspector.ToolbarMenuButton(this._populateN avigatorMenu.bind(this), true); 73 var navigatorMenuButton = new WebInspector.ToolbarMenuButton(this._populateN avigatorMenu.bind(this), true);
74 navigatorMenuButton.setTitle(WebInspector.UIString("More options")); 74 navigatorMenuButton.setTitle(WebInspector.UIString("More options"));
75 navigatorToolbar.appendToolbarItem(navigatorMenuButton); 75 navigatorToolbar.appendToolbarItem(navigatorMenuButton);
76 tabbedPane.appendAfterTabStrip(navigatorToolbar.element); 76 tabbedPane.appendAfterTabStrip(navigatorToolbar.element);
77 this.editorView.setSidebarWidget(tabbedPane); 77 this.editorView.setSidebarWidget(tabbedPane);
(...skipping 11 matching lines...) Expand all
89 this.sidebarPanes.callstack.addEventListener(WebInspector.CallStackSidebarPa ne.Events.CallFrameSelected, this._callFrameSelectedInSidebar.bind(this)); 89 this.sidebarPanes.callstack.addEventListener(WebInspector.CallStackSidebarPa ne.Events.CallFrameSelected, this._callFrameSelectedInSidebar.bind(this));
90 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th is)); 90 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th is));
91 91
92 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); 92 this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane();
93 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide barPane(WebInspector.breakpointManager, this.showUISourceCode.bind(this)); 93 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide barPane(WebInspector.breakpointManager, this.showUISourceCode.bind(this));
94 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); 94 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this);
95 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan e(); 95 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan e();
96 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB reakpointsSidebarPane(); 96 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB reakpointsSidebarPane();
97 this.sidebarPanes.objectEventListeners = new WebInspector.ObjectEventListene rsSidebarPane(); 97 this.sidebarPanes.objectEventListeners = new WebInspector.ObjectEventListene rsSidebarPane();
98 98
99 this._lastSelectedTabSetting = WebInspector.settings.createLocalSetting("las tSelectedSourcesSidebarPaneTab", WebInspector.UIString("Scope"));
100
101 this._installDebuggerSidebarController(); 99 this._installDebuggerSidebarController();
102 100
103 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this)); 101 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this));
104 this._updateSidebarPosition(); 102 this._updateSidebarPosition();
105 103
106 this._updateDebuggerButtons(); 104 this._updateDebuggerButtons();
107 this._pauseOnExceptionEnabledChanged(); 105 this._pauseOnExceptionEnabledChanged();
108 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionEnabledChanged, this); 106 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionEnabledChanged, this);
109 107
110 this._liveLocationPool = new WebInspector.LiveLocationPool(); 108 this._liveLocationPool = new WebInspector.LiveLocationPool();
(...skipping 21 matching lines...) Expand all
132 /** 130 /**
133 * @override 131 * @override
134 * @param {!WebInspector.Target} target 132 * @param {!WebInspector.Target} target
135 */ 133 */
136 targetAdded: function(target) 134 targetAdded: function(target)
137 { 135 {
138 var hasThreads = WebInspector.targetManager.targets(WebInspector.Target. Capability.JS).length > 1; 136 var hasThreads = WebInspector.targetManager.targets(WebInspector.Target. Capability.JS).length > 1;
139 if (hasThreads && !this.sidebarPanes.threads) { 137 if (hasThreads && !this.sidebarPanes.threads) {
140 this.sidebarPanes.threads = new WebInspector.ThreadsSidebarPane(); 138 this.sidebarPanes.threads = new WebInspector.ThreadsSidebarPane();
141 if (this._sidebarPaneStack) { 139 if (this._sidebarPaneStack) {
142 this._sidebarPaneStack.insertViewBefore(this.sidebarPanes.thread s, this._splitWidget.isVertical() ? this.sidebarPanes.watchExpressions : this.si debarPanes.callstack, true); 140 this._sidebarPaneStack.showView(this.sidebarPanes.threads, this. _splitWidget.isVertical() ? this.sidebarPanes.watchExpressions : this.sidebarPan es.callstack);
143 } 141 }
144 } 142 }
145 }, 143 },
146 144
147 /** 145 /**
148 * @override 146 * @override
149 * @param {!WebInspector.Target} target 147 * @param {!WebInspector.Target} target
150 */ 148 */
151 targetRemoved: function(target) 149 targetRemoved: function(target)
152 { 150 {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 WebInspector.inspectorView.setDrawerMinimized(false); 210 WebInspector.inspectorView.setDrawerMinimized(false);
213 WebInspector.SourcesPanel.updateResizer(this); 211 WebInspector.SourcesPanel.updateResizer(this);
214 } 212 }
215 }, 213 },
216 214
217 /** 215 /**
218 * @override 216 * @override
219 * @param {string} locationName 217 * @param {string} locationName
220 * @return {?WebInspector.ViewLocation} 218 * @return {?WebInspector.ViewLocation}
221 */ 219 */
222 revealLocation: function(locationName) 220 resolveLocation: function(locationName)
223 { 221 {
224 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.ins tance());
225 return this._navigatorTabbedLocation; 222 return this._navigatorTabbedLocation;
226 }, 223 },
227 224
228 /** 225 /**
229 * @return {boolean} 226 * @return {boolean}
230 */ 227 */
231 _ensureSourcesViewVisible: function() 228 _ensureSourcesViewVisible: function()
232 { 229 {
233 if (WebInspector.SourcesPanel.WrapperView.isShowing()) 230 if (WebInspector.SourcesPanel.WrapperView.isShowing())
234 return true; 231 return true;
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1115
1119 this._splitWidget.setVertical(!vertically); 1116 this._splitWidget.setVertical(!vertically);
1120 this._splitWidget.element.classList.toggle("sources-split-view-vertical" , vertically); 1117 this._splitWidget.element.classList.toggle("sources-split-view-vertical" , vertically);
1121 1118
1122 WebInspector.SourcesPanel.updateResizer(this); 1119 WebInspector.SourcesPanel.updateResizer(this);
1123 1120
1124 // Create vertical box with stack. 1121 // Create vertical box with stack.
1125 var vbox = new WebInspector.VBox(); 1122 var vbox = new WebInspector.VBox();
1126 vbox.element.appendChild(this._debugToolbarDrawer); 1123 vbox.element.appendChild(this._debugToolbarDrawer);
1127 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100); 1124 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100);
1128 this._sidebarPaneStack = new WebInspector.View.ExpandableStackContainer( ); 1125 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._setAsCurrentPanel.bind(this), "sources-sidebar");
1129 this._sidebarPaneStack.show(vbox.element); 1126 this._sidebarPaneStack.widget().show(vbox.element);
1130 vbox.element.appendChild(this._debugToolbar.element); 1127 vbox.element.appendChild(this._debugToolbar.element);
1131 1128
1129 if (this.sidebarPanes.threads)
1130 this._sidebarPaneStack.showView(this.sidebarPanes.threads);
1131
1132 if (!vertically) { 1132 if (!vertically) {
1133 // Populate the only stack. 1133 if (this.sidebarPanes.watchExpressions.hasExpressions())
1134 this._sidebarPaneStack.showView(this.sidebarPanes.watchExpressio ns);
1135 else
1136 this._sidebarPaneStack.appendView(this.sidebarPanes.watchExpress ions);
1137 }
1138
1139 this._sidebarPaneStack.showView(this.sidebarPanes.callstack);
1140 this._sidebarPaneStack.showView(this.sidebarPanes.scopechain);
1141 this._sidebarPaneStack.showView(this.sidebarPanes.jsBreakpoints);
1142
1143 if (!vertically) {
1144 // Populate the rest of the stack.
1134 for (var pane in this.sidebarPanes) { 1145 for (var pane in this.sidebarPanes) {
1135 if (this.sidebarPanes[pane]) 1146 if (this.sidebarPanes[pane])
1136 this._sidebarPaneStack.appendView(this.sidebarPanes[pane]); 1147 this._sidebarPaneStack.appendView(this.sidebarPanes[pane]);
1137 } 1148 }
1138 this._extensionSidebarPanesContainer = this._sidebarPaneStack; 1149 this._extensionSidebarPanesContainer = this._sidebarPaneStack;
1139 this.sidebarPaneView = vbox; 1150 this.sidebarPaneView = vbox;
1140
1141 this.sidebarPanes.scopechain.revealWidget();
1142 this.sidebarPanes.watchExpressions.expandIfNecessary();
1143 } else { 1151 } else {
1144 var splitWidget = new WebInspector.SplitWidget(true, true, "sourcesP anelDebuggerSidebarSplitViewState", 0.5); 1152 var splitWidget = new WebInspector.SplitWidget(true, true, "sourcesP anelDebuggerSidebarSplitViewState", 0.5);
1145 splitWidget.setMainWidget(vbox); 1153 splitWidget.setMainWidget(vbox);
1146 1154
1147 // Populate the left stack. 1155 // Populate the left stack.
1148 if (this.sidebarPanes.threads)
1149 this._sidebarPaneStack.appendView(this.sidebarPanes.threads);
1150 this._sidebarPaneStack.appendView(this.sidebarPanes.callstack);
1151 this._sidebarPaneStack.appendView(this.sidebarPanes.jsBreakpoints);
1152 this._sidebarPaneStack.appendView(this.sidebarPanes.domBreakpoints); 1156 this._sidebarPaneStack.appendView(this.sidebarPanes.domBreakpoints);
1153 this._sidebarPaneStack.appendView(this.sidebarPanes.xhrBreakpoints); 1157 this._sidebarPaneStack.appendView(this.sidebarPanes.xhrBreakpoints);
1154 this._sidebarPaneStack.appendView(this.sidebarPanes.eventListenerBre akpoints); 1158 this._sidebarPaneStack.appendView(this.sidebarPanes.eventListenerBre akpoints);
1155 this._sidebarPaneStack.appendView(this.sidebarPanes.objectEventListe ners); 1159 this._sidebarPaneStack.appendView(this.sidebarPanes.objectEventListe ners);
1156 1160
1157 var tabbedPane = new WebInspector.View.TabbedPaneContainer(); 1161 var tabbedLocation = WebInspector.viewManager.createTabbedLocation(t his._setAsCurrentPanel.bind(this), "sources-sidebar-tabs");
1158 splitWidget.setSidebarWidget(tabbedPane); 1162 splitWidget.setSidebarWidget(tabbedLocation.tabbedPane());
1159 tabbedPane.appendView(this.sidebarPanes.scopechain); 1163 tabbedLocation.appendView(this.sidebarPanes.scopechain);
1160 tabbedPane.appendView(this.sidebarPanes.watchExpressions); 1164 tabbedLocation.appendView(this.sidebarPanes.watchExpressions);
1161 if (this.sidebarPanes.serviceWorkers) 1165 this._extensionSidebarPanesContainer = tabbedLocation;
1162 tabbedPane.appendView(this.sidebarPanes.serviceWorkers);
1163 tabbedPane.selectTab(this._lastSelectedTabSetting.get());
1164 tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSe lected, this._tabSelected, this);
1165 this._extensionSidebarPanesContainer = tabbedPane;
1166 this.sidebarPaneView = splitWidget; 1166 this.sidebarPaneView = splitWidget;
1167 } 1167 }
1168 1168
1169 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); 1169 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes();
1170 for (var i = 0; i < extensionSidebarPanes.length; ++i) 1170 for (var i = 0; i < extensionSidebarPanes.length; ++i)
1171 this._addExtensionSidebarPane(extensionSidebarPanes[i]); 1171 this._addExtensionSidebarPane(extensionSidebarPanes[i]);
1172 1172
1173 this._splitWidget.setSidebarWidget(this.sidebarPaneView); 1173 this._splitWidget.setSidebarWidget(this.sidebarPaneView);
1174 if (this.sidebarPanes.threads) 1174 },
1175 this.sidebarPanes.threads.revealWidget(); 1175
1176 this.sidebarPanes.jsBreakpoints.revealWidget(); 1176 _setAsCurrentPanel: function()
1177 this.sidebarPanes.callstack.revealWidget(); 1177 {
1178 WebInspector.inspectorView.setCurrentPanel(this);
1178 }, 1179 },
1179 1180
1180 /** 1181 /**
1181 * @param {!WebInspector.Event} event
1182 */
1183 _tabSelected: function(event)
1184 {
1185 this._lastSelectedTabSetting.set(event.data.tabId);
1186 },
1187
1188 /**
1189 * @param {!WebInspector.Event} event 1182 * @param {!WebInspector.Event} event
1190 */ 1183 */
1191 _extensionSidebarPaneAdded: function(event) 1184 _extensionSidebarPaneAdded: function(event)
1192 { 1185 {
1193 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data ); 1186 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data );
1194 this._addExtensionSidebarPane(pane); 1187 this._addExtensionSidebarPane(pane);
1195 }, 1188 },
1196 1189
1197 /** 1190 /**
1198 * @param {!WebInspector.ExtensionSidebarPane} pane 1191 * @param {!WebInspector.ExtensionSidebarPane} pane
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 __proto__: WebInspector.VBox.prototype 1466 __proto__: WebInspector.VBox.prototype
1474 } 1467 }
1475 1468
1476 /** 1469 /**
1477 * @return {boolean} 1470 * @return {boolean}
1478 */ 1471 */
1479 WebInspector.SourcesPanel.WrapperView.isShowing = function() 1472 WebInspector.SourcesPanel.WrapperView.isShowing = function()
1480 { 1473 {
1481 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); 1474 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing();
1482 } 1475 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698