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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.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) 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 11 matching lines...) Expand all
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 /** 27 /**
28 * @constructor 28 * @constructor
29 * @extends {WebInspector.Panel} 29 * @extends {WebInspector.Panel}
30 * @implements {WebInspector.ContextMenu.Provider} 30 * @implements {WebInspector.ContextMenu.Provider}
31 * @implements {WebInspector.TargetManager.Observer} 31 * @implements {WebInspector.TargetManager.Observer}
32 * @implements {WebInspector.ViewLocationResolver}
32 */ 33 */
33 WebInspector.SourcesPanel = function() 34 WebInspector.SourcesPanel = function()
34 { 35 {
35 WebInspector.Panel.call(this, "sources"); 36 WebInspector.Panel.call(this, "sources");
36 WebInspector.SourcesPanel._instance = this; 37 WebInspector.SourcesPanel._instance = this;
37 this.registerRequiredCSS("sources/sourcesPanel.css"); 38 this.registerRequiredCSS("sources/sourcesPanel.css");
38 new WebInspector.DropTarget(this.element, [WebInspector.DropTarget.Types.Fil es], WebInspector.UIString("Drop workspace folder here"), this._handleDrop.bind( this)); 39 new WebInspector.DropTarget(this.element, [WebInspector.DropTarget.Types.Fil es], WebInspector.UIString("Drop workspace folder here"), this._handleDrop.bind( this));
39 40
40 this._workspace = WebInspector.workspace; 41 this._workspace = WebInspector.workspace;
41 this._networkMapping = WebInspector.networkMapping; 42 this._networkMapping = WebInspector.networkMapping;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 WebInspector.Panel.prototype.willHide.call(this); 208 WebInspector.Panel.prototype.willHide.call(this);
208 WebInspector.context.setFlavor(WebInspector.SourcesPanel, null); 209 WebInspector.context.setFlavor(WebInspector.SourcesPanel, null);
209 if (WebInspector.SourcesPanel.WrapperView.isShowing()) { 210 if (WebInspector.SourcesPanel.WrapperView.isShowing()) {
210 WebInspector.SourcesPanel.WrapperView._instance._showViewInWrapper() ; 211 WebInspector.SourcesPanel.WrapperView._instance._showViewInWrapper() ;
211 WebInspector.inspectorView.setDrawerMinimized(false); 212 WebInspector.inspectorView.setDrawerMinimized(false);
212 WebInspector.SourcesPanel.updateResizer(this); 213 WebInspector.SourcesPanel.updateResizer(this);
213 } 214 }
214 }, 215 },
215 216
216 /** 217 /**
218 * @override
219 * @param {string} locationName
220 * @return {?WebInspector.ViewLocation}
221 */
222 resolveLocation: function(locationName)
223 {
224 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.ins tance());
225 return this._navigatorTabbedPane;
226 },
227
228 /**
217 * @return {boolean} 229 * @return {boolean}
218 */ 230 */
219 _ensureSourcesViewVisible: function() 231 _ensureSourcesViewVisible: function()
220 { 232 {
221 if (WebInspector.SourcesPanel.WrapperView.isShowing()) 233 if (WebInspector.SourcesPanel.WrapperView.isShowing())
222 return true; 234 return true;
223 return this === WebInspector.inspectorView.setCurrentPanel(this); 235 return this === WebInspector.inspectorView.setCurrentPanel(this);
224 }, 236 },
225 237
226 onResize: function() 238 onResize: function()
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 showUILocation: function(uiLocation, omitFocus) 410 showUILocation: function(uiLocation, omitFocus)
399 { 411 {
400 this.showUISourceCode(uiLocation.uiSourceCode, uiLocation.lineNumber, ui Location.columnNumber, omitFocus); 412 this.showUISourceCode(uiLocation.uiSourceCode, uiLocation.lineNumber, ui Location.columnNumber, omitFocus);
401 }, 413 },
402 414
403 /** 415 /**
404 * @param {!WebInspector.UISourceCode} uiSourceCode 416 * @param {!WebInspector.UISourceCode} uiSourceCode
405 */ 417 */
406 _revealInNavigator: function(uiSourceCode) 418 _revealInNavigator: function(uiSourceCode)
407 { 419 {
408 var extensions = self.runtime.extensions("view").filter(extension => ext ension.descriptor()["location"] === "navigator-view"); 420 var extensions = self.runtime.extensions(WebInspector.NavigatorView);
409 Promise.all(extensions.map(extension => extension.instance())).then(filt erNavigators); 421 Promise.all(extensions.map(extension => extension.instance())).then(filt erNavigators);
410 422
411 /** 423 /**
412 * @param {!Array.<!Object>} objects 424 * @param {!Array.<!Object>} objects
413 */ 425 */
414 function filterNavigators(objects) 426 function filterNavigators(objects)
415 { 427 {
416 for (var i = 0; i < objects.length; ++i) { 428 for (var i = 0; i < objects.length; ++i) {
417 var navigatorView = /** @type {!WebInspector.NavigatorView} */ ( objects[i]); 429 var navigatorView = /** @type {!WebInspector.NavigatorView} */ ( objects[i]);
418 if (navigatorView.accept(uiSourceCode)) { 430 if (navigatorView.accept(uiSourceCode)) {
419 navigatorView.revealWidget();
420 navigatorView.revealUISourceCode(uiSourceCode, true); 431 navigatorView.revealUISourceCode(uiSourceCode, true);
432 WebInspector.viewManager.showView(extensions[i].descriptor() ["viewId"]);
421 } 433 }
422 } 434 }
423 } 435 }
424 }, 436 },
425 437
426 /** 438 /**
427 * @param {!WebInspector.ContextMenu} contextMenu 439 * @param {!WebInspector.ContextMenu} contextMenu
428 */ 440 */
429 _populateNavigatorMenu: function(contextMenu) 441 _populateNavigatorMenu: function(contextMenu)
430 { 442 {
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 __proto__: WebInspector.VBox.prototype 1473 __proto__: WebInspector.VBox.prototype
1462 } 1474 }
1463 1475
1464 /** 1476 /**
1465 * @return {boolean} 1477 * @return {boolean}
1466 */ 1478 */
1467 WebInspector.SourcesPanel.WrapperView.isShowing = function() 1479 WebInspector.SourcesPanel.WrapperView.isShowing = function()
1468 { 1480 {
1469 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); 1481 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing();
1470 } 1482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698