| 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 */ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 WebInspector.TargetsComboBoxController.prototype = { | 24 WebInspector.TargetsComboBoxController.prototype = { |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * @override | 27 * @override |
| 28 * @param {!WebInspector.Target} target | 28 * @param {!WebInspector.Target} target |
| 29 */ | 29 */ |
| 30 targetAdded: function(target) | 30 targetAdded: function(target) |
| 31 { | 31 { |
| 32 if (!target.hasJSContext()) | 32 if (!target.hasJSDomains()) |
| 33 return; | 33 return; |
| 34 var option = this._selectElement.createChild("option"); | 34 var option = this._selectElement.createChild("option"); |
| 35 option.text = target.name(); | 35 option.text = target.name(); |
| 36 option.__target = target; | 36 option.__target = target; |
| 37 this._targetToOption.set(target, option); | 37 this._targetToOption.set(target, option); |
| 38 if (WebInspector.context.flavor(WebInspector.Target) === target) | 38 if (WebInspector.context.flavor(WebInspector.Target) === target) |
| 39 this._selectElement.selectedIndex = Array.prototype.indexOf.call(/**
@type {?} */ (this._selectElement), option); | 39 this._selectElement.selectedIndex = Array.prototype.indexOf.call(/**
@type {?} */ (this._selectElement), option); |
| 40 | 40 |
| 41 this._updateVisibility(); | 41 this._updateVisibility(); |
| 42 }, | 42 }, |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * @override | 45 * @override |
| 46 * @param {!WebInspector.Target} target | 46 * @param {!WebInspector.Target} target |
| 47 */ | 47 */ |
| 48 targetRemoved: function(target) | 48 targetRemoved: function(target) |
| 49 { | 49 { |
| 50 if (!target.hasJSContext()) | 50 if (!target.hasJSDomains()) |
| 51 return; | 51 return; |
| 52 var option = this._targetToOption.remove(target); | 52 var option = this._targetToOption.remove(target); |
| 53 this._selectElement.removeChild(option); | 53 this._selectElement.removeChild(option); |
| 54 this._updateVisibility(); | 54 this._updateVisibility(); |
| 55 }, | 55 }, |
| 56 | 56 |
| 57 _onComboBoxSelectionChange: function() | 57 _onComboBoxSelectionChange: function() |
| 58 { | 58 { |
| 59 var selectedOption = this._selectElement[this._selectElement.selectedInd
ex]; | 59 var selectedOption = this._selectElement[this._selectElement.selectedInd
ex]; |
| 60 if (!selectedOption) | 60 if (!selectedOption) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * @param {!Element} option | 85 * @param {!Element} option |
| 86 */ | 86 */ |
| 87 _select: function(option) | 87 _select: function(option) |
| 88 { | 88 { |
| 89 this._selectElement.selectedIndex = Array.prototype.indexOf.call(/** @ty
pe {?} */ (this._selectElement), option); | 89 this._selectElement.selectedIndex = Array.prototype.indexOf.call(/** @ty
pe {?} */ (this._selectElement), option); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } | 92 } |
| OLD | NEW |