| 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 * @extends {WebInspector.App} | 7 * @extends {WebInspector.App} |
| 8 */ | 8 */ |
| 9 WebInspector.AdvancedApp = function() | 9 WebInspector.AdvancedApp = function() |
| 10 { | 10 { |
| 11 WebInspector.App.call(this); | 11 WebInspector.App.call(this); |
| 12 if (WebInspector.overridesSupport.responsiveDesignAvailable()) { | 12 if (WebInspector.overridesSupport.responsiveDesignAvailable()) { |
| 13 this._toggleEmulationButton = new WebInspector.StatusBarButton(WebInspec
tor.UIString("Toggle device mode."), "emulation-status-bar-item"); | 13 this._toggleEmulationButton = new WebInspector.StatusBarButton(WebInspec
tor.UIString("Toggle device mode."), "emulation-status-bar-item"); |
| 14 this._toggleEmulationButton.toggled = WebInspector.overridesSupport.emul
ationEnabled(); | 14 this._toggleEmulationButton.toggled = WebInspector.overridesSupport.emul
ationEnabled(); |
| 15 this._toggleEmulationButton.addEventListener("click", this._toggleEmulat
ionEnabled, this); | 15 this._toggleEmulationButton.addEventListener("click", this._toggleEmulat
ionEnabled, this); |
| 16 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSup
port.Events.EmulationStateChanged, this._emulationEnabledChanged, this); | 16 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSup
port.Events.EmulationStateChanged, this._emulationEnabledChanged, this); |
| 17 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSup
port.Events.OverridesWarningUpdated, this._overridesWarningUpdated, this); | 17 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSup
port.Events.OverridesWarningUpdated, this._overridesWarningUpdated, this); |
| 18 } | 18 } |
| 19 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.BeforeDockSideChanged, this._openToolboxWindow, this); | 19 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.BeforeDockSideChanged, this._openToolboxWindow, this); |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 WebInspector.AdvancedApp.prototype = { | 22 WebInspector.AdvancedApp.prototype = { |
| 23 _toggleEmulationEnabled: function() | 23 _toggleEmulationEnabled: function() |
| 24 { | 24 { |
| 25 WebInspector.overridesSupport.setEmulationEnabled(!this._toggleEmulation
Button.toggled); | 25 var enabled = !this._toggleEmulationButton.toggled; |
| 26 if (enabled) |
| 27 WebInspector.userMetrics.DeviceModeEnabled.record(); |
| 28 WebInspector.overridesSupport.setEmulationEnabled(enabled); |
| 26 }, | 29 }, |
| 27 | 30 |
| 28 _emulationEnabledChanged: function() | 31 _emulationEnabledChanged: function() |
| 29 { | 32 { |
| 30 this._toggleEmulationButton.toggled = WebInspector.overridesSupport.emul
ationEnabled(); | 33 this._toggleEmulationButton.toggled = WebInspector.overridesSupport.emul
ationEnabled(); |
| 31 if (!WebInspector.overridesSupport.responsiveDesignAvailable() && WebIns
pector.overridesSupport.emulationEnabled()) | 34 if (!WebInspector.overridesSupport.responsiveDesignAvailable() && WebIns
pector.overridesSupport.emulationEnabled()) |
| 32 WebInspector.inspectorView.showViewInDrawer("emulation", true); | 35 WebInspector.inspectorView.showViewInDrawer("emulation", true); |
| 33 }, | 36 }, |
| 34 | 37 |
| 35 _overridesWarningUpdated: function() | 38 _overridesWarningUpdated: function() |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 handleAction: function() | 308 handleAction: function() |
| 306 { | 309 { |
| 307 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) | 310 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) |
| 308 return false; | 311 return false; |
| 309 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) | 312 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) |
| 310 return false; | 313 return false; |
| 311 WebInspector.app._toggleEmulationEnabled(); | 314 WebInspector.app._toggleEmulationEnabled(); |
| 312 return true; | 315 return true; |
| 313 } | 316 } |
| 314 } | 317 } |
| OLD | NEW |