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

Unified Diff: ui/file_manager/file_manager/common/js/util.js

Issue 2839863002: Add Team Drive subtree to the directory list view. (Closed)
Patch Set: Remove some unncecesary code Created 3 years, 8 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: ui/file_manager/file_manager/common/js/util.js
diff --git a/ui/file_manager/file_manager/common/js/util.js b/ui/file_manager/file_manager/common/js/util.js
index fe46d0d10ae0bfea81b6ece64b34ac068548e49d..747b4edc1d5902f3d9f22b60ff949cb8a7a504de 100644
--- a/ui/file_manager/file_manager/common/js/util.js
+++ b/ui/file_manager/file_manager/common/js/util.js
@@ -633,6 +633,31 @@ util.isFakeEntry = function(entry) {
};
/**
+ * Obtains whether an entry is the root directory of a Team Drive.
+ * @param {(!Entry|!FakeEntry)} entry Entry or a fake entry.
+ * @return {boolean} True if the given entry is root of a Team Drive.
+ */
+util.isTeamDriveRoot = function(entry) {
+ if (!entry.fullPath)
+ return false;
+ var tree = entry.fullPath.split('/');
+ return tree.length == 3 && util.isTeamDriveEntry(entry);
+};
+
+/**
+ * Obtains whether an entry is descendant of the Team Drives directory.
+ * @param {(!Entry|!FakeEntry)} entry Entry or a fake entry.
+ * @return {boolean} True if the given entry is under Team Drives.
+ */
+util.isTeamDriveEntry = function(entry) {
+ if (!entry.fullPath)
+ return false;
+ var tree = entry.fullPath.split('/');
+ return tree[0] == '' &&
+ tree[1] == VolumeManagerCommon.TEAM_DRIVES_DIRECTORY_NAME;
+};
+
+/**
* Creates an instance of UserDOMError with given error name that looks like a
* FileError except that it does not have the deprecated FileError.code member.
*
@@ -956,6 +981,8 @@ util.getRootTypeLabel = function(locationInfo) {
return str('DOWNLOADS_DIRECTORY_LABEL');
case VolumeManagerCommon.RootType.DRIVE:
return str('DRIVE_MY_DRIVE_LABEL');
+ case VolumeManagerCommon.RootType.TEAM_DRIVES_GRAND_ROOT:
+ return str('DRIVE_TEAM_DRIVES_LABEL');
case VolumeManagerCommon.RootType.DRIVE_OFFLINE:
return str('DRIVE_OFFLINE_COLLECTION_LABEL');
case VolumeManagerCommon.RootType.DRIVE_SHARED_WITH_ME:
@@ -986,7 +1013,7 @@ util.getRootTypeLabel = function(locationInfo) {
console.error('Unsupported root type: ' + locationInfo.rootType);
return locationInfo.volumeInfo.label;
}
-}
+};
/**
* Returns the localized name of the entry.
@@ -996,7 +1023,7 @@ util.getRootTypeLabel = function(locationInfo) {
* @return {?string} The localized name.
*/
util.getEntryLabel = function(locationInfo, entry) {
- if (locationInfo && locationInfo.isRootEntry)
+ if (locationInfo && locationInfo.hasFixedLabel)
return util.getRootTypeLabel(locationInfo);
else
return entry.name;

Powered by Google App Engine
This is Rietveld 408576698