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

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

Issue 416983006: Revert 178848 "[DevTools] Make toolbar counters declarative." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: 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: trunk/Source/devtools/front_end/components/InspectorView.js
===================================================================
--- trunk/Source/devtools/front_end/components/InspectorView.js (revision 178910)
+++ trunk/Source/devtools/front_end/components/InspectorView.js (working copy)
@@ -61,11 +61,24 @@
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;
@@ -86,6 +99,10 @@
InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ShowConsole, this.showPanel.bind(this, "console"));
};
+WebInspector.InspectorView.Events = {
+ DeviceCountChanged: "DeviceCountChanged"
+}
+
WebInspector.InspectorView.prototype = {
_loadPanelDesciptors: function()
{
@@ -435,11 +452,56 @@
return this._tabbedPane.headerElement();
},
- toolbarItemResized: function()
+ _createImagedCounterElementIfNeeded: function(parent, count, id, styleName)
{
+ 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();
+ },
+
__proto__: WebInspector.VBox.prototype
};
@@ -473,24 +535,6 @@
/**
* @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()

Powered by Google App Engine
This is Rietveld 408576698