| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @implements {WebInspector.TargetManager.Observer} | 7 * @implements {WebInspector.TargetManager.Observer} |
| 8 * @param {!Element} selectElement | 8 * @param {!Element} selectElement |
| 9 * @param {!Element} elementToHide | 9 * @param {!Element} elementToHide |
| 10 */ | 10 */ |
| 11 WebInspector.TargetsComboBoxController = function(selectElement, elementToHide) | 11 WebInspector.TargetsComboBoxController = function(selectElement, elementToHide) |
| 12 { | 12 { |
| 13 elementToHide.classList.add("hidden"); | 13 elementToHide.classList.add("hidden"); |
| 14 selectElement.addEventListener("change", this._onComboBoxSelectionChange.bin
d(this), false); | 14 selectElement.addEventListener("change", this._onComboBoxSelectionChange.bin
d(this), false); |
| 15 this._selectElement = selectElement; | 15 this._selectElement = selectElement; |
| 16 this._elementToHide = elementToHide; | 16 this._elementToHide = elementToHide; |
| 17 /** @type {!Map.<!WebInspector.Target, !Element>} */ | 17 /** @type {!Map.<!WebInspector.Target, !Element>} */ |
| 18 this._targetToOption = new Map(); | 18 this._targetToOption = new Map(); |
| 19 | 19 |
| 20 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._targ
etChangedExternally, this); | 20 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._targ
etChangedExternally, this); |
| 21 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.NameChanged, this._targetNameChanged, this); | 21 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.NameChanged, this._targetNameChanged, this); |
| 22 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.JS); | 22 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.JS); |
| 23 } | 23 }; |
| 24 | 24 |
| 25 WebInspector.TargetsComboBoxController.prototype = { | 25 WebInspector.TargetsComboBoxController.prototype = { |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * @override | 28 * @override |
| 29 * @param {!WebInspector.Target} target | 29 * @param {!WebInspector.Target} target |
| 30 */ | 30 */ |
| 31 targetAdded: function(target) | 31 targetAdded: function(target) |
| 32 { | 32 { |
| 33 var option = this._selectElement.createChild("option"); | 33 var option = this._selectElement.createChild("option"); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 }, | 89 }, |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * @param {!Element} option | 92 * @param {!Element} option |
| 93 */ | 93 */ |
| 94 _select: function(option) | 94 _select: function(option) |
| 95 { | 95 { |
| 96 this._selectElement.selectedIndex = Array.prototype.indexOf.call(/** @ty
pe {?} */ (this._selectElement), option); | 96 this._selectElement.selectedIndex = Array.prototype.indexOf.call(/** @ty
pe {?} */ (this._selectElement), option); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } | 99 }; |
| OLD | NEW |