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 */ | 7 */ |
8 WebInspector.Context = function() | 8 WebInspector.Context = function() |
9 { | 9 { |
10 this._flavors = new Map(); | 10 this._flavors = new Map(); |
11 this._eventDispatchers = new Map(); | 11 this._eventDispatchers = new Map(); |
12 } | 12 }; |
13 | 13 |
14 /** @enum {symbol} */ | 14 /** @enum {symbol} */ |
15 WebInspector.Context.Events = { | 15 WebInspector.Context.Events = { |
16 FlavorChanged: Symbol("FlavorChanged") | 16 FlavorChanged: Symbol("FlavorChanged") |
17 } | 17 }; |
18 | 18 |
19 WebInspector.Context.prototype = { | 19 WebInspector.Context.prototype = { |
20 /** | 20 /** |
21 * @param {function(new:T, ...)} flavorType | 21 * @param {function(new:T, ...)} flavorType |
22 * @param {?T} flavorValue | 22 * @param {?T} flavorValue |
23 * @template T | 23 * @template T |
24 */ | 24 */ |
25 setFlavor: function(flavorType, flavorValue) | 25 setFlavor: function(flavorType, flavorValue) |
26 { | 26 { |
27 var value = this._flavors.get(flavorType) || null; | 27 var value = this._flavors.get(flavorType) || null; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 var targetExtensionSet = new Set(); | 109 var targetExtensionSet = new Set(); |
110 | 110 |
111 var availableFlavors = this.flavors(); | 111 var availableFlavors = this.flavors(); |
112 extensions.forEach(function(extension) { | 112 extensions.forEach(function(extension) { |
113 if (self.runtime.isExtensionApplicableToContextTypes(extension, avai
lableFlavors)) | 113 if (self.runtime.isExtensionApplicableToContextTypes(extension, avai
lableFlavors)) |
114 targetExtensionSet.add(extension); | 114 targetExtensionSet.add(extension); |
115 }); | 115 }); |
116 | 116 |
117 return targetExtensionSet; | 117 return targetExtensionSet; |
118 } | 118 } |
119 } | 119 }; |
120 | 120 |
121 /** | 121 /** |
122 * @interface | 122 * @interface |
123 */ | 123 */ |
124 WebInspector.ContextFlavorListener = function() { } | 124 WebInspector.ContextFlavorListener = function() { }; |
125 | 125 |
126 WebInspector.ContextFlavorListener.prototype = { | 126 WebInspector.ContextFlavorListener.prototype = { |
127 /** | 127 /** |
128 * @param {?Object} object | 128 * @param {?Object} object |
129 */ | 129 */ |
130 flavorChanged: function(object) { } | 130 flavorChanged: function(object) { } |
131 } | 131 }; |
132 | 132 |
133 WebInspector.context = new WebInspector.Context(); | 133 WebInspector.context = new WebInspector.Context(); |
OLD | NEW |