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..65bdd06d23041b1b18b1c850dc157f304007ca6b 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.ResponsiveDesignButtonProvider = function() |
dgozman
2014/06/19 14:42:32
EmulationButtonProvider
pfeldman
2014/06/19 14:51:25
Done!
|
+{ |
+} |
+ |
+WebInspector.App.ResponsiveDesignButtonProvider.prototype = { |
+ /** |
+ * @return {?WebInspector.StatusBarButton} |
+ */ |
+ button: function() |
+ { |
+ if (!(WebInspector.app instanceof WebInspector.App)) |
+ return null; |
+ return /** @type {!WebInspector.App} */ (WebInspector.app)._toggleEmulationButton || null; |
dgozman
2014/06/19 14:42:32
No need to cast.
pfeldman
2014/06/19 14:51:25
Done.
|
+ } |
+} |
+ |
+/** |
* @type {!WebInspector.App} |
*/ |
WebInspector.app; |