Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Emulation.DeviceModeWrapper = class extends UI.VBox { | 7 Emulation.DeviceModeWrapper = class extends UI.VBox { |
| 8 /** | 8 /** |
| 9 * @param {!Emulation.InspectedPagePlaceholder} inspectedPagePlaceholder | 9 * @param {!Emulation.InspectedPagePlaceholder} inspectedPagePlaceholder |
| 10 */ | 10 */ |
| 11 constructor(inspectedPagePlaceholder) { | 11 constructor(inspectedPagePlaceholder) { |
| 12 super(); | 12 super(); |
| 13 Emulation.DeviceModeView._wrapperInstance = this; | 13 Emulation.DeviceModeView._wrapperInstance = this; |
| 14 this._inspectedPagePlaceholder = inspectedPagePlaceholder; | 14 this._inspectedPagePlaceholder = inspectedPagePlaceholder; |
| 15 /** @type {?Emulation.DeviceModeView} */ | 15 /** @type {?Emulation.DeviceModeView} */ |
| 16 this._deviceModeView = null; | 16 this._deviceModeView = null; |
| 17 this._toggleDeviceModeAction = UI.actionRegistry.action('emulation.toggle-de vice-mode'); | 17 this._toggleDeviceModeAction = UI.actionRegistry.action('emulation.toggle-de vice-mode'); |
| 18 this._showDeviceModeSetting = Common.settings.createSetting('emulation.showD eviceMode', false); | 18 this._showDeviceModeSetting = Common.settings.createSetting('emulation.showD eviceMode', false); |
| 19 this._showDeviceModeSetting.addChangeListener(this._update.bind(this, false) ); | 19 this._showDeviceModeSetting.addChangeListener(this._update.bind(this, false) ); |
| 20 this._update(true); | 20 this._update(true); |
| 21 } | 21 } |
| 22 | 22 |
| 23 _toggleDeviceMode() { | 23 _toggleDeviceMode() { |
| 24 this._showDeviceModeSetting.set(!this._showDeviceModeSetting.get()); | 24 this._showDeviceModeSetting.set(!this._showDeviceModeSetting.get()); |
| 25 if (this._showDeviceModeSetting.get()) | |
| 26 Host.userMetrics.actionTaken(Host.UserMetrics.Action.DeviceModeToggleOn); | |
|
pfeldman
2017/02/07 19:15:27
Wait, we had that, where did it go?
| |
| 27 else | |
| 28 Host.userMetrics.actionTaken(Host.UserMetrics.Action.DeviceModeToggleOff); | |
| 25 } | 29 } |
| 26 | 30 |
| 27 /** | 31 /** |
| 28 * @return {boolean} | 32 * @return {boolean} |
| 29 */ | 33 */ |
| 30 _captureScreenshot() { | 34 _captureScreenshot() { |
| 31 if (!this._deviceModeView) | 35 if (!this._deviceModeView) |
| 32 return false; | 36 return false; |
| 33 this._deviceModeView.captureScreenshot(); | 37 this._deviceModeView.captureScreenshot(); |
| 34 return true; | 38 return true; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 if (actionId === 'emulation.toggle-device-mode') { | 83 if (actionId === 'emulation.toggle-device-mode') { |
| 80 Emulation.DeviceModeView._wrapperInstance._toggleDeviceMode(); | 84 Emulation.DeviceModeView._wrapperInstance._toggleDeviceMode(); |
| 81 return true; | 85 return true; |
| 82 } | 86 } |
| 83 if (actionId === 'emulation.capture-screenshot') | 87 if (actionId === 'emulation.capture-screenshot') |
| 84 return Emulation.DeviceModeView._wrapperInstance._captureScreenshot(); | 88 return Emulation.DeviceModeView._wrapperInstance._captureScreenshot(); |
| 85 } | 89 } |
| 86 return false; | 90 return false; |
| 87 } | 91 } |
| 88 }; | 92 }; |
| OLD | NEW |