Commit 81eb7caf authored by Sergei Datsenko's avatar Sergei Datsenko Committed by Commit Bot

Configure Drive's shortcuts virtual folder

BUG=b:148900751

Change-Id: I50cde41f63aa8b9bba2be609665ba48fb28ba083
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040499
Commit-Queue: Sergei Datsenko <dats@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738849}
parent b4b724f2
...@@ -400,6 +400,15 @@ class VolumeManagerImpl extends cr.EventTarget { ...@@ -400,6 +400,15 @@ class VolumeManagerImpl extends cr.EventTarget {
// read-write. // read-write.
isReadOnly = entry.fullPath.split('/').length < 4; isReadOnly = entry.fullPath.split('/').length < 4;
isRootEntry = entry.fullPath === '/.files-by-id'; isRootEntry = entry.fullPath === '/.files-by-id';
} else if (
entry.fullPath === '/.shortcut-targets-by-id' ||
entry.fullPath.indexOf('/.shortcut-targets-by-id/') === 0) {
rootType = VolumeManagerCommon.RootType.DRIVE_OTHER;
// /.shortcut-targets-by-id/<id> is read-only, but
// /.shortcut-targets-by-id/<id>/foo is read-write.
isReadOnly = entry.fullPath.split('/').length < 4;
isRootEntry = entry.fullPath === '/.shortcut-targets-by-id';
} else { } else {
// Accessing Drive files outside of /drive/root and /drive/other is not // Accessing Drive files outside of /drive/root and /drive/other is not
// allowed, but can happen. Therefore returning null. // allowed, but can happen. Therefore returning null.
......
...@@ -326,6 +326,33 @@ function testGetLocationInfo(callback) { ...@@ -326,6 +326,33 @@ function testGetLocationInfo(callback) {
assertFalse(driveFilesByIdLocationInfo.isReadOnly); assertFalse(driveFilesByIdLocationInfo.isReadOnly);
assertFalse(driveFilesByIdLocationInfo.isRootEntry); assertFalse(driveFilesByIdLocationInfo.isRootEntry);
const driveShortcutTargetsByIdDirectoryEntry =
MockDirectoryEntry.create(
new MockFileSystem('drive:drive-foobar%40chromium.org-hash'),
'/.shortcut-targets-by-id/abcdef');
const driveShortcutTargetsByIdDirectoryLocationInfo =
volumeManager.getLocationInfo(
driveShortcutTargetsByIdDirectoryEntry);
assertEquals(
VolumeManagerCommon.RootType.DRIVE_OTHER,
driveShortcutTargetsByIdDirectoryLocationInfo.rootType);
assertFalse(
driveShortcutTargetsByIdDirectoryLocationInfo.hasFixedLabel);
assertTrue(driveShortcutTargetsByIdDirectoryLocationInfo.isReadOnly);
assertFalse(driveShortcutTargetsByIdDirectoryLocationInfo.isRootEntry);
const driveShortcutTargetsByIdEntry = MockDirectoryEntry.create(
new MockFileSystem('drive:drive-foobar%40chromium.org-hash'),
'/.shortcut-targets-by-id/abcdef/foo');
const driveShortcutTargetsByIdLocationInfo =
volumeManager.getLocationInfo(driveShortcutTargetsByIdEntry);
assertEquals(
VolumeManagerCommon.RootType.DRIVE_OTHER,
driveShortcutTargetsByIdLocationInfo.rootType);
assertFalse(driveShortcutTargetsByIdLocationInfo.hasFixedLabel);
assertFalse(driveShortcutTargetsByIdLocationInfo.isReadOnly);
assertFalse(driveShortcutTargetsByIdLocationInfo.isRootEntry);
const androidRoot = const androidRoot =
MockFileEntry.create(new MockFileSystem('android_files:0'), '/'); MockFileEntry.create(new MockFileSystem('android_files:0'), '/');
const androidRootLocationInfo = const androidRootLocationInfo =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment