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

Unified Diff: Source/devtools/front_end/elements/ElementsPanel.js

Issue 667623002: DevTools: make extension server a part of core, panels' code should depend on it. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: for review Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/elements/ElementsPanel.js
diff --git a/Source/devtools/front_end/elements/ElementsPanel.js b/Source/devtools/front_end/elements/ElementsPanel.js
index 22af3ab2a06188c1a584e4bd46e4662d3484da01..6ffbd155bca8727fcc229583569c1f801c89d252 100644
--- a/Source/devtools/front_end/elements/ElementsPanel.js
+++ b/Source/devtools/front_end/elements/ElementsPanel.js
@@ -38,7 +38,6 @@ WebInspector.ElementsPanel = function()
{
WebInspector.Panel.call(this, "elements");
this.registerRequiredCSS("elementsPanel.css");
- this.setHideOnDetach();
this._splitView = new WebInspector.SplitView(true, true, "elementsPanelSplitViewState", 325, 325);
this._splitView.addEventListener(WebInspector.SplitView.Events.SidebarSizeChanged, this._updateTreeOutlineVisibleWidth.bind(this));
@@ -92,7 +91,6 @@ WebInspector.ElementsPanel = function()
this.sidebarPanes.styles.addEventListener("style edited", this._stylesPaneEdited, this);
this.sidebarPanes.styles.addEventListener("style property toggled", this._stylesPaneEdited, this);
this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPaneEdited, this);
- this._extensionSidebarPanes = [];
WebInspector.dockController.addEventListener(WebInspector.DockController.Events.DockSideChanged, this._dockSideChanged.bind(this));
WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(this._dockSideChanged.bind(this));
@@ -109,6 +107,7 @@ WebInspector.ElementsPanel = function()
WebInspector.settings.showUAShadowDOM.addChangeListener(this._showUAShadowDOMChanged.bind(this));
WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this);
WebInspector.targetManager.addModelListener(WebInspector.CSSStyleModel, WebInspector.CSSStyleModel.Events.ModelWasEnabled, this._updateSidebars, this);
+ WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.Events.SidebarPaneAdded, this._extensionSidebarPaneAdded, this);
}
WebInspector.ElementsPanel.prototype = {
@@ -1431,21 +1430,32 @@ WebInspector.ElementsPanel.prototype = {
this.sidebarPaneView.addPane(this.sidebarPanes.animations);
this._extensionSidebarPanesContainer = this.sidebarPaneView;
- for (var i = 0; i < this._extensionSidebarPanes.length; ++i)
- this._extensionSidebarPanesContainer.addPane(this._extensionSidebarPanes[i]);
+ var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes();
+ for (var i = 0; i < extensionSidebarPanes.length; ++i)
+ this._addExtensionSidebarPane(extensionSidebarPanes[i]);
this.sidebarPaneView.show(this._splitView.sidebarElement());
this.sidebarPanes.styles.expand();
},
/**
- * @param {string} id
- * @param {!WebInspector.SidebarPane} pane
+ * @param {!WebInspector.Event} event
*/
- addExtensionSidebarPane: function(id, pane)
+ _extensionSidebarPaneAdded: function(event)
{
- this._extensionSidebarPanes.push(pane);
- this._extensionSidebarPanesContainer.addPane(pane);
+ var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data);
+ this._addExtensionSidebarPane(pane);
+ },
+
+ /**
+ * @param {!WebInspector.ExtensionSidebarPane} pane
+ */
+ _addExtensionSidebarPane: function(pane)
+ {
+ if (pane.panelName() === this.name) {
+ this.setHideOnDetach();
+ this._extensionSidebarPanesContainer.addPane(pane);
+ }
},
__proto__: WebInspector.Panel.prototype

Powered by Google App Engine
This is Rietveld 408576698