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

Unified Diff: chrome/browser/resources/file_manager/common/js/util.js

Issue 179553008: Simplify volume manager in Files app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 10 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: chrome/browser/resources/file_manager/common/js/util.js
diff --git a/chrome/browser/resources/file_manager/common/js/util.js b/chrome/browser/resources/file_manager/common/js/util.js
index 4818170ee32ae53844b4d4a50570170c9363376d..5632e976cae45a3f8a3105adf1e20667649c2cf5 100644
--- a/chrome/browser/resources/file_manager/common/js/util.js
+++ b/chrome/browser/resources/file_manager/common/js/util.js
@@ -1079,10 +1079,26 @@ util.UserDOMError.prototype = {
* directory. Returns true if both entries are null.
*/
util.isSameEntry = function(entry1, entry2) {
- // Currently, we can assume there is only one root.
- // When we support multi-file system, we need to look at filesystem, too.
- return (entry1 && entry2 && entry1.toURL() === entry2.toURL()) ||
- (!entry1 && !entry2);
+ if (!entry1 && !entry2)
+ return true;
+ if (!entry1 || !entry2)
+ return false;
+ return entry1.toURL() === entry2.toURL();
+};
+
+/**
+ * Compares two file systems.
+ * @param {DOMFileSystem} fileSystem1 The file system to be compared.
+ * @param {DOMFileSystem} fileSystem2 The file system to be compared.
+ * @return {boolean} True if the both file systems are equal. Also, returns true
+ * if both file systems are null.
+ */
+util.isSameFileSystem = function(fileSystem1, fileSystem2) {
+ if (!fileSystem1 && !fileSystem2)
+ return true;
+ if (!fileSystem1 || !fileSystem2)
+ return false;
+ return util.isSameEntry(fileSystem1.root, fileSystem2.root);
};
/**

Powered by Google App Engine
This is Rietveld 408576698