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

Unified Diff: ui/file_manager/file_manager/background/js/volume_manager_impl.js

Issue 2839863002: Add Team Drive subtree to the directory list view. (Closed)
Patch Set: Fix FileManagerJsTest.{NavigationListModelTest,ProvidersModel}. 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/background/js/volume_manager_impl.js
diff --git a/ui/file_manager/file_manager/background/js/volume_manager_impl.js b/ui/file_manager/file_manager/background/js/volume_manager_impl.js
index ff50e8a2edc9244eafc894b04640600797b353b6..6217a468f7879411069d1bf4cdd2e1f120d12c5c 100644
--- a/ui/file_manager/file_manager/background/js/volume_manager_impl.js
+++ b/ui/file_manager/file_manager/background/js/volume_manager_impl.js
@@ -296,8 +296,7 @@ VolumeManagerImpl.prototype.getLocationInfo = function(entry) {
if (util.isFakeEntry(entry)) {
return new EntryLocationImpl(
- volumeInfo,
- entry.rootType,
+ volumeInfo, entry.rootType, VolumeManagerCommon.EntryType.FAKE_ENTRY,
true /* the entry points a root directory. */,
true /* fake entries are read only. */);
}
@@ -305,18 +304,42 @@ VolumeManagerImpl.prototype.getLocationInfo = function(entry) {
var rootType;
var isReadOnly;
var isRootEntry;
+ var entryType = VolumeManagerCommon.EntryType.OTHER;
if (volumeInfo.volumeType === VolumeManagerCommon.VolumeType.DRIVE) {
- // For Drive, the roots are /root and /other, instead of /. Root URLs
- // contain trailing slashes.
+ // For Drive, the roots are /root, /team_drives and /other, instead of /.
+ // Root URLs contain trailing slashes.
if (entry.fullPath == '/root' || entry.fullPath.indexOf('/root/') === 0) {
rootType = VolumeManagerCommon.RootType.DRIVE;
isReadOnly = volumeInfo.isReadOnly;
isRootEntry = entry.fullPath === '/root';
+ if (entry.fullPath === '/root') {
+ entryType = VolumeManagerCommon.EntryType.VOLUME_ROOT;
+ }
+ } else if (
+ entry.fullPath == VolumeManagerCommon.TEAM_DRIVES_DIRECTORY_PATH ||
+ entry.fullPath.indexOf(
+ VolumeManagerCommon.TEAM_DRIVES_DIRECTORY_PATH + '/') === 0) {
+ rootType = VolumeManagerCommon.RootType.TEAM_DRIVES;
+ if (entry.fullPath == VolumeManagerCommon.TEAM_DRIVES_DIRECTORY_PATH) {
+ entryType = VolumeManagerCommon.EntryType.TEAM_DRIVES_GRAND_ROOT;
+ isReadOnly = true;
+ isRootEntry = true;
+ } else if (util.isTeamDriveRoot(entry)) {
+ entryType = VolumeManagerCommon.EntryType.TEAM_DRIVE_ROOT;
+ isReadOnly = false;
+ isRootEntry = true;
+ } else {
+ // Regular files/directories under Team Drives.
+ isRootEntry = false;
+ isReadOnly = volumeInfo.isReadOnly;
+ }
} else if (entry.fullPath == '/other' ||
entry.fullPath.indexOf('/other/') === 0) {
rootType = VolumeManagerCommon.RootType.DRIVE_OTHER;
isReadOnly = true;
isRootEntry = entry.fullPath === '/other';
+ if (isRootEntry)
+ entryType = VolumeManagerCommon.EntryType.VOLUME_ROOT;
} else {
// Accessing Drive files outside of /drive/root and /drive/other is not
// allowed, but can happen. Therefore returning null.
@@ -348,9 +371,12 @@ VolumeManagerImpl.prototype.getLocationInfo = function(entry) {
}
isReadOnly = volumeInfo.isReadOnly;
isRootEntry = util.isSameEntry(entry, volumeInfo.fileSystem.root);
+ if (isRootEntry)
+ entryType = VolumeManagerCommon.EntryType.VOLUME_ROOT;
}
- return new EntryLocationImpl(volumeInfo, rootType, isRootEntry, isReadOnly);
+ return new EntryLocationImpl(
+ volumeInfo, rootType, entryType, isRootEntry, isReadOnly);
};
/**

Powered by Google App Engine
This is Rietveld 408576698