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 /** | 5 /** |
6 * @extends {WebInspector.VBox} | 6 * @extends {WebInspector.VBox} |
7 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder | 7 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder |
8 * @constructor | 8 * @constructor |
9 */ | 9 */ |
10 WebInspector.DeviceModeWrapper = function(inspectedPagePlaceholder) | 10 WebInspector.DeviceModeWrapper = function(inspectedPagePlaceholder) |
11 { | 11 { |
12 WebInspector.VBox.call(this); | 12 WebInspector.VBox.call(this); |
13 WebInspector.DeviceModeView._wrapperInstance = this; | 13 WebInspector.DeviceModeView._wrapperInstance = this; |
14 this._inspectedPagePlaceholder = inspectedPagePlaceholder; | 14 this._inspectedPagePlaceholder = inspectedPagePlaceholder; |
15 /** @type {?WebInspector.DeviceModeView} */ | 15 /** @type {?WebInspector.DeviceModeView} */ |
16 this._deviceModeView = null; | 16 this._deviceModeView = null; |
17 this._toggleDeviceModeAction = WebInspector.actionRegistry.action("emulation
.toggle-device-mode"); | 17 this._toggleDeviceModeAction = WebInspector.actionRegistry.action("emulation
.toggle-device-mode"); |
18 this._showDeviceModeSetting = WebInspector.settings.createSetting("emulation
.showDeviceMode", false); | 18 this._showDeviceModeSetting = WebInspector.settings.createSetting("emulation
.showDeviceMode", 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 /** @type {!WebInspector.DeviceModeWrapper} */ | 23 /** @type {!WebInspector.DeviceModeWrapper} */ |
24 WebInspector.DeviceModeView._wrapperInstance; | 24 WebInspector.DeviceModeView._wrapperInstance; |
25 | 25 |
26 WebInspector.DeviceModeWrapper.prototype = { | 26 WebInspector.DeviceModeWrapper.prototype = { |
27 _toggleDeviceMode: function() | 27 _toggleDeviceMode: function() |
28 { | 28 { |
29 this._showDeviceModeSetting.set(!this._showDeviceModeSetting.get()); | 29 this._showDeviceModeSetting.set(!this._showDeviceModeSetting.get()); |
30 }, | 30 }, |
31 | 31 |
(...skipping 28 matching lines...) Expand all Loading... |
60 this._inspectedPagePlaceholder.show(this._deviceModeView.element); | 60 this._inspectedPagePlaceholder.show(this._deviceModeView.element); |
61 } else { | 61 } else { |
62 if (this._deviceModeView) | 62 if (this._deviceModeView) |
63 this._deviceModeView.detach(); | 63 this._deviceModeView.detach(); |
64 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins(); | 64 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins(); |
65 this._inspectedPagePlaceholder.show(this.element); | 65 this._inspectedPagePlaceholder.show(this.element); |
66 } | 66 } |
67 }, | 67 }, |
68 | 68 |
69 __proto__: WebInspector.VBox.prototype | 69 __proto__: WebInspector.VBox.prototype |
70 } | 70 }; |
71 | 71 |
72 /** | 72 /** |
73 * @constructor | 73 * @constructor |
74 * @implements {WebInspector.ActionDelegate} | 74 * @implements {WebInspector.ActionDelegate} |
75 */ | 75 */ |
76 WebInspector.DeviceModeWrapper.ActionDelegate = function() | 76 WebInspector.DeviceModeWrapper.ActionDelegate = function() |
77 { | 77 { |
78 } | 78 }; |
79 | 79 |
80 WebInspector.DeviceModeWrapper.ActionDelegate.prototype = { | 80 WebInspector.DeviceModeWrapper.ActionDelegate.prototype = { |
81 /** | 81 /** |
82 * @override | 82 * @override |
83 * @param {!WebInspector.Context} context | 83 * @param {!WebInspector.Context} context |
84 * @param {string} actionId | 84 * @param {string} actionId |
85 * @return {boolean} | 85 * @return {boolean} |
86 */ | 86 */ |
87 handleAction: function(context, actionId) | 87 handleAction: function(context, actionId) |
88 { | 88 { |
89 if (WebInspector.DeviceModeView._wrapperInstance) { | 89 if (WebInspector.DeviceModeView._wrapperInstance) { |
90 if (actionId === "emulation.toggle-device-mode") { | 90 if (actionId === "emulation.toggle-device-mode") { |
91 WebInspector.DeviceModeView._wrapperInstance._toggleDeviceMode()
; | 91 WebInspector.DeviceModeView._wrapperInstance._toggleDeviceMode()
; |
92 return true; | 92 return true; |
93 } | 93 } |
94 if (actionId === "emulation.capture-screenshot") | 94 if (actionId === "emulation.capture-screenshot") |
95 return WebInspector.DeviceModeView._wrapperInstance._captureScre
enshot(); | 95 return WebInspector.DeviceModeView._wrapperInstance._captureScre
enshot(); |
96 } | 96 } |
97 return false; | 97 return false; |
98 } | 98 } |
99 } | 99 }; |
OLD | NEW |