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

Unified Diff: Source/devtools/front_end/main/App.js

Issue 342163002: DevTools: move emulation button into the base App.js. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaselined Created 6 years, 6 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/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;

Powered by Google App Engine
This is Rietveld 408576698