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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/Context.js

Issue 2238003002: DevTools: migrate sources panel sidebar to views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 4 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 */ 7 */
8 WebInspector.Context = function() 8 WebInspector.Context = function()
9 { 9 {
10 this._flavors = new Map(); 10 this._flavors = new Map();
(...skipping 26 matching lines...) Expand all
37 this._dispatchFlavorChange(flavorType, flavorValue); 37 this._dispatchFlavorChange(flavorType, flavorValue);
38 }, 38 },
39 39
40 /** 40 /**
41 * @param {function(new:T, ...)} flavorType 41 * @param {function(new:T, ...)} flavorType
42 * @param {?T} flavorValue 42 * @param {?T} flavorValue
43 * @template T 43 * @template T
44 */ 44 */
45 _dispatchFlavorChange: function(flavorType, flavorValue) 45 _dispatchFlavorChange: function(flavorType, flavorValue)
46 { 46 {
47 self.runtime.extensions(WebInspector.ContextFlavorListener, flavorValue) .map(extension => {
48 extension.instance().then(instance => /** @type {!WebInspector.Conte xtFlavorListener} */ (instance).flavorChanged(flavorValue));
49 });
50
47 var dispatcher = this._eventDispatchers.get(flavorType); 51 var dispatcher = this._eventDispatchers.get(flavorType);
48 if (!dispatcher) 52 if (!dispatcher)
49 return; 53 return;
50 dispatcher.dispatchEventToListeners(WebInspector.Context.Events.FlavorCh anged, flavorValue); 54 dispatcher.dispatchEventToListeners(WebInspector.Context.Events.FlavorCh anged, flavorValue);
51 }, 55 },
52 56
53 /** 57 /**
54 * @param {function(new:Object, ...)} flavorType 58 * @param {function(new:Object, ...)} flavorType
55 * @param {function(!WebInspector.Event)} listener 59 * @param {function(!WebInspector.Event)} listener
56 * @param {!Object=} thisObject 60 * @param {!Object=} thisObject
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 var availableFlavors = this.flavors(); 113 var availableFlavors = this.flavors();
110 extensions.forEach(function(extension) { 114 extensions.forEach(function(extension) {
111 if (self.runtime.isExtensionApplicableToContextTypes(extension, avai lableFlavors)) 115 if (self.runtime.isExtensionApplicableToContextTypes(extension, avai lableFlavors))
112 targetExtensionSet.add(extension); 116 targetExtensionSet.add(extension);
113 }); 117 });
114 118
115 return targetExtensionSet; 119 return targetExtensionSet;
116 } 120 }
117 } 121 }
118 122
123 /**
124 * @interface
125 */
126 WebInspector.ContextFlavorListener = function() { }
127
128 WebInspector.ContextFlavorListener.prototype = {
129 /**
130 * @param {?Object} object
131 */
132 flavorChanged: function(object) { }
133 }
134
119 WebInspector.context = new WebInspector.Context(); 135 WebInspector.context = new WebInspector.Context();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698