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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/profiler/TargetsComboBoxController.js

Issue 2383743003: [DevTools] Auto-attach to cross-process subframes under experiment. (Closed)
Patch Set: some ui Created 4 years, 2 months 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 unified diff | Download patch
OLDNEW
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.observeTargets(this, WebInspector.Target.Capabili ty.JS); 22 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili ty.JS);
22 } 23 }
23 24
24 WebInspector.TargetsComboBoxController.prototype = { 25 WebInspector.TargetsComboBoxController.prototype = {
25 26
26 /** 27 /**
27 * @override 28 * @override
28 * @param {!WebInspector.Target} target 29 * @param {!WebInspector.Target} target
29 */ 30 */
30 targetAdded: function(target) 31 targetAdded: function(target)
(...skipping 12 matching lines...) Expand all
43 * @override 44 * @override
44 * @param {!WebInspector.Target} target 45 * @param {!WebInspector.Target} target
45 */ 46 */
46 targetRemoved: function(target) 47 targetRemoved: function(target)
47 { 48 {
48 var option = this._targetToOption.remove(target); 49 var option = this._targetToOption.remove(target);
49 this._selectElement.removeChild(option); 50 this._selectElement.removeChild(option);
50 this._updateVisibility(); 51 this._updateVisibility();
51 }, 52 },
52 53
54 /**
55 * @param {!WebInspector.Event} event
56 */
57 _targetNameChanged: function(event)
58 {
59 var target = /** @type {!WebInspector.Target} */ (event.data);
60 var option = this._targetToOption.get(target);
61 option.text = target.name();
62 },
63
53 _onComboBoxSelectionChange: function() 64 _onComboBoxSelectionChange: function()
54 { 65 {
55 var selectedOption = this._selectElement[this._selectElement.selectedInd ex]; 66 var selectedOption = this._selectElement[this._selectElement.selectedInd ex];
56 if (!selectedOption) 67 if (!selectedOption)
57 return; 68 return;
58 69
59 WebInspector.context.setFlavor(WebInspector.Target, selectedOption.__tar get); 70 WebInspector.context.setFlavor(WebInspector.Target, selectedOption.__tar get);
60 }, 71 },
61 72
62 _updateVisibility: function() 73 _updateVisibility: function()
(...skipping 16 matching lines...) Expand all
79 90
80 /** 91 /**
81 * @param {!Element} option 92 * @param {!Element} option
82 */ 93 */
83 _select: function(option) 94 _select: function(option)
84 { 95 {
85 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);
86 } 97 }
87 98
88 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698