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

Side by Side Diff: Source/devtools/front_end/main/AdvancedApp.js

Issue 1163293003: [DevTools] Remove WI.OverridesSupport.responsiveDesignAvailable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplified Created 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.App} 7 * @implements {WebInspector.App}
8 */ 8 */
9 WebInspector.AdvancedApp = function() 9 WebInspector.AdvancedApp = function()
10 { 10 {
11 if (WebInspector.overridesSupport.responsiveDesignAvailable()) { 11 this._toggleEmulationButton = new WebInspector.ToolbarButton(WebInspector.UI String("Toggle device mode"), "emulation-toolbar-item");
12 this._toggleEmulationButton = new WebInspector.ToolbarButton(WebInspecto r.UIString("Toggle device mode"), "emulation-toolbar-item"); 12 this._toggleEmulationButton.setToggled(WebInspector.overridesSupport.emulati onEnabled());
13 this._toggleEmulationButton.setToggled(WebInspector.overridesSupport.emu lationEnabled()); 13 this._toggleEmulationButton.addEventListener("click", this._toggleEmulationE nabled, this);
14 this._toggleEmulationButton.addEventListener("click", this._toggleEmulat ionEnabled, this); 14 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport .Events.EmulationStateChanged, this._emulationEnabledChanged, this);
15 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSup port.Events.EmulationStateChanged, this._emulationEnabledChanged, this); 15 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport .Events.OverridesWarningUpdated, this._overridesWarningUpdated, this);
16 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSup port.Events.OverridesWarningUpdated, this._overridesWarningUpdated, this);
17 }
18 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.BeforeDockSideChanged, this._openToolboxWindow, this); 16 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.BeforeDockSideChanged, this._openToolboxWindow, this);
19 }; 17 };
20 18
21 WebInspector.AdvancedApp.prototype = { 19 WebInspector.AdvancedApp.prototype = {
22 _toggleEmulationEnabled: function() 20 _toggleEmulationEnabled: function()
23 { 21 {
24 var enabled = !this._toggleEmulationButton.toggled(); 22 var enabled = !this._toggleEmulationButton.toggled();
25 WebInspector.overridesSupport.setEmulationEnabled(enabled); 23 WebInspector.overridesSupport.setEmulationEnabled(enabled);
26 }, 24 },
27 25
28 _emulationEnabledChanged: function() 26 _emulationEnabledChanged: function()
29 { 27 {
30 this._toggleEmulationButton.setToggled(WebInspector.overridesSupport.emu lationEnabled()); 28 this._toggleEmulationButton.setToggled(WebInspector.overridesSupport.emu lationEnabled());
31 if (!WebInspector.overridesSupport.responsiveDesignAvailable() && WebIns pector.overridesSupport.emulationEnabled())
32 WebInspector.inspectorView.showViewInDrawer("emulation", true);
33 }, 29 },
34 30
35 _overridesWarningUpdated: function() 31 _overridesWarningUpdated: function()
36 { 32 {
37 if (!this._toggleEmulationButton) 33 if (!this._toggleEmulationButton)
38 return; 34 return;
39 var message = WebInspector.overridesSupport.warningMessage(); 35 var message = WebInspector.overridesSupport.warningMessage();
40 this._toggleEmulationButton.setTitle(message || WebInspector.UIString("T oggle device mode")); 36 this._toggleEmulationButton.setTitle(message || WebInspector.UIString("T oggle device mode"));
41 this._toggleEmulationButton.element.classList.toggle("warning", !!messag e); 37 this._toggleEmulationButton.element.classList.toggle("warning", !!messag e);
42 }, 38 },
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 266 }
271 267
272 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate.prototype = { 268 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate.prototype = {
273 /** 269 /**
274 * @override 270 * @override
275 * @param {!WebInspector.Context} context 271 * @param {!WebInspector.Context} context
276 * @param {string} actionId 272 * @param {string} actionId
277 */ 273 */
278 handleAction: function(context, actionId) 274 handleAction: function(context, actionId)
279 { 275 {
280 if (WebInspector.overridesSupport.responsiveDesignAvailable()) 276 WebInspector.AdvancedApp._instance()._toggleEmulationEnabled();
281 WebInspector.AdvancedApp._instance()._toggleEmulationEnabled();
282 } 277 }
283 } 278 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/emulation/OverridesView.js ('k') | Source/devtools/front_end/main/Main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698