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

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: Review comments addressed. 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
« no previous file with comments | « Source/devtools/front_end/main/AdvancedApp.js ('k') | Source/devtools/front_end/main/module.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/devtools/front_end/main/AdvancedApp.js ('k') | Source/devtools/front_end/main/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698