Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeWrapper.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 WebInspector.DeviceModeWrapper = class extends WebInspector.VBox { 7 Emulation.DeviceModeWrapper = class extends UI.VBox {
8 /** 8 /**
9 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder 9 * @param {!Emulation.InspectedPagePlaceholder} inspectedPagePlaceholder
10 */ 10 */
11 constructor(inspectedPagePlaceholder) { 11 constructor(inspectedPagePlaceholder) {
12 super(); 12 super();
13 WebInspector.DeviceModeView._wrapperInstance = this; 13 Emulation.DeviceModeView._wrapperInstance = this;
14 this._inspectedPagePlaceholder = inspectedPagePlaceholder; 14 this._inspectedPagePlaceholder = inspectedPagePlaceholder;
15 /** @type {?WebInspector.DeviceModeView} */ 15 /** @type {?Emulation.DeviceModeView} */
16 this._deviceModeView = null; 16 this._deviceModeView = null;
17 this._toggleDeviceModeAction = WebInspector.actionRegistry.action('emulation .toggle-device-mode'); 17 this._toggleDeviceModeAction = UI.actionRegistry.action('emulation.toggle-de vice-mode');
18 this._showDeviceModeSetting = WebInspector.settings.createSetting('emulation .showDeviceMode', 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 } 25 }
26 26
27 /** 27 /**
28 * @return {boolean} 28 * @return {boolean}
(...skipping 11 matching lines...) Expand all
40 _update(force) { 40 _update(force) {
41 this._toggleDeviceModeAction.setToggled(this._showDeviceModeSetting.get()); 41 this._toggleDeviceModeAction.setToggled(this._showDeviceModeSetting.get());
42 if (!force) { 42 if (!force) {
43 var showing = this._deviceModeView && this._deviceModeView.isShowing(); 43 var showing = this._deviceModeView && this._deviceModeView.isShowing();
44 if (this._showDeviceModeSetting.get() === showing) 44 if (this._showDeviceModeSetting.get() === showing)
45 return; 45 return;
46 } 46 }
47 47
48 if (this._showDeviceModeSetting.get()) { 48 if (this._showDeviceModeSetting.get()) {
49 if (!this._deviceModeView) 49 if (!this._deviceModeView)
50 this._deviceModeView = new WebInspector.DeviceModeView(); 50 this._deviceModeView = new Emulation.DeviceModeView();
51 this._deviceModeView.show(this.element); 51 this._deviceModeView.show(this.element);
52 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins(); 52 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins();
53 this._inspectedPagePlaceholder.show(this._deviceModeView.element); 53 this._inspectedPagePlaceholder.show(this._deviceModeView.element);
54 } else { 54 } else {
55 if (this._deviceModeView) 55 if (this._deviceModeView)
56 this._deviceModeView.detach(); 56 this._deviceModeView.detach();
57 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins(); 57 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins();
58 this._inspectedPagePlaceholder.show(this.element); 58 this._inspectedPagePlaceholder.show(this.element);
59 } 59 }
60 } 60 }
61 }; 61 };
62 62
63 /** @type {!WebInspector.DeviceModeWrapper} */ 63 /** @type {!Emulation.DeviceModeWrapper} */
64 WebInspector.DeviceModeView._wrapperInstance; 64 Emulation.DeviceModeView._wrapperInstance;
65 65
66 /** 66 /**
67 * @implements {WebInspector.ActionDelegate} 67 * @implements {UI.ActionDelegate}
68 * @unrestricted 68 * @unrestricted
69 */ 69 */
70 WebInspector.DeviceModeWrapper.ActionDelegate = class { 70 Emulation.DeviceModeWrapper.ActionDelegate = class {
71 /** 71 /**
72 * @override 72 * @override
73 * @param {!WebInspector.Context} context 73 * @param {!UI.Context} context
74 * @param {string} actionId 74 * @param {string} actionId
75 * @return {boolean} 75 * @return {boolean}
76 */ 76 */
77 handleAction(context, actionId) { 77 handleAction(context, actionId) {
78 if (WebInspector.DeviceModeView._wrapperInstance) { 78 if (Emulation.DeviceModeView._wrapperInstance) {
79 if (actionId === 'emulation.toggle-device-mode') { 79 if (actionId === 'emulation.toggle-device-mode') {
80 WebInspector.DeviceModeView._wrapperInstance._toggleDeviceMode(); 80 Emulation.DeviceModeView._wrapperInstance._toggleDeviceMode();
81 return true; 81 return true;
82 } 82 }
83 if (actionId === 'emulation.capture-screenshot') 83 if (actionId === 'emulation.capture-screenshot')
84 return WebInspector.DeviceModeView._wrapperInstance._captureScreenshot() ; 84 return Emulation.DeviceModeView._wrapperInstance._captureScreenshot();
85 } 85 }
86 return false; 86 return false;
87 } 87 }
88 }; 88 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698