OLD | NEW |
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.EmulationButtonProvider = function() |
| 50 { |
| 51 } |
| 52 |
| 53 WebInspector.App.EmulationButtonProvider.prototype = { |
| 54 /** |
| 55 * @return {?WebInspector.StatusBarButton} |
| 56 */ |
| 57 button: function() |
| 58 { |
| 59 if (!(WebInspector.app instanceof WebInspector.App)) |
| 60 return null; |
| 61 return WebInspector.app._toggleEmulationButton || null; |
| 62 } |
| 63 } |
| 64 |
| 65 /** |
28 * @type {!WebInspector.App} | 66 * @type {!WebInspector.App} |
29 */ | 67 */ |
30 WebInspector.app; | 68 WebInspector.app; |
OLD | NEW |