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

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

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeWrapper.js
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeWrapper.js b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeWrapper.js
index ad53fc7c92a24ed75c131f52453de625e2a60f73..7bf1a89a50d5dc34b216e17f1ca8dcb1f0e1165a 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeWrapper.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeWrapper.js
@@ -1,99 +1,88 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
/**
- * @extends {WebInspector.VBox}
- * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder
- * @constructor
+ * @unrestricted
*/
-WebInspector.DeviceModeWrapper = function(inspectedPagePlaceholder)
-{
- WebInspector.VBox.call(this);
+WebInspector.DeviceModeWrapper = class extends WebInspector.VBox {
+ /**
+ * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder
+ */
+ constructor(inspectedPagePlaceholder) {
+ super();
WebInspector.DeviceModeView._wrapperInstance = this;
this._inspectedPagePlaceholder = inspectedPagePlaceholder;
/** @type {?WebInspector.DeviceModeView} */
this._deviceModeView = null;
- this._toggleDeviceModeAction = WebInspector.actionRegistry.action("emulation.toggle-device-mode");
- this._showDeviceModeSetting = WebInspector.settings.createSetting("emulation.showDeviceMode", false);
+ this._toggleDeviceModeAction = WebInspector.actionRegistry.action('emulation.toggle-device-mode');
+ this._showDeviceModeSetting = WebInspector.settings.createSetting('emulation.showDeviceMode', false);
this._showDeviceModeSetting.addChangeListener(this._update.bind(this, false));
this._update(true);
-};
-
-/** @type {!WebInspector.DeviceModeWrapper} */
-WebInspector.DeviceModeView._wrapperInstance;
-
-WebInspector.DeviceModeWrapper.prototype = {
- _toggleDeviceMode: function()
- {
- this._showDeviceModeSetting.set(!this._showDeviceModeSetting.get());
- },
+ }
- /**
- * @return {boolean}
- */
- _captureScreenshot: function()
- {
- if (!this._deviceModeView)
- return false;
- this._deviceModeView.captureScreenshot();
- return true;
- },
+ _toggleDeviceMode() {
+ this._showDeviceModeSetting.set(!this._showDeviceModeSetting.get());
+ }
- /**
- * @param {boolean} force
- */
- _update: function(force)
- {
- this._toggleDeviceModeAction.setToggled(this._showDeviceModeSetting.get());
- if (!force) {
- var showing = this._deviceModeView && this._deviceModeView.isShowing();
- if (this._showDeviceModeSetting.get() === showing)
- return;
- }
+ /**
+ * @return {boolean}
+ */
+ _captureScreenshot() {
+ if (!this._deviceModeView)
+ return false;
+ this._deviceModeView.captureScreenshot();
+ return true;
+ }
- if (this._showDeviceModeSetting.get()) {
- if (!this._deviceModeView)
- this._deviceModeView = new WebInspector.DeviceModeView();
- this._deviceModeView.show(this.element);
- this._inspectedPagePlaceholder.clearMinimumSizeAndMargins();
- this._inspectedPagePlaceholder.show(this._deviceModeView.element);
- } else {
- if (this._deviceModeView)
- this._deviceModeView.detach();
- this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins();
- this._inspectedPagePlaceholder.show(this.element);
- }
- },
+ /**
+ * @param {boolean} force
+ */
+ _update(force) {
+ this._toggleDeviceModeAction.setToggled(this._showDeviceModeSetting.get());
+ if (!force) {
+ var showing = this._deviceModeView && this._deviceModeView.isShowing();
+ if (this._showDeviceModeSetting.get() === showing)
+ return;
+ }
- __proto__: WebInspector.VBox.prototype
+ if (this._showDeviceModeSetting.get()) {
+ if (!this._deviceModeView)
+ this._deviceModeView = new WebInspector.DeviceModeView();
+ this._deviceModeView.show(this.element);
+ this._inspectedPagePlaceholder.clearMinimumSizeAndMargins();
+ this._inspectedPagePlaceholder.show(this._deviceModeView.element);
+ } else {
+ if (this._deviceModeView)
+ this._deviceModeView.detach();
+ this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins();
+ this._inspectedPagePlaceholder.show(this.element);
+ }
+ }
};
+/** @type {!WebInspector.DeviceModeWrapper} */
+WebInspector.DeviceModeView._wrapperInstance;
+
/**
- * @constructor
* @implements {WebInspector.ActionDelegate}
+ * @unrestricted
*/
-WebInspector.DeviceModeWrapper.ActionDelegate = function()
-{
-};
-
-WebInspector.DeviceModeWrapper.ActionDelegate.prototype = {
- /**
- * @override
- * @param {!WebInspector.Context} context
- * @param {string} actionId
- * @return {boolean}
- */
- handleAction: function(context, actionId)
- {
- if (WebInspector.DeviceModeView._wrapperInstance) {
- if (actionId === "emulation.toggle-device-mode") {
- WebInspector.DeviceModeView._wrapperInstance._toggleDeviceMode();
- return true;
- }
- if (actionId === "emulation.capture-screenshot")
- return WebInspector.DeviceModeView._wrapperInstance._captureScreenshot();
- }
- return false;
+WebInspector.DeviceModeWrapper.ActionDelegate = class {
+ /**
+ * @override
+ * @param {!WebInspector.Context} context
+ * @param {string} actionId
+ * @return {boolean}
+ */
+ handleAction(context, actionId) {
+ if (WebInspector.DeviceModeView._wrapperInstance) {
+ if (actionId === 'emulation.toggle-device-mode') {
+ WebInspector.DeviceModeView._wrapperInstance._toggleDeviceMode();
+ return true;
+ }
+ if (actionId === 'emulation.capture-screenshot')
+ return WebInspector.DeviceModeView._wrapperInstance._captureScreenshot();
}
+ return false;
+ }
};

Powered by Google App Engine
This is Rietveld 408576698