| 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 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * @return {boolean} | 28 * @return {boolean} |
| 29 */ | 29 */ |
| 30 _captureScreenshot() { | 30 _captureScreenshot() { |
| 31 if (!this._deviceModeView) | 31 if (!this._deviceModeView) |
| 32 return false; | 32 return false; |
| 33 this._deviceModeView.captureScreenshot(); | 33 this._deviceModeView.captureScreenshot(); |
| 34 return true; | 34 return true; |
| 35 } | 35 } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * @return {boolean} |
| 39 */ |
| 40 _captureFullSizeScreenshot() { |
| 41 if (!this._deviceModeView) |
| 42 return false; |
| 43 this._deviceModeView.captureFullSizeScreenshot(); |
| 44 return true; |
| 45 } |
| 46 |
| 47 /** |
| 38 * @param {boolean} force | 48 * @param {boolean} force |
| 39 */ | 49 */ |
| 40 _update(force) { | 50 _update(force) { |
| 41 this._toggleDeviceModeAction.setToggled(this._showDeviceModeSetting.get()); | 51 this._toggleDeviceModeAction.setToggled(this._showDeviceModeSetting.get()); |
| 42 if (!force) { | 52 if (!force) { |
| 43 var showing = this._deviceModeView && this._deviceModeView.isShowing(); | 53 var showing = this._deviceModeView && this._deviceModeView.isShowing(); |
| 44 if (this._showDeviceModeSetting.get() === showing) | 54 if (this._showDeviceModeSetting.get() === showing) |
| 45 return; | 55 return; |
| 46 } | 56 } |
| 47 | 57 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 69 */ | 79 */ |
| 70 Emulation.DeviceModeWrapper.ActionDelegate = class { | 80 Emulation.DeviceModeWrapper.ActionDelegate = class { |
| 71 /** | 81 /** |
| 72 * @override | 82 * @override |
| 73 * @param {!UI.Context} context | 83 * @param {!UI.Context} context |
| 74 * @param {string} actionId | 84 * @param {string} actionId |
| 75 * @return {boolean} | 85 * @return {boolean} |
| 76 */ | 86 */ |
| 77 handleAction(context, actionId) { | 87 handleAction(context, actionId) { |
| 78 if (Emulation.DeviceModeView._wrapperInstance) { | 88 if (Emulation.DeviceModeView._wrapperInstance) { |
| 79 if (actionId === 'emulation.toggle-device-mode') { | 89 switch (actionId) { |
| 80 Emulation.DeviceModeView._wrapperInstance._toggleDeviceMode(); | 90 case 'emulation.capture-screenshot': |
| 81 return true; | 91 return Emulation.DeviceModeView._wrapperInstance._captureScreenshot(); |
| 92 |
| 93 case 'emulation.capture-full-height-screenshot': |
| 94 return Emulation.DeviceModeView._wrapperInstance._captureFullSizeScree
nshot(); |
| 95 |
| 96 case 'emulation.toggle-device-mode': |
| 97 Emulation.DeviceModeView._wrapperInstance._toggleDeviceMode(); |
| 98 return true; |
| 82 } | 99 } |
| 83 if (actionId === 'emulation.capture-screenshot') | |
| 84 return Emulation.DeviceModeView._wrapperInstance._captureScreenshot(); | |
| 85 } | 100 } |
| 86 return false; | 101 return false; |
| 87 } | 102 } |
| 88 }; | 103 }; |
| OLD | NEW |