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

Side by Side 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 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 */ 7 */
8 WebInspector.App = function() 8 WebInspector.App = function()
9 { 9 {
10 if (WebInspector.overridesSupport.canEmulate()) {
11 this._toggleEmulationButton = new WebInspector.StatusBarButton(WebInspec tor.UIString("Toggle emulation enabled."), "emulation-status-bar-item");
12 this._toggleEmulationButton.toggled = WebInspector.overridesSupport.emul ationEnabled();
13 this._toggleEmulationButton.addEventListener("click", this._toggleEmulat ionEnabled, this);
14 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSup port.Events.EmulationStateChanged, this._emulationEnabledChanged, this);
15 }
10 }; 16 };
11 17
12 WebInspector.App.prototype = { 18 WebInspector.App.prototype = {
19 _toggleEmulationEnabled: function()
20 {
21 WebInspector.overridesSupport.setEmulationEnabled(!this._toggleEmulation Button.toggled);
22 },
23
24 _emulationEnabledChanged: function()
25 {
26 this._toggleEmulationButton.toggled = WebInspector.overridesSupport.emul ationEnabled();
27 if (!WebInspector.overridesSupport.responsiveDesignAvailable() && WebIns pector.overridesSupport.emulationEnabled())
28 WebInspector.inspectorView.showViewInDrawer("emulation", true);
29 },
30
13 createRootView: function() 31 createRootView: function()
14 { 32 {
15 }, 33 },
16 34
17 presentUI: function() 35 presentUI: function()
18 { 36 {
19 WebInspector.inspectorView.showInitialPanel(); 37 WebInspector.inspectorView.showInitialPanel();
20 38
21 WebInspector.overridesSupport.applyInitialOverrides(); 39 WebInspector.overridesSupport.applyInitialOverrides();
22 if (WebInspector.overridesSupport.hasActiveOverrides() && !WebInspector. experimentsSettings.responsiveDesign.isEnabled()) 40 if (!WebInspector.overridesSupport.responsiveDesignAvailable() && WebIns pector.overridesSupport.emulationEnabled())
23 WebInspector.inspectorView.showViewInDrawer("emulation", true); 41 WebInspector.inspectorView.showViewInDrawer("emulation", true);
24 } 42 }
25 }; 43 };
26 44
27 /** 45 /**
46 * @constructor
47 * @implements {WebInspector.StatusBarButton.Provider}
48 */
49 WebInspector.App.ResponsiveDesignButtonProvider = function()
dgozman 2014/06/19 14:42:32 EmulationButtonProvider
pfeldman 2014/06/19 14:51:25 Done!
50 {
51 }
52
53 WebInspector.App.ResponsiveDesignButtonProvider.prototype = {
54 /**
55 * @return {?WebInspector.StatusBarButton}
56 */
57 button: function()
58 {
59 if (!(WebInspector.app instanceof WebInspector.App))
60 return null;
61 return /** @type {!WebInspector.App} */ (WebInspector.app)._toggleEmulat ionButton || null;
dgozman 2014/06/19 14:42:32 No need to cast.
pfeldman 2014/06/19 14:51:25 Done.
62 }
63 }
64
65 /**
28 * @type {!WebInspector.App} 66 * @type {!WebInspector.App}
29 */ 67 */
30 WebInspector.app; 68 WebInspector.app;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698