Index: third_party/WebKit/Source/devtools/front_end/profiler/TargetsComboBoxController.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/TargetsComboBoxController.js b/third_party/WebKit/Source/devtools/front_end/profiler/TargetsComboBoxController.js |
index 90655a0c53860db9d390fad2e4189e6d77094566..86604d4c3bcf2f40da97abbfdb5d120570aefc4c 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/profiler/TargetsComboBoxController.js |
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/TargetsComboBoxController.js |
@@ -1,99 +1,91 @@ |
// 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.TargetManager.Observer} |
- * @param {!Element} selectElement |
- * @param {!Element} elementToHide |
+ * @unrestricted |
*/ |
-WebInspector.TargetsComboBoxController = function(selectElement, elementToHide) |
-{ |
- elementToHide.classList.add("hidden"); |
- selectElement.addEventListener("change", this._onComboBoxSelectionChange.bind(this), false); |
+WebInspector.TargetsComboBoxController = class { |
+ /** |
+ * @param {!Element} selectElement |
+ * @param {!Element} elementToHide |
+ */ |
+ constructor(selectElement, elementToHide) { |
+ elementToHide.classList.add('hidden'); |
+ selectElement.addEventListener('change', this._onComboBoxSelectionChange.bind(this), false); |
this._selectElement = selectElement; |
this._elementToHide = elementToHide; |
/** @type {!Map.<!WebInspector.Target, !Element>} */ |
this._targetToOption = new Map(); |
WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._targetChangedExternally, this); |
- WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.NameChanged, this._targetNameChanged, this); |
+ WebInspector.targetManager.addEventListener( |
+ WebInspector.TargetManager.Events.NameChanged, this._targetNameChanged, this); |
WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capability.JS); |
-}; |
- |
-WebInspector.TargetsComboBoxController.prototype = { |
- |
- /** |
- * @override |
- * @param {!WebInspector.Target} target |
- */ |
- targetAdded: function(target) |
- { |
- var option = this._selectElement.createChild("option"); |
- option.text = target.name(); |
- option.__target = target; |
- this._targetToOption.set(target, option); |
- if (WebInspector.context.flavor(WebInspector.Target) === target) |
- this._selectElement.selectedIndex = Array.prototype.indexOf.call(/** @type {?} */ (this._selectElement), option); |
+ } |
- this._updateVisibility(); |
- }, |
+ /** |
+ * @override |
+ * @param {!WebInspector.Target} target |
+ */ |
+ targetAdded(target) { |
+ var option = this._selectElement.createChild('option'); |
+ option.text = target.name(); |
+ option.__target = target; |
+ this._targetToOption.set(target, option); |
+ if (WebInspector.context.flavor(WebInspector.Target) === target) |
+ this._selectElement.selectedIndex = Array.prototype.indexOf.call(/** @type {?} */ (this._selectElement), option); |
- /** |
- * @override |
- * @param {!WebInspector.Target} target |
- */ |
- targetRemoved: function(target) |
- { |
- var option = this._targetToOption.remove(target); |
- this._selectElement.removeChild(option); |
- this._updateVisibility(); |
- }, |
+ this._updateVisibility(); |
+ } |
- /** |
- * @param {!WebInspector.Event} event |
- */ |
- _targetNameChanged: function(event) |
- { |
- var target = /** @type {!WebInspector.Target} */ (event.data); |
- var option = this._targetToOption.get(target); |
- option.text = target.name(); |
- }, |
+ /** |
+ * @override |
+ * @param {!WebInspector.Target} target |
+ */ |
+ targetRemoved(target) { |
+ var option = this._targetToOption.remove(target); |
+ this._selectElement.removeChild(option); |
+ this._updateVisibility(); |
+ } |
- _onComboBoxSelectionChange: function() |
- { |
- var selectedOption = this._selectElement[this._selectElement.selectedIndex]; |
- if (!selectedOption) |
- return; |
+ /** |
+ * @param {!WebInspector.Event} event |
+ */ |
+ _targetNameChanged(event) { |
+ var target = /** @type {!WebInspector.Target} */ (event.data); |
+ var option = this._targetToOption.get(target); |
+ option.text = target.name(); |
+ } |
- WebInspector.context.setFlavor(WebInspector.Target, selectedOption.__target); |
- }, |
+ _onComboBoxSelectionChange() { |
+ var selectedOption = this._selectElement[this._selectElement.selectedIndex]; |
+ if (!selectedOption) |
+ return; |
- _updateVisibility: function() |
- { |
- var hidden = this._selectElement.childElementCount === 1; |
- this._elementToHide.classList.toggle("hidden", hidden); |
- }, |
+ WebInspector.context.setFlavor(WebInspector.Target, selectedOption.__target); |
+ } |
- /** |
- * @param {!WebInspector.Event} event |
- */ |
- _targetChangedExternally: function(event) |
- { |
- var target = /** @type {?WebInspector.Target} */ (event.data); |
- if (target) { |
- var option = /** @type {!Element} */ (this._targetToOption.get(target)); |
- this._select(option); |
- } |
- }, |
+ _updateVisibility() { |
+ var hidden = this._selectElement.childElementCount === 1; |
+ this._elementToHide.classList.toggle('hidden', hidden); |
+ } |
- /** |
- * @param {!Element} option |
- */ |
- _select: function(option) |
- { |
- this._selectElement.selectedIndex = Array.prototype.indexOf.call(/** @type {?} */ (this._selectElement), option); |
+ /** |
+ * @param {!WebInspector.Event} event |
+ */ |
+ _targetChangedExternally(event) { |
+ var target = /** @type {?WebInspector.Target} */ (event.data); |
+ if (target) { |
+ var option = /** @type {!Element} */ (this._targetToOption.get(target)); |
+ this._select(option); |
} |
+ } |
+ /** |
+ * @param {!Element} option |
+ */ |
+ _select(option) { |
+ this._selectElement.selectedIndex = Array.prototype.indexOf.call(/** @type {?} */ (this._selectElement), option); |
+ } |
}; |