| 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 20 matching lines...) Expand all Loading... |
| 31 /** | 31 /** |
| 32 * @implements {Workspace.Project} | 32 * @implements {Workspace.Project} |
| 33 * @unrestricted | 33 * @unrestricted |
| 34 */ | 34 */ |
| 35 Bindings.ContentProviderBasedProject = class extends Workspace.ProjectStore { | 35 Bindings.ContentProviderBasedProject = class extends Workspace.ProjectStore { |
| 36 /** | 36 /** |
| 37 * @param {!Workspace.Workspace} workspace | 37 * @param {!Workspace.Workspace} workspace |
| 38 * @param {string} id | 38 * @param {string} id |
| 39 * @param {!Workspace.projectTypes} type | 39 * @param {!Workspace.projectTypes} type |
| 40 * @param {string} displayName | 40 * @param {string} displayName |
| 41 * @param {boolean} isServiceProject |
| 41 */ | 42 */ |
| 42 constructor(workspace, id, type, displayName) { | 43 constructor(workspace, id, type, displayName, isServiceProject) { |
| 43 super(workspace, id, type, displayName); | 44 super(workspace, id, type, displayName); |
| 44 /** @type {!Object.<string, !Common.ContentProvider>} */ | 45 /** @type {!Object.<string, !Common.ContentProvider>} */ |
| 45 this._contentProviders = {}; | 46 this._contentProviders = {}; |
| 47 this._isServiceProject = isServiceProject; |
| 46 workspace.addProject(this); | 48 workspace.addProject(this); |
| 47 } | 49 } |
| 48 | 50 |
| 49 /** | 51 /** |
| 50 * @override | 52 * @override |
| 51 * @param {!Workspace.UISourceCode} uiSourceCode | 53 * @param {!Workspace.UISourceCode} uiSourceCode |
| 52 * @param {function(?string)} callback | 54 * @param {function(?string)} callback |
| 53 */ | 55 */ |
| 54 requestFileContent(uiSourceCode, callback) { | 56 requestFileContent(uiSourceCode, callback) { |
| 55 var contentProvider = this._contentProviders[uiSourceCode.url()]; | 57 var contentProvider = this._contentProviders[uiSourceCode.url()]; |
| 56 contentProvider.requestContent().then(callback); | 58 contentProvider.requestContent().then(callback); |
| 57 } | 59 } |
| 58 | 60 |
| 59 /** | 61 /** |
| 60 * @override | 62 * @override |
| 63 * @return {boolean} |
| 64 */ |
| 65 isServiceProject() { |
| 66 return this._isServiceProject; |
| 67 } |
| 68 |
| 69 /** |
| 70 * @override |
| 61 * @param {!Workspace.UISourceCode} uiSourceCode | 71 * @param {!Workspace.UISourceCode} uiSourceCode |
| 62 * @return {!Promise<?Workspace.UISourceCodeMetadata>} | 72 * @return {!Promise<?Workspace.UISourceCodeMetadata>} |
| 63 */ | 73 */ |
| 64 requestMetadata(uiSourceCode) { | 74 requestMetadata(uiSourceCode) { |
| 65 return Promise.resolve(uiSourceCode[Bindings.ContentProviderBasedProject._me
tadata]); | 75 return Promise.resolve(uiSourceCode[Bindings.ContentProviderBasedProject._me
tadata]); |
| 66 } | 76 } |
| 67 | 77 |
| 68 /** | 78 /** |
| 69 * @override | 79 * @override |
| 70 * @return {boolean} | 80 * @return {boolean} |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 this.workspace().addProject(this); | 299 this.workspace().addProject(this); |
| 290 } | 300 } |
| 291 | 301 |
| 292 dispose() { | 302 dispose() { |
| 293 this._contentProviders = {}; | 303 this._contentProviders = {}; |
| 294 this.removeProject(); | 304 this.removeProject(); |
| 295 } | 305 } |
| 296 }; | 306 }; |
| 297 | 307 |
| 298 Bindings.ContentProviderBasedProject._metadata = Symbol('ContentProviderBasedPro
ject.Metadata'); | 308 Bindings.ContentProviderBasedProject._metadata = Symbol('ContentProviderBasedPro
ject.Metadata'); |
| OLD | NEW |