Commit 9f0dcec1 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Fix Google Drive display paths shown in settings page

Currently paths are shown as:
 Google Drive > ...
 Team Drives > ...
 Computers > ...

This change sets all Google Drives paths to prefix with 'Google Drive'
and adds 'My Drive' for paths in /root.  'Google Drive' is not
localized.  The 'My Drive', 'Team Drives' and 'Computers' labels are.

 Google Drive > My Drive > ...
 Google Drive > Team Drives > ...
 Google Drive > Computers > ...

Bug: 879425
Change-Id: I502dbae82af575a91744abad4a7e98ba15ad8a69
Reviewed-on: https://chromium-review.googlesource.com/c/1304275
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603436}
parent e04f2604
...@@ -418,21 +418,28 @@ std::string GetPathDisplayTextForSettings(Profile* profile, ...@@ -418,21 +418,28 @@ std::string GetPathDisplayTextForSettings(Profile* profile,
drive_integration_service->GetMountPointPath() drive_integration_service->GetMountPointPath()
.Append(kRootRelativeToDriveMount) .Append(kRootRelativeToDriveMount)
.value(), .value(),
kGoogleDriveDisplayName)) { base::FilePath(kGoogleDriveDisplayName)
.Append(l10n_util::GetStringUTF8(
IDS_FILE_BROWSER_DRIVE_MY_DRIVE_LABEL))
.value())) {
} else if (drive_integration_service && } else if (drive_integration_service &&
ReplacePrefix(&result, ReplacePrefix(&result,
drive_integration_service->GetMountPointPath() drive_integration_service->GetMountPointPath()
.Append(kTeamDrivesRelativeToDriveMount) .Append(kTeamDrivesRelativeToDriveMount)
.value(), .value(),
l10n_util::GetStringUTF8( base::FilePath(kGoogleDriveDisplayName)
IDS_FILE_BROWSER_DRIVE_TEAM_DRIVES_LABEL))) { .Append(l10n_util::GetStringUTF8(
IDS_FILE_BROWSER_DRIVE_TEAM_DRIVES_LABEL))
.value())) {
} else if (drive_integration_service && } else if (drive_integration_service &&
ReplacePrefix(&result, ReplacePrefix(&result,
drive_integration_service->GetMountPointPath() drive_integration_service->GetMountPointPath()
.Append(kComputersRelativeToDriveMount) .Append(kComputersRelativeToDriveMount)
.value(), .value(),
l10n_util::GetStringUTF8( base::FilePath(kGoogleDriveDisplayName)
IDS_FILE_BROWSER_DRIVE_COMPUTERS_LABEL))) { .Append(l10n_util::GetStringUTF8(
IDS_FILE_BROWSER_DRIVE_COMPUTERS_LABEL))
.value())) {
} else if (ReplacePrefix(&result, kAndroidFilesPath, } else if (ReplacePrefix(&result, kAndroidFilesPath,
l10n_util::GetStringUTF8( l10n_util::GetStringUTF8(
IDS_FILE_BROWSER_ANDROID_FILES_ROOT_LABEL))) { IDS_FILE_BROWSER_ANDROID_FILES_ROOT_LABEL))) {
......
...@@ -138,17 +138,17 @@ TEST(FileManagerPathUtilTest, GetPathDisplayTextForSettings) { ...@@ -138,17 +138,17 @@ TEST(FileManagerPathUtilTest, GetPathDisplayTextForSettings) {
base::test::ScopedFeatureList features; base::test::ScopedFeatureList features;
features.InitAndDisableFeature(chromeos::features::kDriveFs); features.InitAndDisableFeature(chromeos::features::kDriveFs);
drive::DriveIntegrationServiceFactory::GetForProfile(&profile); drive::DriveIntegrationServiceFactory::GetForProfile(&profile);
EXPECT_EQ("Google Drive \u203a foo", EXPECT_EQ("Google Drive \u203a My Drive \u203a foo",
GetPathDisplayTextForSettings( GetPathDisplayTextForSettings(
&profile, "/special/drive-0123456789abcdef/root/foo")); &profile, "/special/drive-0123456789abcdef/root/foo"));
EXPECT_EQ( EXPECT_EQ(
"Team Drives \u203a A Team Drive \u203a foo", "Google Drive \u203a Team Drives \u203a A Team Drive \u203a foo",
GetPathDisplayTextForSettings( GetPathDisplayTextForSettings(
&profile, &profile,
"/special/drive-0123456789abcdef/team_drives/A Team Drive/foo")); "/special/drive-0123456789abcdef/team_drives/A Team Drive/foo"));
EXPECT_EQ( EXPECT_EQ(
"Computers \u203a My Other Computer \u203a bar", "Google Drive \u203a Computers \u203a My Other Computer \u203a bar",
GetPathDisplayTextForSettings( GetPathDisplayTextForSettings(
&profile, &profile,
"/special/drive-0123456789abcdef/Computers/My Other Computer/bar")); "/special/drive-0123456789abcdef/Computers/My Other Computer/bar"));
...@@ -167,16 +167,17 @@ TEST(FileManagerPathUtilTest, GetPathDisplayTextForSettings) { ...@@ -167,16 +167,17 @@ TEST(FileManagerPathUtilTest, GetPathDisplayTextForSettings) {
drive::DriveIntegrationServiceFactory::GetForProfile(&profile2); drive::DriveIntegrationServiceFactory::GetForProfile(&profile2);
EXPECT_EQ( EXPECT_EQ(
"Google Drive \u203a foo", "Google Drive \u203a My Drive \u203a foo",
GetPathDisplayTextForSettings( GetPathDisplayTextForSettings(
&profile2, &profile2,
"/media/fuse/drivefs-84675c855b63e12f384d45f033826980/root/foo")); "/media/fuse/drivefs-84675c855b63e12f384d45f033826980/root/foo"));
EXPECT_EQ("Team Drives \u203a A Team Drive \u203a foo", EXPECT_EQ("Google Drive \u203a Team Drives \u203a A Team Drive \u203a foo",
GetPathDisplayTextForSettings( GetPathDisplayTextForSettings(
&profile2, &profile2,
"/media/fuse/drivefs-84675c855b63e12f384d45f033826980/" "/media/fuse/drivefs-84675c855b63e12f384d45f033826980/"
"team_drives/A Team Drive/foo")); "team_drives/A Team Drive/foo"));
EXPECT_EQ("Computers \u203a My Other Computer \u203a bar", EXPECT_EQ(
"Google Drive \u203a Computers \u203a My Other Computer \u203a bar",
GetPathDisplayTextForSettings( GetPathDisplayTextForSettings(
&profile2, &profile2,
"/media/fuse/drivefs-84675c855b63e12f384d45f033826980/" "/media/fuse/drivefs-84675c855b63e12f384d45f033826980/"
......
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