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

Unified Diff: third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js

Issue 1369063002: DevTools: merge excluded folder manager into isolated file system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js
diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js b/third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js
index 8f5f211c7e3a5694f74038b54b4133bee3c69323..32591b7b4774ae4f6212f7f614faec0c34057d8e 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js
@@ -40,6 +40,8 @@ WebInspector.IsolatedFileSystem = function(manager, path, name, rootURL)
this._manager = manager;
this._path = path;
this._domFileSystem = InspectorFrontendHost.isolatedFileSystem(name, rootURL);
+ this._excludedFoldersSetting = WebInspector.settings.createLocalSetting("workspaceExcludedFolders", {});
+ this._excludedFolders = this._excludedFoldersSetting.get()[path] || [];
dgozman 2015/09/26 01:46:41 Note that you modify setting value in place with a
}
/**
@@ -101,12 +103,12 @@ WebInspector.IsolatedFileSystem.prototype = {
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
if (!entry.isDirectory) {
- if (this._manager.excludedFolderManager().isFileExcluded(this._path, entry.fullPath))
+ if (this._isFileExcluded(entry.fullPath))
continue;
fileCallback(entry.fullPath.substr(1));
}
else {
- if (this._manager.excludedFolderManager().isFileExcluded(this._path, entry.fullPath + "/"))
+ if (this._isFileExcluded(entry.fullPath + "/"))
continue;
++pendingRequests;
this._requestEntries(entry.fullPath, innerCallback.bind(this));
@@ -487,5 +489,61 @@ WebInspector.IsolatedFileSystem.prototype = {
console.error(errorMessage + " when requesting entry '" + path + "'");
callback([]);
}
+ },
+
+ _saveExcludedFolders: function()
+ {
+ var settingValue = this._excludedFoldersSetting.get();
+ settingValue[this._path] = this._excludedFolders;
+ this._excludedFoldersSetting.set(settingValue);
+ },
+
+ /**
+ * @param {string} path
+ */
+ addExcludedFolder: function(path)
+ {
+ this._excludedFolders.push(path);
+ this._saveExcludedFolders();
+ this._manager.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.ExcludedFolderAdded, path);
+ },
+
+ /**
+ * @param {string} path
+ */
+ removeExcludedFolder: function(path)
+ {
+ this._excludedFolders.remove(path);
+ this._saveExcludedFolders();
+ this._manager.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.ExcludedFolderRemoved, path);
+ },
+
+ fileSystemRemoved: function()
+ {
+ var settingValue = this._excludedFoldersSetting.get();
+ delete settingValue[this._path];
+ this._excludedFoldersSetting.set(settingValue);
+ },
+
+ /**
+ * @param {string} folderPath
+ * @return {boolean}
+ */
+ _isFileExcluded: function(folderPath)
+ {
+ for (var i = 0; i < this._excludedFolders.length; ++i) {
+ if (this._excludedFolders[i] === folderPath)
+ return true;
+ }
+ var regex = this._manager.workspaceFolderExcludePatternSetting().asRegExp();
+ return !!(regex && regex.test(folderPath));
+ },
+
+ /**
+ * @return {!Array<string>}
+ */
+ excludedFolders: function()
+ {
+ return this._excludedFolders.slice();
}
}

Powered by Google App Engine
This is Rietveld 408576698