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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/DropDownMenu.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/ui/DropDownMenu.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/DropDownMenu.js b/third_party/WebKit/Source/devtools/front_end/ui/DropDownMenu.js
index 7927fbff7480f762523c6c060d9d359823021e7e..d4bb15bf3643b120fa074296c742f6a535506068 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/DropDownMenu.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/DropDownMenu.js
@@ -1,72 +1,65 @@
// 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
- * @extends {WebInspector.Object}
- * @param {!Element} element
+ * @unrestricted
*/
-WebInspector.DropDownMenu = function(element)
-{
+WebInspector.DropDownMenu = class extends WebInspector.Object {
+ /**
+ * @param {!Element} element
+ */
+ constructor(element) {
+ super();
/** @type {!Array.<!WebInspector.DropDownMenu.Item>} */
this._items = [];
- element.addEventListener("mousedown", this._onMouseDown.bind(this));
-};
+ element.addEventListener('mousedown', this._onMouseDown.bind(this));
+ }
-/** @typedef {{id: string, title: string}} */
-WebInspector.DropDownMenu.Item;
-
-/** @enum {symbol} */
-WebInspector.DropDownMenu.Events = {
- ItemSelected: Symbol("ItemSelected")
-};
+ /**
+ * @param {!Event} event
+ */
+ _onMouseDown(event) {
+ if (event.which !== 1)
+ return;
+ var menu = new WebInspector.ContextMenu(event);
+ for (var item of this._items)
+ menu.appendCheckboxItem(item.title, this._itemHandler.bind(this, item.id), item.id === this._selectedItemId);
+ menu.show();
+ }
-WebInspector.DropDownMenu.prototype = {
- /**
- * @param {!Event} event
- */
- _onMouseDown: function(event)
- {
- if (event.which !== 1)
- return;
- var menu = new WebInspector.ContextMenu(event);
- for (var item of this._items)
- menu.appendCheckboxItem(item.title, this._itemHandler.bind(this, item.id), item.id === this._selectedItemId);
- menu.show();
- },
+ /**
+ * @param {string} id
+ */
+ _itemHandler(id) {
+ this.dispatchEventToListeners(WebInspector.DropDownMenu.Events.ItemSelected, id);
+ }
- /**
- * @param {string} id
- */
- _itemHandler: function(id)
- {
- this.dispatchEventToListeners(WebInspector.DropDownMenu.Events.ItemSelected, id);
- },
+ /**
+ * @param {string} id
+ * @param {string} title
+ */
+ addItem(id, title) {
+ this._items.push({id: id, title: title});
+ }
- /**
- * @param {string} id
- * @param {string} title
- */
- addItem: function(id, title)
- {
- this._items.push({id: id, title: title});
- },
+ /**
+ * @param {string} id
+ */
+ selectItem(id) {
+ this._selectedItemId = id;
+ }
- /**
- * @param {string} id
- */
- selectItem: function(id)
- {
- this._selectedItemId = id;
- },
+ clear() {
+ this._items = [];
+ delete this._selectedItemId;
+ }
+};
- clear: function()
- {
- this._items = [];
- delete this._selectedItemId;
- },
+/** @typedef {{id: string, title: string}} */
+WebInspector.DropDownMenu.Item;
- __proto__: WebInspector.Object.prototype
+/** @enum {symbol} */
+WebInspector.DropDownMenu.Events = {
+ ItemSelected: Symbol('ItemSelected')
};

Powered by Google App Engine
This is Rietveld 408576698