Index: Source/devtools/front_end/main/App.js |
diff --git a/Source/devtools/front_end/main/App.js b/Source/devtools/front_end/main/App.js |
index c8f7937a27b1606744f828d6062e06abde4e4bcd..e52b27ef3ad397f3d9a42872ebecdb8120c35e85 100644 |
--- a/Source/devtools/front_end/main/App.js |
+++ b/Source/devtools/front_end/main/App.js |
@@ -7,9 +7,27 @@ |
*/ |
WebInspector.App = function() |
{ |
+ if (WebInspector.overridesSupport.canEmulate()) { |
+ this._toggleEmulationButton = new WebInspector.StatusBarButton(WebInspector.UIString("Toggle emulation enabled."), "emulation-status-bar-item"); |
+ this._toggleEmulationButton.toggled = WebInspector.overridesSupport.emulationEnabled(); |
+ this._toggleEmulationButton.addEventListener("click", this._toggleEmulationEnabled, this); |
+ WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport.Events.EmulationStateChanged, this._emulationEnabledChanged, this); |
+ } |
}; |
WebInspector.App.prototype = { |
+ _toggleEmulationEnabled: function() |
+ { |
+ WebInspector.overridesSupport.setEmulationEnabled(!this._toggleEmulationButton.toggled); |
+ }, |
+ |
+ _emulationEnabledChanged: function() |
+ { |
+ this._toggleEmulationButton.toggled = WebInspector.overridesSupport.emulationEnabled(); |
+ if (!WebInspector.overridesSupport.responsiveDesignAvailable() && WebInspector.overridesSupport.emulationEnabled()) |
+ WebInspector.inspectorView.showViewInDrawer("emulation", true); |
+ }, |
+ |
createRootView: function() |
{ |
}, |
@@ -19,12 +37,32 @@ WebInspector.App.prototype = { |
WebInspector.inspectorView.showInitialPanel(); |
WebInspector.overridesSupport.applyInitialOverrides(); |
- if (WebInspector.overridesSupport.hasActiveOverrides() && !WebInspector.experimentsSettings.responsiveDesign.isEnabled()) |
+ if (!WebInspector.overridesSupport.responsiveDesignAvailable() && WebInspector.overridesSupport.emulationEnabled()) |
WebInspector.inspectorView.showViewInDrawer("emulation", true); |
} |
}; |
/** |
+ * @constructor |
+ * @implements {WebInspector.StatusBarButton.Provider} |
+ */ |
+WebInspector.App.EmulationButtonProvider = function() |
+{ |
+} |
+ |
+WebInspector.App.EmulationButtonProvider.prototype = { |
+ /** |
+ * @return {?WebInspector.StatusBarButton} |
+ */ |
+ button: function() |
+ { |
+ if (!(WebInspector.app instanceof WebInspector.App)) |
+ return null; |
+ return WebInspector.app._toggleEmulationButton || null; |
+ } |
+} |
+ |
+/** |
* @type {!WebInspector.App} |
*/ |
WebInspector.app; |