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

Unified Diff: Source/devtools/front_end/extensions/ExtensionPanel.js

Issue 720223002: DevTools: only allow status bar items in status bars. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined Created 6 years, 1 month 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/extensions/ExtensionPanel.js
diff --git a/Source/devtools/front_end/extensions/ExtensionPanel.js b/Source/devtools/front_end/extensions/ExtensionPanel.js
index 727f8b3ed88259119915c87a2f83c1fe55a46143..127d11d3762954803a7b9b801c860b35e98dce32 100644
--- a/Source/devtools/front_end/extensions/ExtensionPanel.js
+++ b/Source/devtools/front_end/extensions/ExtensionPanel.js
@@ -42,7 +42,8 @@ WebInspector.ExtensionPanel = function(server, id, pageURL)
this._server = server;
this.setHideOnDetach();
this.element.classList.add("extension-panel");
- this._panelStatusBarElement = this.element.createChild("div", "panel-status-bar hidden");
+ this._panelStatusBar = new WebInspector.StatusBar(this.element);
+ this._panelStatusBar.element.classList.add("hidden");
this._searchableView = new WebInspector.SearchableView(this);
this._searchableView.show(this.element);
@@ -62,12 +63,12 @@ WebInspector.ExtensionPanel.prototype = {
},
/**
- * @param {!Element} element
+ * @param {!WebInspector.StatusBarItem} item
*/
- addStatusBarItem: function(element)
+ addStatusBarItem: function(item)
{
- this._panelStatusBarElement.classList.remove("hidden");
- this._panelStatusBarElement.appendChild(element);
+ this._panelStatusBar.element.classList.remove("hidden");
+ this._panelStatusBar.appendStatusBarItem(item);
},
searchCanceled: function()
@@ -135,9 +136,9 @@ WebInspector.ExtensionPanel.prototype = {
WebInspector.ExtensionButton = function(server, id, iconURL, tooltip, disabled)
{
this._id = id;
- this.element = createElement("button");
- this.element.className = "status-bar-item extension";
- this.element.addEventListener("click", server.notifyButtonClicked.bind(server, this._id), false);
+
+ this._statusBarButton = new WebInspector.StatusBarButton("", "extension");
+ this._statusBarButton.addEventListener("click", server.notifyButtonClicked.bind(server, this._id));
this.update(iconURL, tooltip, disabled);
}
@@ -150,11 +151,19 @@ WebInspector.ExtensionButton.prototype = {
update: function(iconURL, tooltip, disabled)
{
if (typeof iconURL === "string")
- this.element.style.backgroundImage = "url(" + iconURL + ")";
+ this._statusBarButton.setBackgroundImage(iconURL);
if (typeof tooltip === "string")
- this.element.title = tooltip;
+ this._statusBarButton.setTitle(tooltip);
if (typeof disabled === "boolean")
- this.element.disabled = disabled;
+ this._statusBarButton.setEnabled(!disabled);
+ },
+
+ /**
+ * @return {!WebInspector.StatusBarButton}
+ */
+ statusBarButton: function()
+ {
+ return this._statusBarButton;
}
}
« no previous file with comments | « LayoutTests/inspector/extensions/extensions-panel.html ('k') | Source/devtools/front_end/extensions/ExtensionServer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698