Index: Source/devtools/front_end/main/AdvancedApp.js |
diff --git a/Source/devtools/front_end/main/AdvancedApp.js b/Source/devtools/front_end/main/AdvancedApp.js |
index 1190f6cdc4a4dfcb943282402784d0f93771c93c..4ac6740e572ec73a60d33d8ebbce7079933b678f 100644 |
--- a/Source/devtools/front_end/main/AdvancedApp.js |
+++ b/Source/devtools/front_end/main/AdvancedApp.js |
@@ -200,6 +200,49 @@ WebInspector.AdvancedApp.prototype = { |
/** |
* @constructor |
+ * @implements {WebInspector.StatusBarItem.Provider} |
+ */ |
+WebInspector.AdvancedApp.DeviceCounter = function() |
+{ |
+ if (!WebInspector.experimentsSettings.devicesPanel.isEnabled() || !(WebInspector.app instanceof WebInspector.AdvancedApp)) { |
+ this._counter = null; |
+ return; |
+ } |
+ |
+ this._counter = new WebInspector.StatusBarCounter(["device-icon-small"]); |
+ this._counter.addEventListener("click", showDevices); |
+ |
+ function showDevices() |
+ { |
+ WebInspector.inspectorView.showViewInDrawer("devices", true); |
+ } |
+ |
+ InspectorFrontendHost.setDeviceCountUpdatesEnabled(true); |
+ InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.DeviceCountUpdated, this._onDeviceCountUpdated, this); |
+} |
+ |
+WebInspector.AdvancedApp.DeviceCounter.prototype = { |
+ /** |
+ * @param {!WebInspector.Event} event |
+ */ |
+ _onDeviceCountUpdated: function(event) |
+ { |
+ var count = /** @type {number} */ (event.data); |
+ this._counter.setCounter("device-icon-small", count, WebInspector.UIString(count > 1 ? "%d devices found" : "%d device found", count)); |
+ WebInspector.inspectorView.toolbarItemResized(); |
+ }, |
+ |
+ /** |
+ * @return {?WebInspector.StatusBarItem} |
+ */ |
+ item: function() |
+ { |
+ return this._counter; |
+ } |
+} |
+ |
+/** |
+ * @constructor |
*/ |
WebInspector.Toolbox = function() |
{ |
@@ -228,7 +271,7 @@ WebInspector.Toolbox = function() |
/** |
* @constructor |
- * @implements {WebInspector.StatusBarButton.Provider} |
+ * @implements {WebInspector.StatusBarItem.Provider} |
*/ |
WebInspector.AdvancedApp.EmulationButtonProvider = function() |
{ |
@@ -236,9 +279,9 @@ WebInspector.AdvancedApp.EmulationButtonProvider = function() |
WebInspector.AdvancedApp.EmulationButtonProvider.prototype = { |
/** |
- * @return {?WebInspector.StatusBarButton} |
+ * @return {?WebInspector.StatusBarItem} |
*/ |
- button: function() |
+ item: function() |
{ |
if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) |
return null; |