| Index: third_party/WebKit/Source/devtools/front_end/workspace/Workspace.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/Workspace.js b/third_party/WebKit/Source/devtools/front_end/workspace/Workspace.js
|
| index 870cd8502e2cb91ecefe5c39ae79c536f062c265..114f5fde93b87369e0a796632f7bc3ca6e7d6315 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/workspace/Workspace.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/workspace/Workspace.js
|
| @@ -27,187 +27,188 @@
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
| -
|
| /**
|
| * @interface
|
| */
|
| WebInspector.ProjectSearchConfig = function() {};
|
|
|
| WebInspector.ProjectSearchConfig.prototype = {
|
| - /**
|
| - * @return {string}
|
| - */
|
| - query: function() { },
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - ignoreCase: function() { },
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - isRegex: function() { },
|
| -
|
| - /**
|
| - * @return {!Array.<string>}
|
| - */
|
| - queries: function() { },
|
| -
|
| - /**
|
| - * @param {string} filePath
|
| - * @return {boolean}
|
| - */
|
| - filePathMatchesFileQuery: function(filePath) { }
|
| + /**
|
| + * @return {string}
|
| + */
|
| + query: function() {},
|
| +
|
| + /**
|
| + * @return {boolean}
|
| + */
|
| + ignoreCase: function() {},
|
| +
|
| + /**
|
| + * @return {boolean}
|
| + */
|
| + isRegex: function() {},
|
| +
|
| + /**
|
| + * @return {!Array.<string>}
|
| + */
|
| + queries: function() {},
|
| +
|
| + /**
|
| + * @param {string} filePath
|
| + * @return {boolean}
|
| + */
|
| + filePathMatchesFileQuery: function(filePath) {}
|
| };
|
|
|
| /**
|
| * @interface
|
| */
|
| -WebInspector.Project = function() { };
|
| +WebInspector.Project = function() {};
|
|
|
| /**
|
| * @param {!WebInspector.Project} project
|
| * @return {boolean}
|
| */
|
| -WebInspector.Project.isServiceProject = function(project)
|
| -{
|
| - return project.type() === WebInspector.projectTypes.Debugger || project.type() === WebInspector.projectTypes.Formatter || project.type() === WebInspector.projectTypes.Service;
|
| +WebInspector.Project.isServiceProject = function(project) {
|
| + return project.type() === WebInspector.projectTypes.Debugger ||
|
| + project.type() === WebInspector.projectTypes.Formatter || project.type() === WebInspector.projectTypes.Service;
|
| };
|
|
|
| WebInspector.Project.prototype = {
|
| - /**
|
| - * @return {!WebInspector.Workspace}
|
| - */
|
| - workspace: function() { },
|
| -
|
| - /**
|
| - * @return {string}
|
| - */
|
| - id: function() { },
|
| -
|
| - /**
|
| - * @return {string}
|
| - */
|
| - type: function() { },
|
| -
|
| - /**
|
| - * @return {string}
|
| - */
|
| - displayName: function() { },
|
| -
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @return {!Promise<?WebInspector.UISourceCodeMetadata>}
|
| - */
|
| - requestMetadata: function(uiSourceCode) { },
|
| -
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @param {function(?string)} callback
|
| - */
|
| - requestFileContent: function(uiSourceCode, callback) { },
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - canSetFileContent: function() { },
|
| -
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @param {string} newContent
|
| - * @param {function(?string)} callback
|
| - */
|
| - setFileContent: function(uiSourceCode, newContent, callback) { },
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - canRename: function() { },
|
| -
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @param {string} newName
|
| - * @param {function(boolean, string=, string=, !WebInspector.ResourceType=)} callback
|
| - */
|
| - rename: function(uiSourceCode, newName, callback) { },
|
| -
|
| - /**
|
| - * @param {string} path
|
| - */
|
| - excludeFolder: function(path) { },
|
| -
|
| - /**
|
| - * @param {string} path
|
| - * @param {?string} name
|
| - * @param {string} content
|
| - * @param {function(?WebInspector.UISourceCode)} callback
|
| - */
|
| - createFile: function(path, name, content, callback) { },
|
| -
|
| - /**
|
| - * @param {string} path
|
| - */
|
| - deleteFile: function(path) { },
|
| -
|
| - remove: function() { },
|
| -
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @param {string} query
|
| - * @param {boolean} caseSensitive
|
| - * @param {boolean} isRegex
|
| - * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback
|
| - */
|
| - searchInFileContent: function(uiSourceCode, query, caseSensitive, isRegex, callback) { },
|
| -
|
| - /**
|
| - * @param {!WebInspector.ProjectSearchConfig} searchConfig
|
| - * @param {!Array.<string>} filesMathingFileQuery
|
| - * @param {!WebInspector.Progress} progress
|
| - * @param {function(!Array.<string>)} callback
|
| - */
|
| - findFilesMatchingSearchRequest: function(searchConfig, filesMathingFileQuery, progress, callback) { },
|
| -
|
| - /**
|
| - * @param {!WebInspector.Progress} progress
|
| - */
|
| - indexContent: function(progress) { },
|
| -
|
| - /**
|
| - * @param {string} url
|
| - * @return {?WebInspector.UISourceCode}
|
| - */
|
| - uiSourceCodeForURL: function(url) { },
|
| -
|
| - /**
|
| - * @return {!Array.<!WebInspector.UISourceCode>}
|
| - */
|
| - uiSourceCodes: function() { }
|
| + /**
|
| + * @return {!WebInspector.Workspace}
|
| + */
|
| + workspace: function() {},
|
| +
|
| + /**
|
| + * @return {string}
|
| + */
|
| + id: function() {},
|
| +
|
| + /**
|
| + * @return {string}
|
| + */
|
| + type: function() {},
|
| +
|
| + /**
|
| + * @return {string}
|
| + */
|
| + displayName: function() {},
|
| +
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @return {!Promise<?WebInspector.UISourceCodeMetadata>}
|
| + */
|
| + requestMetadata: function(uiSourceCode) {},
|
| +
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {function(?string)} callback
|
| + */
|
| + requestFileContent: function(uiSourceCode, callback) {},
|
| +
|
| + /**
|
| + * @return {boolean}
|
| + */
|
| + canSetFileContent: function() {},
|
| +
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {string} newContent
|
| + * @param {function(?string)} callback
|
| + */
|
| + setFileContent: function(uiSourceCode, newContent, callback) {},
|
| +
|
| + /**
|
| + * @return {boolean}
|
| + */
|
| + canRename: function() {},
|
| +
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {string} newName
|
| + * @param {function(boolean, string=, string=, !WebInspector.ResourceType=)} callback
|
| + */
|
| + rename: function(uiSourceCode, newName, callback) {},
|
| +
|
| + /**
|
| + * @param {string} path
|
| + */
|
| + excludeFolder: function(path) {},
|
| +
|
| + /**
|
| + * @param {string} path
|
| + * @param {?string} name
|
| + * @param {string} content
|
| + * @param {function(?WebInspector.UISourceCode)} callback
|
| + */
|
| + createFile: function(path, name, content, callback) {},
|
| +
|
| + /**
|
| + * @param {string} path
|
| + */
|
| + deleteFile: function(path) {},
|
| +
|
| + remove: function() {},
|
| +
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {string} query
|
| + * @param {boolean} caseSensitive
|
| + * @param {boolean} isRegex
|
| + * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback
|
| + */
|
| + searchInFileContent: function(uiSourceCode, query, caseSensitive, isRegex, callback) {},
|
| +
|
| + /**
|
| + * @param {!WebInspector.ProjectSearchConfig} searchConfig
|
| + * @param {!Array.<string>} filesMathingFileQuery
|
| + * @param {!WebInspector.Progress} progress
|
| + * @param {function(!Array.<string>)} callback
|
| + */
|
| + findFilesMatchingSearchRequest: function(searchConfig, filesMathingFileQuery, progress, callback) {},
|
| +
|
| + /**
|
| + * @param {!WebInspector.Progress} progress
|
| + */
|
| + indexContent: function(progress) {},
|
| +
|
| + /**
|
| + * @param {string} url
|
| + * @return {?WebInspector.UISourceCode}
|
| + */
|
| + uiSourceCodeForURL: function(url) {},
|
| +
|
| + /**
|
| + * @return {!Array.<!WebInspector.UISourceCode>}
|
| + */
|
| + uiSourceCodes: function() {}
|
| };
|
|
|
| /**
|
| * @enum {string}
|
| */
|
| WebInspector.projectTypes = {
|
| - Debugger: "debugger",
|
| - Formatter: "formatter",
|
| - Network: "network",
|
| - Snippets: "snippets",
|
| - FileSystem: "filesystem",
|
| - ContentScripts: "contentscripts",
|
| - Service: "service"
|
| + Debugger: 'debugger',
|
| + Formatter: 'formatter',
|
| + Network: 'network',
|
| + Snippets: 'snippets',
|
| + FileSystem: 'filesystem',
|
| + ContentScripts: 'contentscripts',
|
| + Service: 'service'
|
| };
|
|
|
| /**
|
| - * @constructor
|
| - * @param {!WebInspector.Workspace} workspace
|
| - * @param {string} id
|
| - * @param {!WebInspector.projectTypes} type
|
| - * @param {string} displayName
|
| + * @unrestricted
|
| */
|
| -WebInspector.ProjectStore = function(workspace, id, type, displayName)
|
| -{
|
| +WebInspector.ProjectStore = class {
|
| + /**
|
| + * @param {!WebInspector.Workspace} workspace
|
| + * @param {string} id
|
| + * @param {!WebInspector.projectTypes} type
|
| + * @param {string} displayName
|
| + */
|
| + constructor(workspace, id, type, displayName) {
|
| this._workspace = workspace;
|
| this._id = id;
|
| this._type = type;
|
| @@ -218,269 +219,243 @@ WebInspector.ProjectStore = function(workspace, id, type, displayName)
|
| /** @type {!Array.<!WebInspector.UISourceCode>} */
|
| this._uiSourceCodesList = [];
|
|
|
| - this._project = /** @type {!WebInspector.Project} */(this);
|
| -};
|
| -
|
| -WebInspector.ProjectStore.prototype = {
|
| - /**
|
| - * @return {string}
|
| - */
|
| - id: function()
|
| - {
|
| - return this._id;
|
| - },
|
| -
|
| - /**
|
| - * @return {string}
|
| - */
|
| - type: function()
|
| - {
|
| - return this._type;
|
| - },
|
| -
|
| - /**
|
| - * @return {string}
|
| - */
|
| - displayName: function()
|
| - {
|
| - return this._displayName;
|
| - },
|
| -
|
| - /**
|
| - * @return {!WebInspector.Workspace}
|
| - */
|
| - workspace: function()
|
| - {
|
| - return this._workspace;
|
| - },
|
| -
|
| - /**
|
| - * @param {string} url
|
| - * @param {!WebInspector.ResourceType} contentType
|
| - * @return {!WebInspector.UISourceCode}
|
| - */
|
| - createUISourceCode: function(url, contentType)
|
| - {
|
| - return new WebInspector.UISourceCode(this._project, url, contentType);
|
| - },
|
| -
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @param {boolean=} replace
|
| - * @return {boolean}
|
| - */
|
| - addUISourceCode: function(uiSourceCode, replace)
|
| - {
|
| - var url = uiSourceCode.url();
|
| - if (this.uiSourceCodeForURL(url)) {
|
| - if (replace)
|
| - this.removeUISourceCode(url);
|
| - else
|
| - return false;
|
| - }
|
| - this._uiSourceCodesMap.set(url, {uiSourceCode: uiSourceCode, index: this._uiSourceCodesList.length});
|
| - this._uiSourceCodesList.push(uiSourceCode);
|
| - this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeAdded, uiSourceCode);
|
| - return true;
|
| - },
|
| -
|
| - /**
|
| - * @param {string} url
|
| - */
|
| - removeUISourceCode: function(url)
|
| - {
|
| - var uiSourceCode = this.uiSourceCodeForURL(url);
|
| - if (!uiSourceCode)
|
| - return;
|
| -
|
| - var entry = this._uiSourceCodesMap.get(url);
|
| - var movedUISourceCode = this._uiSourceCodesList[this._uiSourceCodesList.length - 1];
|
| - this._uiSourceCodesList[entry.index] = movedUISourceCode;
|
| - var movedEntry = this._uiSourceCodesMap.get(movedUISourceCode.url());
|
| - movedEntry.index = entry.index;
|
| - this._uiSourceCodesList.splice(this._uiSourceCodesList.length - 1, 1);
|
| - this._uiSourceCodesMap.delete(url);
|
| - this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeRemoved, entry.uiSourceCode);
|
| - },
|
| -
|
| - removeProject: function()
|
| - {
|
| - this._workspace._removeProject(this._project);
|
| - this._uiSourceCodesMap = new Map();
|
| - this._uiSourceCodesList = [];
|
| - },
|
| -
|
| - /**
|
| - * @param {string} url
|
| - * @return {?WebInspector.UISourceCode}
|
| - */
|
| - uiSourceCodeForURL: function(url)
|
| - {
|
| - var entry = this._uiSourceCodesMap.get(url);
|
| - return entry ? entry.uiSourceCode : null;
|
| - },
|
| -
|
| - /**
|
| - * @return {!Array.<!WebInspector.UISourceCode>}
|
| - */
|
| - uiSourceCodes: function()
|
| - {
|
| - return this._uiSourceCodesList;
|
| - },
|
| -
|
| - /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @param {string} newName
|
| - */
|
| - renameUISourceCode: function(uiSourceCode, newName)
|
| - {
|
| - var oldPath = uiSourceCode.url();
|
| - var newPath = uiSourceCode.parentURL() ? uiSourceCode.parentURL() + "/" + newName : newName;
|
| - var value = /** @type {!{uiSourceCode: !WebInspector.UISourceCode, index: number}} */ (this._uiSourceCodesMap.get(oldPath));
|
| - this._uiSourceCodesMap.set(newPath, value);
|
| - this._uiSourceCodesMap.delete(oldPath);
|
| + this._project = /** @type {!WebInspector.Project} */ (this);
|
| + }
|
| +
|
| + /**
|
| + * @return {string}
|
| + */
|
| + id() {
|
| + return this._id;
|
| + }
|
| +
|
| + /**
|
| + * @return {string}
|
| + */
|
| + type() {
|
| + return this._type;
|
| + }
|
| +
|
| + /**
|
| + * @return {string}
|
| + */
|
| + displayName() {
|
| + return this._displayName;
|
| + }
|
| +
|
| + /**
|
| + * @return {!WebInspector.Workspace}
|
| + */
|
| + workspace() {
|
| + return this._workspace;
|
| + }
|
| +
|
| + /**
|
| + * @param {string} url
|
| + * @param {!WebInspector.ResourceType} contentType
|
| + * @return {!WebInspector.UISourceCode}
|
| + */
|
| + createUISourceCode(url, contentType) {
|
| + return new WebInspector.UISourceCode(this._project, url, contentType);
|
| + }
|
| +
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {boolean=} replace
|
| + * @return {boolean}
|
| + */
|
| + addUISourceCode(uiSourceCode, replace) {
|
| + var url = uiSourceCode.url();
|
| + if (this.uiSourceCodeForURL(url)) {
|
| + if (replace)
|
| + this.removeUISourceCode(url);
|
| + else
|
| + return false;
|
| }
|
| + this._uiSourceCodesMap.set(url, {uiSourceCode: uiSourceCode, index: this._uiSourceCodesList.length});
|
| + this._uiSourceCodesList.push(uiSourceCode);
|
| + this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeAdded, uiSourceCode);
|
| + return true;
|
| + }
|
| +
|
| + /**
|
| + * @param {string} url
|
| + */
|
| + removeUISourceCode(url) {
|
| + var uiSourceCode = this.uiSourceCodeForURL(url);
|
| + if (!uiSourceCode)
|
| + return;
|
| +
|
| + var entry = this._uiSourceCodesMap.get(url);
|
| + var movedUISourceCode = this._uiSourceCodesList[this._uiSourceCodesList.length - 1];
|
| + this._uiSourceCodesList[entry.index] = movedUISourceCode;
|
| + var movedEntry = this._uiSourceCodesMap.get(movedUISourceCode.url());
|
| + movedEntry.index = entry.index;
|
| + this._uiSourceCodesList.splice(this._uiSourceCodesList.length - 1, 1);
|
| + this._uiSourceCodesMap.delete(url);
|
| + this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeRemoved, entry.uiSourceCode);
|
| + }
|
| +
|
| + removeProject() {
|
| + this._workspace._removeProject(this._project);
|
| + this._uiSourceCodesMap = new Map();
|
| + this._uiSourceCodesList = [];
|
| + }
|
| +
|
| + /**
|
| + * @param {string} url
|
| + * @return {?WebInspector.UISourceCode}
|
| + */
|
| + uiSourceCodeForURL(url) {
|
| + var entry = this._uiSourceCodesMap.get(url);
|
| + return entry ? entry.uiSourceCode : null;
|
| + }
|
| +
|
| + /**
|
| + * @return {!Array.<!WebInspector.UISourceCode>}
|
| + */
|
| + uiSourceCodes() {
|
| + return this._uiSourceCodesList;
|
| + }
|
| +
|
| + /**
|
| + * @param {!WebInspector.UISourceCode} uiSourceCode
|
| + * @param {string} newName
|
| + */
|
| + renameUISourceCode(uiSourceCode, newName) {
|
| + var oldPath = uiSourceCode.url();
|
| + var newPath = uiSourceCode.parentURL() ? uiSourceCode.parentURL() + '/' + newName : newName;
|
| + var value =
|
| + /** @type {!{uiSourceCode: !WebInspector.UISourceCode, index: number}} */ (this._uiSourceCodesMap.get(oldPath));
|
| + this._uiSourceCodesMap.set(newPath, value);
|
| + this._uiSourceCodesMap.delete(oldPath);
|
| + }
|
| };
|
|
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.Object}
|
| + * @unrestricted
|
| */
|
| -WebInspector.Workspace = function()
|
| -{
|
| +WebInspector.Workspace = class extends WebInspector.Object {
|
| + constructor() {
|
| + super();
|
| /** @type {!Map<string, !WebInspector.Project>} */
|
| this._projects = new Map();
|
| this._hasResourceContentTrackingExtensions = false;
|
| + }
|
| +
|
| + /**
|
| + * @param {string} projectId
|
| + * @param {string} url
|
| + * @return {?WebInspector.UISourceCode}
|
| + */
|
| + uiSourceCode(projectId, url) {
|
| + var project = this._projects.get(projectId);
|
| + return project ? project.uiSourceCodeForURL(url) : null;
|
| + }
|
| +
|
| + /**
|
| + * @param {string} url
|
| + * @return {?WebInspector.UISourceCode}
|
| + */
|
| + uiSourceCodeForURL(url) {
|
| + for (var project of this._projects.values()) {
|
| + var uiSourceCode = project.uiSourceCodeForURL(url);
|
| + if (uiSourceCode)
|
| + return uiSourceCode;
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + /**
|
| + * @param {string} type
|
| + * @return {!Array.<!WebInspector.UISourceCode>}
|
| + */
|
| + uiSourceCodesForProjectType(type) {
|
| + var result = [];
|
| + for (var project of this._projects.values()) {
|
| + if (project.type() === type)
|
| + result = result.concat(project.uiSourceCodes());
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + /**
|
| + * @param {!WebInspector.Project} project
|
| + */
|
| + addProject(project) {
|
| + console.assert(!this._projects.has(project.id()), `A project with id ${project.id()} already exists!`);
|
| + this._projects.set(project.id(), project);
|
| + this.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectAdded, project);
|
| + }
|
| +
|
| + /**
|
| + * @param {!WebInspector.Project} project
|
| + */
|
| + _removeProject(project) {
|
| + this._projects.delete(project.id());
|
| + this.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectRemoved, project);
|
| + }
|
| +
|
| + /**
|
| + * @param {string} projectId
|
| + * @return {?WebInspector.Project}
|
| + */
|
| + project(projectId) {
|
| + return this._projects.get(projectId) || null;
|
| + }
|
| +
|
| + /**
|
| + * @return {!Array.<!WebInspector.Project>}
|
| + */
|
| + projects() {
|
| + return this._projects.valuesArray();
|
| + }
|
| +
|
| + /**
|
| + * @param {string} type
|
| + * @return {!Array.<!WebInspector.Project>}
|
| + */
|
| + projectsForType(type) {
|
| + function filterByType(project) {
|
| + return project.type() === type;
|
| + }
|
| + return this.projects().filter(filterByType);
|
| + }
|
| +
|
| + /**
|
| + * @return {!Array.<!WebInspector.UISourceCode>}
|
| + */
|
| + uiSourceCodes() {
|
| + var result = [];
|
| + for (var project of this._projects.values())
|
| + result = result.concat(project.uiSourceCodes());
|
| + return result;
|
| + }
|
| +
|
| + /**
|
| + * @param {boolean} hasExtensions
|
| + */
|
| + setHasResourceContentTrackingExtensions(hasExtensions) {
|
| + this._hasResourceContentTrackingExtensions = hasExtensions;
|
| + }
|
| +
|
| + /**
|
| + * @return {boolean}
|
| + */
|
| + hasResourceContentTrackingExtensions() {
|
| + return this._hasResourceContentTrackingExtensions;
|
| + }
|
| };
|
|
|
| /** @enum {symbol} */
|
| WebInspector.Workspace.Events = {
|
| - UISourceCodeAdded: Symbol("UISourceCodeAdded"),
|
| - UISourceCodeRemoved: Symbol("UISourceCodeRemoved"),
|
| - WorkingCopyChanged: Symbol("WorkingCopyChanged"),
|
| - WorkingCopyCommitted: Symbol("WorkingCopyCommitted"),
|
| - WorkingCopyCommittedByUser: Symbol("WorkingCopyCommittedByUser"),
|
| - ProjectAdded: Symbol("ProjectAdded"),
|
| - ProjectRemoved: Symbol("ProjectRemoved")
|
| -};
|
| -
|
| -WebInspector.Workspace.prototype = {
|
| - /**
|
| - * @param {string} projectId
|
| - * @param {string} url
|
| - * @return {?WebInspector.UISourceCode}
|
| - */
|
| - uiSourceCode: function(projectId, url)
|
| - {
|
| - var project = this._projects.get(projectId);
|
| - return project ? project.uiSourceCodeForURL(url) : null;
|
| - },
|
| -
|
| - /**
|
| - * @param {string} url
|
| - * @return {?WebInspector.UISourceCode}
|
| - */
|
| - uiSourceCodeForURL: function(url)
|
| - {
|
| - for (var project of this._projects.values()) {
|
| - var uiSourceCode = project.uiSourceCodeForURL(url);
|
| - if (uiSourceCode)
|
| - return uiSourceCode;
|
| - }
|
| - return null;
|
| - },
|
| -
|
| - /**
|
| - * @param {string} type
|
| - * @return {!Array.<!WebInspector.UISourceCode>}
|
| - */
|
| - uiSourceCodesForProjectType: function(type)
|
| - {
|
| - var result = [];
|
| - for (var project of this._projects.values()) {
|
| - if (project.type() === type)
|
| - result = result.concat(project.uiSourceCodes());
|
| - }
|
| - return result;
|
| - },
|
| -
|
| - /**
|
| - * @param {!WebInspector.Project} project
|
| - */
|
| - addProject: function(project)
|
| - {
|
| - console.assert(!this._projects.has(project.id()), `A project with id ${project.id()} already exists!`);
|
| - this._projects.set(project.id(), project);
|
| - this.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectAdded, project);
|
| - },
|
| -
|
| - /**
|
| - * @param {!WebInspector.Project} project
|
| - */
|
| - _removeProject: function(project)
|
| - {
|
| - this._projects.delete(project.id());
|
| - this.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectRemoved, project);
|
| - },
|
| -
|
| - /**
|
| - * @param {string} projectId
|
| - * @return {?WebInspector.Project}
|
| - */
|
| - project: function(projectId)
|
| - {
|
| - return this._projects.get(projectId) || null;
|
| - },
|
| -
|
| - /**
|
| - * @return {!Array.<!WebInspector.Project>}
|
| - */
|
| - projects: function()
|
| - {
|
| - return this._projects.valuesArray();
|
| - },
|
| -
|
| - /**
|
| - * @param {string} type
|
| - * @return {!Array.<!WebInspector.Project>}
|
| - */
|
| - projectsForType: function(type)
|
| - {
|
| - function filterByType(project)
|
| - {
|
| - return project.type() === type;
|
| - }
|
| - return this.projects().filter(filterByType);
|
| - },
|
| -
|
| - /**
|
| - * @return {!Array.<!WebInspector.UISourceCode>}
|
| - */
|
| - uiSourceCodes: function()
|
| - {
|
| - var result = [];
|
| - for (var project of this._projects.values())
|
| - result = result.concat(project.uiSourceCodes());
|
| - return result;
|
| - },
|
| -
|
| - /**
|
| - * @param {boolean} hasExtensions
|
| - */
|
| - setHasResourceContentTrackingExtensions: function(hasExtensions)
|
| - {
|
| - this._hasResourceContentTrackingExtensions = hasExtensions;
|
| - },
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - hasResourceContentTrackingExtensions: function()
|
| - {
|
| - return this._hasResourceContentTrackingExtensions;
|
| - },
|
| -
|
| - __proto__: WebInspector.Object.prototype
|
| + UISourceCodeAdded: Symbol('UISourceCodeAdded'),
|
| + UISourceCodeRemoved: Symbol('UISourceCodeRemoved'),
|
| + WorkingCopyChanged: Symbol('WorkingCopyChanged'),
|
| + WorkingCopyCommitted: Symbol('WorkingCopyCommitted'),
|
| + WorkingCopyCommittedByUser: Symbol('WorkingCopyCommittedByUser'),
|
| + ProjectAdded: Symbol('ProjectAdded'),
|
| + ProjectRemoved: Symbol('ProjectRemoved')
|
| };
|
|
|
| /**
|
|
|