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

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

Issue 2412023002: DevTools: migrate InspectorView to tabbed view location. (Closed)
Patch Set: test fixed Created 4 years, 2 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return this._navigatorTabbedLocation; 222 return this._navigatorTabbedLocation;
223 }, 223 },
224 224
225 /** 225 /**
226 * @return {boolean} 226 * @return {boolean}
227 */ 227 */
228 _ensureSourcesViewVisible: function() 228 _ensureSourcesViewVisible: function()
229 { 229 {
230 if (WebInspector.SourcesPanel.WrapperView.isShowing()) 230 if (WebInspector.SourcesPanel.WrapperView.isShowing())
231 return true; 231 return true;
232 return this === WebInspector.inspectorView.setCurrentPanel(this); 232 if (!WebInspector.inspectorView.canSelectPanel("sources"))
233 return false;
234 WebInspector.viewManager.showView("sources");
235 return true;
233 }, 236 },
234 237
235 onResize: function() 238 onResize: function()
236 { 239 {
237 if (WebInspector.moduleSetting("sidebarPosition").get() === "auto") 240 if (WebInspector.moduleSetting("sidebarPosition").get() === "auto")
238 this.element.window().requestAnimationFrame(this._updateSidebarPosit ion.bind(this)); // Do not force layout. 241 this.element.window().requestAnimationFrame(this._updateSidebarPosit ion.bind(this)); // Do not force layout.
239 }, 242 },
240 243
241 /** 244 /**
242 * @override 245 * @override
243 * @return {!WebInspector.SearchableView} 246 * @return {!WebInspector.SearchableView}
244 */ 247 */
245 searchableView: function() 248 searchableView: function()
246 { 249 {
247 return this._sourcesView.searchableView(); 250 return this._sourcesView.searchableView();
248 }, 251 },
249 252
250 /** 253 /**
251 * @param {!WebInspector.Event} event 254 * @param {!WebInspector.Event} event
252 */ 255 */
253 _debuggerPaused: function(event) 256 _debuggerPaused: function(event)
254 { 257 {
255 var details = /** @type {!WebInspector.DebuggerPausedDetails} */ (event. data); 258 var details = /** @type {!WebInspector.DebuggerPausedDetails} */ (event. data);
256 if (!this._paused) 259 if (!this._paused)
257 WebInspector.inspectorView.setCurrentPanel(this); 260 this._setAsCurrentPanel();
258 261
259 if (WebInspector.context.flavor(WebInspector.Target) === details.target( )) 262 if (WebInspector.context.flavor(WebInspector.Target) === details.target( ))
260 this._showDebuggerPausedDetails(details); 263 this._showDebuggerPausedDetails(details);
261 else if (!this._paused) 264 else if (!this._paused)
262 WebInspector.context.setFlavor(WebInspector.Target, details.target() ); 265 WebInspector.context.setFlavor(WebInspector.Target, details.target() );
263 }, 266 },
264 267
265 /** 268 /**
266 * @param {!WebInspector.DebuggerPausedDetails} details 269 * @param {!WebInspector.DebuggerPausedDetails} details
267 */ 270 */
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } else { 336 } else {
334 this._showEditor(); 337 this._showEditor();
335 } 338 }
336 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNum ber, omitFocus); 339 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNum ber, omitFocus);
337 }, 340 },
338 341
339 _showEditor: function() 342 _showEditor: function()
340 { 343 {
341 if (WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sour cesPanel.WrapperView._instance.isShowing()) 344 if (WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sour cesPanel.WrapperView._instance.isShowing())
342 return; 345 return;
343 WebInspector.inspectorView.setCurrentPanel(this); 346 this._setAsCurrentPanel();
344 }, 347 },
345 348
346 /** 349 /**
347 * @param {!WebInspector.UILocation} uiLocation 350 * @param {!WebInspector.UILocation} uiLocation
348 * @param {boolean=} omitFocus 351 * @param {boolean=} omitFocus
349 */ 352 */
350 showUILocation: function(uiLocation, omitFocus) 353 showUILocation: function(uiLocation, omitFocus)
351 { 354 {
352 this.showUISourceCode(uiLocation.uiSourceCode, uiLocation.lineNumber, ui Location.columnNumber, omitFocus); 355 this.showUISourceCode(uiLocation.uiSourceCode, uiLocation.lineNumber, ui Location.columnNumber, omitFocus);
353 }, 356 },
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 } 1098 }
1096 1099
1097 this._sidebarPaneStack.appendApplicableItems("sources-sidebar"); 1100 this._sidebarPaneStack.appendApplicableItems("sources-sidebar");
1098 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes(); 1101 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes();
1099 for (var i = 0; i < extensionSidebarPanes.length; ++i) 1102 for (var i = 0; i < extensionSidebarPanes.length; ++i)
1100 this._addExtensionSidebarPane(extensionSidebarPanes[i]); 1103 this._addExtensionSidebarPane(extensionSidebarPanes[i]);
1101 1104
1102 this._splitWidget.setSidebarWidget(this.sidebarPaneView); 1105 this._splitWidget.setSidebarWidget(this.sidebarPaneView);
1103 }, 1106 },
1104 1107
1108 /**
1109 * @return {!Promise}
1110 */
1105 _setAsCurrentPanel: function() 1111 _setAsCurrentPanel: function()
1106 { 1112 {
1107 WebInspector.inspectorView.setCurrentPanel(this); 1113 return WebInspector.viewManager.showView("sources");
1108 }, 1114 },
1109 1115
1110 /** 1116 /**
1111 * @param {!WebInspector.Event} event 1117 * @param {!WebInspector.Event} event
1112 */ 1118 */
1113 _extensionSidebarPaneAdded: function(event) 1119 _extensionSidebarPaneAdded: function(event)
1114 { 1120 {
1115 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data ); 1121 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data );
1116 this._addExtensionSidebarPane(pane); 1122 this._addExtensionSidebarPane(pane);
1117 }, 1123 },
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 } 1237 }
1232 1238
1233 WebInspector.SourcesPanel.DebuggerPausedDetailsRevealer.prototype = { 1239 WebInspector.SourcesPanel.DebuggerPausedDetailsRevealer.prototype = {
1234 /** 1240 /**
1235 * @override 1241 * @override
1236 * @param {!Object} object 1242 * @param {!Object} object
1237 * @return {!Promise} 1243 * @return {!Promise}
1238 */ 1244 */
1239 reveal: function(object) 1245 reveal: function(object)
1240 { 1246 {
1241 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.ins tance()); 1247 return WebInspector.SourcesPanel.instance()._setAsCurrentPanel();
1242 return Promise.resolve();
1243 } 1248 }
1244 } 1249 }
1245 1250
1246 /** 1251 /**
1247 * @constructor 1252 * @constructor
1248 * @implements {WebInspector.ActionDelegate} 1253 * @implements {WebInspector.ActionDelegate}
1249 */ 1254 */
1250 WebInspector.SourcesPanel.RevealingActionDelegate = function() {} 1255 WebInspector.SourcesPanel.RevealingActionDelegate = function() {}
1251 1256
1252 WebInspector.SourcesPanel.RevealingActionDelegate.prototype = { 1257 WebInspector.SourcesPanel.RevealingActionDelegate.prototype = {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 var executionContext = WebInspector.context.flavor(WebInspector. ExecutionContext); 1319 var executionContext = WebInspector.context.flavor(WebInspector. ExecutionContext);
1315 if (executionContext) 1320 if (executionContext)
1316 WebInspector.ConsoleModel.evaluateCommandInConsole(execution Context, text); 1321 WebInspector.ConsoleModel.evaluateCommandInConsole(execution Context, text);
1317 } 1322 }
1318 return true; 1323 return true;
1319 } 1324 }
1320 return false; 1325 return false;
1321 } 1326 }
1322 } 1327 }
1323 1328
1324 WebInspector.SourcesPanel.show = function()
1325 {
1326 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.instanc e());
1327 }
1328
1329 /** 1329 /**
1330 * @return {!WebInspector.SourcesPanel} 1330 * @return {!WebInspector.SourcesPanel}
1331 */ 1331 */
1332 WebInspector.SourcesPanel.instance = function() 1332 WebInspector.SourcesPanel.instance = function()
1333 { 1333 {
1334 if (WebInspector.SourcesPanel._instance) 1334 if (WebInspector.SourcesPanel._instance)
1335 return WebInspector.SourcesPanel._instance; 1335 return WebInspector.SourcesPanel._instance;
1336 return /** @type {!WebInspector.SourcesPanel} */ (self.runtime.sharedInstanc e(WebInspector.SourcesPanel)); 1336 return /** @type {!WebInspector.SourcesPanel} */ (self.runtime.sharedInstanc e(WebInspector.SourcesPanel));
1337 } 1337 }
1338 1338
(...skipping 16 matching lines...) Expand all
1355 { 1355 {
1356 WebInspector.VBox.call(this); 1356 WebInspector.VBox.call(this);
1357 this.element.classList.add("sources-view-wrapper"); 1357 this.element.classList.add("sources-view-wrapper");
1358 WebInspector.SourcesPanel.WrapperView._instance = this; 1358 WebInspector.SourcesPanel.WrapperView._instance = this;
1359 this._view = WebInspector.SourcesPanel.instance()._sourcesView; 1359 this._view = WebInspector.SourcesPanel.instance()._sourcesView;
1360 } 1360 }
1361 1361
1362 WebInspector.SourcesPanel.WrapperView.prototype = { 1362 WebInspector.SourcesPanel.WrapperView.prototype = {
1363 wasShown: function() 1363 wasShown: function()
1364 { 1364 {
1365 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV iew.currentPanel().name !== "sources") 1365 if (!WebInspector.SourcesPanel.instance().isShowing())
1366 this._showViewInWrapper(); 1366 this._showViewInWrapper();
1367 else 1367 else
1368 WebInspector.inspectorView.setDrawerMinimized(true); 1368 WebInspector.inspectorView.setDrawerMinimized(true);
1369 WebInspector.SourcesPanel.updateResizer(WebInspector.SourcesPanel.instan ce()); 1369 WebInspector.SourcesPanel.updateResizer(WebInspector.SourcesPanel.instan ce());
1370 }, 1370 },
1371 1371
1372 willHide: function() 1372 willHide: function()
1373 { 1373 {
1374 WebInspector.inspectorView.setDrawerMinimized(false); 1374 WebInspector.inspectorView.setDrawerMinimized(false);
1375 setImmediate(() => WebInspector.SourcesPanel.updateResizer(WebInspector. SourcesPanel.instance())); 1375 setImmediate(() => WebInspector.SourcesPanel.updateResizer(WebInspector. SourcesPanel.instance()));
1376 }, 1376 },
1377 1377
1378 _showViewInWrapper: function() 1378 _showViewInWrapper: function()
1379 { 1379 {
1380 this._view.leftToolbar().removeToolbarItems(); 1380 this._view.leftToolbar().removeToolbarItems();
1381 this._view.rightToolbar().removeToolbarItems(); 1381 this._view.rightToolbar().removeToolbarItems();
1382 this._view.show(this.element); 1382 this._view.show(this.element);
1383 }, 1383 },
1384 1384
1385 __proto__: WebInspector.VBox.prototype 1385 __proto__: WebInspector.VBox.prototype
1386 } 1386 }
1387 1387
1388 /** 1388 /**
1389 * @return {boolean} 1389 * @return {boolean}
1390 */ 1390 */
1391 WebInspector.SourcesPanel.WrapperView.isShowing = function() 1391 WebInspector.SourcesPanel.WrapperView.isShowing = function()
1392 { 1392 {
1393 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); 1393 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing();
1394 } 1394 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698