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

Side by Side Diff: Source/devtools/front_end/common/ModuleManager.js

Issue 385173007: DevTools: move UI components to target observers in preparation to early UI initialization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/common/Settings.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 * @param {!Function} targetType 154 * @param {!Function} targetType
155 * @return {boolean} 155 * @return {boolean}
156 */ 156 */
157 function isContextTypeKnown(targetType) 157 function isContextTypeKnown(targetType)
158 { 158 {
159 return currentContextTypes.contains(targetType); 159 return currentContextTypes.contains(targetType);
160 } 160 }
161 }, 161 },
162 162
163 /** 163 /**
164 * @param {string|!Function} type 164 * @param {*} type
165 * @param {?Object=} context 165 * @param {?Object=} context
166 * @return {!Array.<!WebInspector.ModuleManager.Extension>} 166 * @return {!Array.<!WebInspector.ModuleManager.Extension>}
167 */ 167 */
168 extensions: function(type, context) 168 extensions: function(type, context)
169 { 169 {
170 /** 170 /**
171 * @param {!WebInspector.ModuleManager.Extension} extension 171 * @param {!WebInspector.ModuleManager.Extension} extension
172 * @return {boolean} 172 * @return {boolean}
173 */ 173 */
174 function filter(extension) 174 function filter(extension)
175 { 175 {
176 if (extension._type !== type && extension._typeClass() !== type) 176 if (extension._type !== type && extension._typeClass() !== type)
177 return false; 177 return false;
178 return !context || extension.isApplicable(context); 178 return !context || extension.isApplicable(context);
179 } 179 }
180 return this._extensions.filter(filter); 180 return this._extensions.filter(filter);
181 }, 181 },
182 182
183 /** 183 /**
184 * @param {string|!Function} type 184 * @param {*} type
185 * @param {?Object=} context 185 * @param {?Object=} context
186 * @return {?WebInspector.ModuleManager.Extension} 186 * @return {?WebInspector.ModuleManager.Extension}
187 */ 187 */
188 extension: function(type, context) 188 extension: function(type, context)
189 { 189 {
190 return this.extensions(type, context)[0] || null; 190 return this.extensions(type, context)[0] || null;
191 }, 191 },
192 192
193 /** 193 /**
194 * @param {string|!Function} type 194 * @param {*} type
195 * @param {?Object=} context 195 * @param {?Object=} context
196 * @return {!Array.<!Object>} 196 * @return {!Array.<!Object>}
197 */ 197 */
198 instances: function(type, context) 198 instances: function(type, context)
199 { 199 {
200 /** 200 /**
201 * @param {!WebInspector.ModuleManager.Extension} extension 201 * @param {!WebInspector.ModuleManager.Extension} extension
202 * @return {?Object} 202 * @return {?Object}
203 */ 203 */
204 function instantiate(extension) 204 function instantiate(extension)
205 { 205 {
206 return extension.instance(); 206 return extension.instance();
207 } 207 }
208 return this.extensions(type, context).filter(instantiate).map(instantiat e); 208 return this.extensions(type, context).filter(instantiate).map(instantiat e);
209 }, 209 },
210 210
211 /** 211 /**
212 * @param {string|!Function} type 212 * @param {*} type
213 * @param {?Object=} context 213 * @param {?Object=} context
214 * @return {?Object} 214 * @return {?Object}
215 */ 215 */
216 instance: function(type, context) 216 instance: function(type, context)
217 { 217 {
218 var extension = this.extension(type, context); 218 var extension = this.extension(type, context);
219 return extension ? extension.instance() : null; 219 return extension ? extension.instance() : null;
220 }, 220 },
221 221
222 /** 222 /**
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 revealer.reveal(revealable, lineNumber); 477 revealer.reveal(revealable, lineNumber);
478 } 478 }
479 479
480 WebInspector.Revealer.prototype = { 480 WebInspector.Revealer.prototype = {
481 /** 481 /**
482 * @param {!Object} object 482 * @param {!Object} object
483 */ 483 */
484 reveal: function(object) {} 484 reveal: function(object) {}
485 } 485 }
486 486
487 WebInspector.moduleManager = new WebInspector.ModuleManager(allDescriptors); 487 /**
488 * @type {!WebInspector.ModuleManager}
489 */
490 WebInspector.moduleManager;
OLDNEW
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/common/Settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698