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

Side by Side Diff: Source/devtools/front_end/ui/InspectorView.js

Issue 268293003: DevTools: Get rid of WebInspector.panels (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 // DevTools sidebar is a vertical split of panels tabbed pane and a drawer. 41 // DevTools sidebar is a vertical split of panels tabbed pane and a drawer.
42 this._drawerSplitView = new WebInspector.SplitView(false, true, "Inspector.d rawerSplitViewState", 200, 200); 42 this._drawerSplitView = new WebInspector.SplitView(false, true, "Inspector.d rawerSplitViewState", 200, 200);
43 this._drawerSplitView.hideSidebar(); 43 this._drawerSplitView.hideSidebar();
44 this._drawerSplitView.enableShowModeSaving(); 44 this._drawerSplitView.enableShowModeSaving();
45 this._drawerSplitView.show(this.element); 45 this._drawerSplitView.show(this.element);
46 46
47 this._tabbedPane = new WebInspector.TabbedPane(); 47 this._tabbedPane = new WebInspector.TabbedPane();
48 this._tabbedPane.setRetainTabOrder(true, WebInspector.moduleManager.orderCom parator(WebInspector.Panel, "name", "order")); 48 this._tabbedPane.setRetainTabOrder(true, WebInspector.moduleManager.orderCom parator(WebInspector.Panel, "name", "order"));
49 this._tabbedPane.show(this._drawerSplitView.mainElement()); 49 this._tabbedPane.show(this._drawerSplitView.mainElement());
50 this._drawer = new WebInspector.Drawer(this._drawerSplitView); 50 this._drawer = new WebInspector.Drawer(this._drawerSplitView);
51 this._panels = {};
51 52
52 // Patch tabbed pane header with toolbar actions. 53 // Patch tabbed pane header with toolbar actions.
53 this._toolbarElement = document.createElement("div"); 54 this._toolbarElement = document.createElement("div");
54 this._toolbarElement.className = "toolbar toolbar-background"; 55 this._toolbarElement.className = "toolbar toolbar-background";
55 var headerElement = this._tabbedPane.headerElement(); 56 var headerElement = this._tabbedPane.headerElement();
56 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement ); 57 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement );
57 58
58 this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar- controls-left"); 59 this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar- controls-left");
59 this._toolbarElement.appendChild(headerElement); 60 this._toolbarElement.appendChild(headerElement);
60 this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar -controls-right"); 61 this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar -controls-right");
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 { 123 {
123 var panelName = panelDescriptor.name(); 124 var panelName = panelDescriptor.name();
124 this._panelDescriptors[panelName] = panelDescriptor; 125 this._panelDescriptors[panelName] = panelDescriptor;
125 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn spector.View()); 126 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn spector.View());
126 if (this._lastActivePanelSetting.get() === panelName) 127 if (this._lastActivePanelSetting.get() === panelName)
127 this._tabbedPane.selectTab(panelName); 128 this._tabbedPane.selectTab(panelName);
128 }, 129 },
129 130
130 /** 131 /**
131 * @param {string} panelName 132 * @param {string} panelName
133 * @param {boolean=} skipFallback
132 * @return {?WebInspector.Panel} 134 * @return {?WebInspector.Panel}
133 */ 135 */
134 panel: function(panelName) 136 panel: function(panelName, skipFallback)
pfeldman 2014/05/06 19:57:14 Either change the naming scheme or make it pure ac
apavlov 2014/05/07 10:26:13 I don't know. AFAIU, the case behind the fallback
135 { 137 {
138 if (this._panels[panelName])
139 return this._panels[panelName];
136 var panelDescriptor = this._panelDescriptors[panelName]; 140 var panelDescriptor = this._panelDescriptors[panelName];
137 var panelOrder = this._tabbedPane.allTabs(); 141 var panelOrder = this._tabbedPane.allTabs();
138 if (!panelDescriptor && panelOrder.length) 142 if (!skipFallback && !panelDescriptor && panelOrder.length)
139 panelDescriptor = this._panelDescriptors[panelOrder[0]]; 143 panelDescriptor = this._panelDescriptors[panelOrder[0]];
140 return panelDescriptor ? panelDescriptor.panel() : null; 144 var panel = panelDescriptor ? panelDescriptor.panel() : null;
145 if (!this._panels[panelName])
146 this._panels[panelName] = panel;
147 return panel;
141 }, 148 },
142 149
143 /** 150 /**
144 * @param {string} panelName 151 * @param {string} panelName
145 * @return {?WebInspector.Panel} 152 * @return {?WebInspector.Panel}
146 */ 153 */
147 showPanel: function(panelName) 154 showPanel: function(panelName)
148 { 155 {
149 var panel = this.panel(panelName); 156 var panel = this.panel(panelName);
150 if (panel) 157 if (panel)
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 368
362 _moveInHistory: function(move) 369 _moveInHistory: function(move)
363 { 370 {
364 var newIndex = this._historyIterator + move; 371 var newIndex = this._historyIterator + move;
365 if (newIndex >= this._history.length || newIndex < 0) 372 if (newIndex >= this._history.length || newIndex < 0)
366 return false; 373 return false;
367 374
368 this._inHistory = true; 375 this._inHistory = true;
369 this._historyIterator = newIndex; 376 this._historyIterator = newIndex;
370 if (!WebInspector.Dialog.currentInstance()) 377 if (!WebInspector.Dialog.currentInstance())
371 this.setCurrentPanel(WebInspector.panels[this._history[this._history Iterator]]); 378 this.setCurrentPanel(this._panels[this._history[this._historyIterato r]]);
372 delete this._inHistory; 379 delete this._inHistory;
373 380
374 return true; 381 return true;
375 }, 382 },
376 383
377 _pushToHistory: function(panelName) 384 _pushToHistory: function(panelName)
378 { 385 {
379 if (this._inHistory) 386 if (this._inHistory)
380 return; 387 return;
381 388
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 window.addEventListener("scroll", this._onScrollBound, false); 512 window.addEventListener("scroll", this._onScrollBound, false);
506 else 513 else
507 window.removeEventListener("scroll", this._onScrollBound, false); 514 window.removeEventListener("scroll", this._onScrollBound, false);
508 515
509 WebInspector.VBox.prototype.doResize.call(this); 516 WebInspector.VBox.prototype.doResize.call(this);
510 this._onScroll(); 517 this._onScroll();
511 }, 518 },
512 519
513 __proto__: WebInspector.VBox.prototype 520 __proto__: WebInspector.VBox.prototype
514 }; 521 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698