| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.ProjectStore} | 33 * @extends {WebInspector.ProjectStore} |
| 34 * @implements {WebInspector.Project} | 34 * @implements {WebInspector.Project} |
| 35 * @param {!WebInspector.Workspace} workspace | 35 * @param {!WebInspector.Workspace} workspace |
| 36 * @param {string} id | 36 * @param {string} id |
| 37 * @param {!WebInspector.projectTypes} type | 37 * @param {!WebInspector.projectTypes} type |
| 38 * @param {string} url | |
| 39 * @param {string} displayName | 38 * @param {string} displayName |
| 40 */ | 39 */ |
| 41 WebInspector.ContentProviderBasedProject = function(workspace, id, type, url, di
splayName) | 40 WebInspector.ContentProviderBasedProject = function(workspace, id, type, display
Name) |
| 42 { | 41 { |
| 43 WebInspector.ProjectStore.call(this, workspace, id, type, url, displayName); | 42 WebInspector.ProjectStore.call(this, workspace, id, type, displayName); |
| 44 /** @type {!Object.<string, !WebInspector.ContentProvider>} */ | 43 /** @type {!Object.<string, !WebInspector.ContentProvider>} */ |
| 45 this._contentProviders = {}; | 44 this._contentProviders = {}; |
| 46 workspace.addProject(this); | 45 workspace.addProject(this); |
| 47 } | 46 } |
| 48 | 47 |
| 49 WebInspector.ContentProviderBasedProject.prototype = { | 48 WebInspector.ContentProviderBasedProject.prototype = { |
| 50 /** | 49 /** |
| 51 * @override | 50 * @override |
| 52 * @param {!WebInspector.UISourceCode} uiSourceCode | 51 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 53 * @param {function(?string)} callback | 52 * @param {function(?string)} callback |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 * @param {!WebInspector.UISourceCode} uiSourceCode | 287 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 289 * @param {!WebInspector.ContentProvider} contentProvider | 288 * @param {!WebInspector.ContentProvider} contentProvider |
| 290 */ | 289 */ |
| 291 addUISourceCodeWithProvider: function(uiSourceCode, contentProvider) | 290 addUISourceCodeWithProvider: function(uiSourceCode, contentProvider) |
| 292 { | 291 { |
| 293 this._contentProviders[uiSourceCode.path()] = contentProvider; | 292 this._contentProviders[uiSourceCode.path()] = contentProvider; |
| 294 this.addUISourceCode(uiSourceCode, true); | 293 this.addUISourceCode(uiSourceCode, true); |
| 295 }, | 294 }, |
| 296 | 295 |
| 297 /** | 296 /** |
| 298 * @param {string} parentPath | 297 * @param {string} url |
| 299 * @param {string} name | |
| 300 * @param {string} originURL | |
| 301 * @param {!WebInspector.ContentProvider} contentProvider | 298 * @param {!WebInspector.ContentProvider} contentProvider |
| 302 * @return {!WebInspector.UISourceCode} | 299 * @return {!WebInspector.UISourceCode} |
| 303 */ | 300 */ |
| 304 addContentProvider: function(parentPath, name, originURL, contentProvider) | 301 addContentProvider: function(url, contentProvider) |
| 305 { | 302 { |
| 306 var uiSourceCode = this.createUISourceCode(parentPath, name, originURL,
contentProvider.contentType()); | 303 var uiSourceCode = this.createUISourceCode(url, contentProvider.contentT
ype()); |
| 307 this.addUISourceCodeWithProvider(uiSourceCode, contentProvider); | 304 this.addUISourceCodeWithProvider(uiSourceCode, contentProvider); |
| 308 return uiSourceCode; | 305 return uiSourceCode; |
| 309 }, | 306 }, |
| 310 | 307 |
| 311 /** | 308 /** |
| 312 * @param {string} path | 309 * @param {string} path |
| 313 */ | 310 */ |
| 314 removeFile: function(path) | 311 removeFile: function(path) |
| 315 { | 312 { |
| 316 delete this._contentProviders[path]; | 313 delete this._contentProviders[path]; |
| 317 this.removeUISourceCode(path); | 314 this.removeUISourceCode(path); |
| 318 }, | 315 }, |
| 319 | 316 |
| 320 reset: function() | 317 reset: function() |
| 321 { | 318 { |
| 322 this._contentProviders = {}; | 319 this._contentProviders = {}; |
| 323 this.removeProject(); | 320 this.removeProject(); |
| 324 this.workspace().addProject(this); | 321 this.workspace().addProject(this); |
| 325 }, | 322 }, |
| 326 | 323 |
| 327 dispose: function() | 324 dispose: function() |
| 328 { | 325 { |
| 329 this._contentProviders = {}; | 326 this._contentProviders = {}; |
| 330 this.removeProject(); | 327 this.removeProject(); |
| 331 }, | 328 }, |
| 332 | 329 |
| 333 __proto__: WebInspector.ProjectStore.prototype | 330 __proto__: WebInspector.ProjectStore.prototype |
| 334 } | 331 } |
| OLD | NEW |