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

Unified Diff: Source/devtools/front_end/components/InspectorView.js

Issue 408853002: [DevTools] Make toolbar counters declarative. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed comment Created 6 years, 5 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/components/InspectorView.js
diff --git a/Source/devtools/front_end/components/InspectorView.js b/Source/devtools/front_end/components/InspectorView.js
index 737b83db93e13bcce879d1433e9f91fb49ea4b64..10bb691f874b9295088eeae5d47651a38760ee5e 100644
--- a/Source/devtools/front_end/components/InspectorView.js
+++ b/Source/devtools/front_end/components/InspectorView.js
@@ -61,24 +61,11 @@ WebInspector.InspectorView = function()
this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar-controls-right");
this._toolbarItems = [];
- if (WebInspector.experimentsSettings.devicesPanel.isEnabled()) {
- this._remoteDeviceCountElement = this._rightToolbarElement.createChild("div", "hidden");
- this._remoteDeviceCountElement.addEventListener("click", this.showViewInDrawer.bind(this, "devices", true), false);
- this._remoteDeviceCountElement.id = "remote-device-count";
- InspectorFrontendHost.setDeviceCountUpdatesEnabled(true);
- InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.DeviceCountUpdated, this._onDeviceCountUpdated, this);
- }
-
- this._errorWarningCountElement = this._rightToolbarElement.createChild("div", "hidden");
- this._errorWarningCountElement.id = "error-warning-count";
-
this._closeButtonToolbarItem = document.createElementWithClass("div", "toolbar-close-button-item");
var closeButtonElement = this._closeButtonToolbarItem.createChild("div", "close-button");
closeButtonElement.addEventListener("click", InspectorFrontendHost.closeWindow.bind(InspectorFrontendHost), true);
this._rightToolbarElement.appendChild(this._closeButtonToolbarItem);
- this.appendToRightToolbar(this._drawer.toggleButton());
-
this._panels = {};
// Used by tests.
WebInspector["panels"] = this._panels;
@@ -99,10 +86,6 @@ WebInspector.InspectorView = function()
InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ShowConsole, this.showPanel.bind(this, "console"));
};
-WebInspector.InspectorView.Events = {
- DeviceCountChanged: "DeviceCountChanged"
-}
-
WebInspector.InspectorView.prototype = {
_loadPanelDesciptors: function()
{
@@ -452,53 +435,8 @@ WebInspector.InspectorView.prototype = {
return this._tabbedPane.headerElement();
},
- _createImagedCounterElementIfNeeded: function(parent, count, id, styleName)
+ toolbarItemResized: function()
{
- if (!count)
- return;
-
- var imageElement = parent.createChild("div", styleName);
- var counterElement = parent.createChild("span");
- counterElement.id = id;
- counterElement.textContent = count;
- },
-
- /**
- * @param {number} errors
- * @param {number} warnings
- */
- setErrorAndWarningCounts: function(errors, warnings)
- {
- if (this._errors === errors && this._warnings === warnings)
- return;
- this._errors = errors;
- this._warnings = warnings;
- this._errorWarningCountElement.classList.toggle("hidden", !errors && !warnings);
- this._errorWarningCountElement.removeChildren();
-
- this._createImagedCounterElementIfNeeded(this._errorWarningCountElement, errors, "error-count", "error-icon-small");
- this._createImagedCounterElementIfNeeded(this._errorWarningCountElement, warnings, "warning-count", "warning-icon-small");
-
- var errorString = errors ? WebInspector.UIString("%d error%s", errors, errors > 1 ? "s" : "") : "";
- var warningString = warnings ? WebInspector.UIString("%d warning%s", warnings, warnings > 1 ? "s" : "") : "";
- var commaString = errors && warnings ? ", " : "";
- this._errorWarningCountElement.title = errorString + commaString + warningString;
- this._tabbedPane.headerResized();
- },
-
- /**
- * @param {!WebInspector.Event} event
- */
- _onDeviceCountUpdated: function(event)
- {
- var count = /** @type {number} */ (event.data);
- if (count === this.deviceCount_)
- return;
- this.deviceCount_ = count;
- this._remoteDeviceCountElement.classList.toggle("hidden", !count);
- this._remoteDeviceCountElement.removeChildren();
- this._createImagedCounterElementIfNeeded(this._remoteDeviceCountElement, count, "device-count", "device-icon-small");
- this._remoteDeviceCountElement.title = WebInspector.UIString(((count > 1) ? "%d devices found" : "%d device found"), count);
this._tabbedPane.headerResized();
},
@@ -535,6 +473,24 @@ WebInspector.InspectorView.DrawerToggleActionDelegate.prototype = {
/**
* @constructor
+ * @implements {WebInspector.StatusBarItem.Provider}
+ */
+WebInspector.InspectorView.ToggleDrawerButtonProvider = function()
+{
+}
+
+WebInspector.InspectorView.ToggleDrawerButtonProvider.prototype = {
+ /**
+ * @return {?WebInspector.StatusBarItem}
+ */
+ item: function()
+ {
+ return WebInspector.inspectorView._drawer.toggleButton();
+ }
+}
+
+/**
+ * @constructor
* @extends {WebInspector.VBox}
*/
WebInspector.RootView = function()
« no previous file with comments | « Source/devtools/front_end/components/InspectElementModeController.js ('k') | Source/devtools/front_end/inspectorStyle.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698