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

Unified Diff: third_party/WebKit/Source/devtools/front_end/screencast/ScreencastApp.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/screencast/ScreencastApp.js
diff --git a/third_party/WebKit/Source/devtools/front_end/screencast/ScreencastApp.js b/third_party/WebKit/Source/devtools/front_end/screencast/ScreencastApp.js
index 2dd8cf07a47bd19b70c83837dc4a9db181c093d4..7bce80e9f8c2caaefa0f43fb4e8271fe80daa8ae 100644
--- a/third_party/WebKit/Source/devtools/front_end/screencast/ScreencastApp.js
+++ b/third_party/WebKit/Source/devtools/front_end/screencast/ScreencastApp.js
@@ -1,146 +1,130 @@
// Copyright 2014 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.
-
/**
- * @constructor
* @implements {WebInspector.App}
* @implements {WebInspector.TargetManager.Observer}
+ * @unrestricted
*/
-WebInspector.ScreencastApp = function()
-{
- this._enabledSetting = WebInspector.settings.createSetting("screencastEnabled", true);
- this._toggleButton = new WebInspector.ToolbarToggle(WebInspector.UIString("Toggle screencast"), "phone-toolbar-item");
+WebInspector.ScreencastApp = class {
+ constructor() {
+ this._enabledSetting = WebInspector.settings.createSetting('screencastEnabled', true);
+ this._toggleButton =
+ new WebInspector.ToolbarToggle(WebInspector.UIString('Toggle screencast'), 'phone-toolbar-item');
this._toggleButton.setToggled(this._enabledSetting.get());
- this._toggleButton.addEventListener("click", this._toggleButtonClicked, this);
+ this._toggleButton.addEventListener('click', this._toggleButtonClicked, this);
WebInspector.targetManager.observeTargets(this);
-};
-
-WebInspector.ScreencastApp.prototype = {
- /**
- * @override
- * @param {!Document} document
- */
- presentUI: function(document)
- {
- var rootView = new WebInspector.RootView();
-
- this._rootSplitWidget = new WebInspector.SplitWidget(false, true, "InspectorView.screencastSplitViewState", 300, 300);
- this._rootSplitWidget.setVertical(true);
- this._rootSplitWidget.setSecondIsSidebar(true);
- this._rootSplitWidget.show(rootView.element);
- this._rootSplitWidget.hideMain();
-
- this._rootSplitWidget.setSidebarWidget(WebInspector.inspectorView);
- rootView.attachToDocument(document);
- },
-
- /**
- * @override
- * @param {!WebInspector.Target} target
- */
- targetAdded: function(target)
- {
- if (this._target)
- return;
- this._target = target;
+ }
- var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target);
- if (resourceTreeModel) {
- this._screencastView = new WebInspector.ScreencastView(target, resourceTreeModel);
- this._rootSplitWidget.setMainWidget(this._screencastView);
- this._screencastView.initialize();
- } else {
- this._toggleButton.setEnabled(false);
- }
- this._onScreencastEnabledChanged();
- },
-
- /**
- * @override
- * @param {!WebInspector.Target} target
- */
- targetRemoved: function(target)
- {
- if (this._target === target) {
- delete this._target;
- if (!this._screencastView)
- return;
- this._toggleButton.setEnabled(false);
- this._screencastView.detach();
- delete this._screencastView;
- this._onScreencastEnabledChanged();
- }
- },
-
- _toggleButtonClicked: function()
- {
- var enabled = !this._toggleButton.toggled();
- this._enabledSetting.set(enabled);
- this._onScreencastEnabledChanged();
- },
-
- _onScreencastEnabledChanged: function()
- {
- if (!this._rootSplitWidget)
- return;
- var enabled = this._enabledSetting.get() && this._screencastView;
- this._toggleButton.setToggled(enabled);
- if (enabled)
- this._rootSplitWidget.showBoth();
- else
- this._rootSplitWidget.hideMain();
+ /**
+ * @return {!WebInspector.ScreencastApp}
+ */
+ static _instance() {
+ if (!WebInspector.ScreencastApp._appInstance)
+ WebInspector.ScreencastApp._appInstance = new WebInspector.ScreencastApp();
+ return WebInspector.ScreencastApp._appInstance;
+ }
+
+ /**
+ * @override
+ * @param {!Document} document
+ */
+ presentUI(document) {
+ var rootView = new WebInspector.RootView();
+
+ this._rootSplitWidget =
+ new WebInspector.SplitWidget(false, true, 'InspectorView.screencastSplitViewState', 300, 300);
+ this._rootSplitWidget.setVertical(true);
+ this._rootSplitWidget.setSecondIsSidebar(true);
+ this._rootSplitWidget.show(rootView.element);
+ this._rootSplitWidget.hideMain();
+
+ this._rootSplitWidget.setSidebarWidget(WebInspector.inspectorView);
+ rootView.attachToDocument(document);
+ }
+
+ /**
+ * @override
+ * @param {!WebInspector.Target} target
+ */
+ targetAdded(target) {
+ if (this._target)
+ return;
+ this._target = target;
+
+ var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target);
+ if (resourceTreeModel) {
+ this._screencastView = new WebInspector.ScreencastView(target, resourceTreeModel);
+ this._rootSplitWidget.setMainWidget(this._screencastView);
+ this._screencastView.initialize();
+ } else {
+ this._toggleButton.setEnabled(false);
+ }
+ this._onScreencastEnabledChanged();
+ }
+
+ /**
+ * @override
+ * @param {!WebInspector.Target} target
+ */
+ targetRemoved(target) {
+ if (this._target === target) {
+ delete this._target;
+ if (!this._screencastView)
+ return;
+ this._toggleButton.setEnabled(false);
+ this._screencastView.detach();
+ delete this._screencastView;
+ this._onScreencastEnabledChanged();
}
+ }
+
+ _toggleButtonClicked() {
+ var enabled = !this._toggleButton.toggled();
+ this._enabledSetting.set(enabled);
+ this._onScreencastEnabledChanged();
+ }
+
+ _onScreencastEnabledChanged() {
+ if (!this._rootSplitWidget)
+ return;
+ var enabled = this._enabledSetting.get() && this._screencastView;
+ this._toggleButton.setToggled(enabled);
+ if (enabled)
+ this._rootSplitWidget.showBoth();
+ else
+ this._rootSplitWidget.hideMain();
+ }
};
-
/** @type {!WebInspector.ScreencastApp} */
WebInspector.ScreencastApp._appInstance;
-/**
- * @return {!WebInspector.ScreencastApp}
- */
-WebInspector.ScreencastApp._instance = function()
-{
- if (!WebInspector.ScreencastApp._appInstance)
- WebInspector.ScreencastApp._appInstance = new WebInspector.ScreencastApp();
- return WebInspector.ScreencastApp._appInstance;
-};
/**
- * @constructor
* @implements {WebInspector.ToolbarItem.Provider}
+ * @unrestricted
*/
-WebInspector.ScreencastApp.ToolbarButtonProvider = function()
-{
-};
-
-WebInspector.ScreencastApp.ToolbarButtonProvider.prototype = {
- /**
- * @override
- * @return {?WebInspector.ToolbarItem}
- */
- item: function()
- {
- return WebInspector.ScreencastApp._instance()._toggleButton;
- }
+WebInspector.ScreencastApp.ToolbarButtonProvider = class {
+ /**
+ * @override
+ * @return {?WebInspector.ToolbarItem}
+ */
+ item() {
+ return WebInspector.ScreencastApp._instance()._toggleButton;
+ }
};
/**
- * @constructor
* @implements {WebInspector.AppProvider}
+ * @unrestricted
*/
-WebInspector.ScreencastAppProvider = function()
-{
-};
-
-WebInspector.ScreencastAppProvider.prototype = {
- /**
- * @override
- * @return {!WebInspector.App}
- */
- createApp: function()
- {
- return WebInspector.ScreencastApp._instance();
- }
+WebInspector.ScreencastAppProvider = class {
+ /**
+ * @override
+ * @return {!WebInspector.App}
+ */
+ createApp() {
+ return WebInspector.ScreencastApp._instance();
+ }
};

Powered by Google App Engine
This is Rietveld 408576698