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

Unified 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: Rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/ui/Context.js ('k') | Source/devtools/front_end/ui/Panel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/InspectorView.js
diff --git a/Source/devtools/front_end/ui/InspectorView.js b/Source/devtools/front_end/ui/InspectorView.js
index 8b44ae19b64869f0b2025a3ad286a8aad2a95b69..d9d5d1dadd49f2c4af1538d10a37b094a898ee50 100644
--- a/Source/devtools/front_end/ui/InspectorView.js
+++ b/Source/devtools/front_end/ui/InspectorView.js
@@ -69,6 +69,10 @@ WebInspector.InspectorView = function()
this.appendToRightToolbar(this._drawer.toggleButtonElement());
+ this._panels = {};
+ // Used by tests.
+ WebInspector["panels"] = this._panels;
+
this._history = [];
this._historyIterator = -1;
document.addEventListener("keydown", this._keyDown.bind(this), false);
@@ -129,6 +133,15 @@ WebInspector.InspectorView.prototype = {
/**
* @param {string} panelName
+ * @return {boolean}
+ */
+ hasPanel: function(panelName)
+ {
+ return !!this._panelDescriptors[panelName];
+ },
+
+ /**
+ * @param {string} panelName
* @return {?WebInspector.Panel}
*/
panel: function(panelName)
@@ -137,7 +150,10 @@ WebInspector.InspectorView.prototype = {
var panelOrder = this._tabbedPane.allTabs();
if (!panelDescriptor && panelOrder.length)
panelDescriptor = this._panelDescriptors[panelOrder[0]];
- return panelDescriptor ? panelDescriptor.panel() : null;
+ var panel = panelDescriptor ? panelDescriptor.panel() : null;
+ if (panel)
+ this._panels[panelName] = panel;
+ return panel;
},
/**
@@ -199,6 +215,7 @@ WebInspector.InspectorView.prototype = {
if (!panelName)
return;
var panel = this._panelDescriptors[this._tabbedPane.selectedTabId].panel();
+ this._panels[panelName] = panel;
this._tabbedPane.changeTabView(panelName, panel);
this._currentPanel = panel;
@@ -368,7 +385,7 @@ WebInspector.InspectorView.prototype = {
this._inHistory = true;
this._historyIterator = newIndex;
if (!WebInspector.Dialog.currentInstance())
- this.setCurrentPanel(WebInspector.panels[this._history[this._historyIterator]]);
+ this.setCurrentPanel(this._panels[this._history[this._historyIterator]]);
delete this._inHistory;
return true;
« no previous file with comments | « Source/devtools/front_end/ui/Context.js ('k') | Source/devtools/front_end/ui/Panel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698