Commit 9d6b7a21 authored by kinaba@chromium.org's avatar kinaba@chromium.org

Switch "Downloads" directory path to the per-profile ones for multi-profile support.

All migration code has already landed. This is the final CL that carries out the switch.
By this CL, Files.app in multi-profile session starts showing each profile's Downloads folder,
not the primary profile's one. This is a transient state for the future fully-multiprofile-aware
Files.app (ETA: M34) that shows all profile's folder in a single window.

The following is the summary/background why the path switch is needed:

We had used /home/chronos/user/Download as the path to the "Downloads" folder for all users.
This does not hold for multi-profile session. The "real" path for multiple users are
/home/chronos/u-unique-hash-userA/Downloads
/home/chronos/u-unique-hash-userB/Downloads
...
and /home/chronos/user is just an alias to the user who first signed into the session.

To make all user's folder available simultaneously in one multi-profile session,
we need to stop using the alias, and differentiate all folders by the real path.

BUG=309556

Review URL: https://codereview.chromium.org/48903012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243794 0039d316-1c4b-4281-b951-d872f2087c98
parent c514acf5
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/sys_info.h"
#include "chrome/browser/chromeos/drive/file_system_util.h" #include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/profiles/profile.h"
namespace file_manager { namespace file_manager {
namespace util { namespace util {
...@@ -17,14 +19,15 @@ const base::FilePath::CharType kOldDownloadsFolderPath[] = ...@@ -17,14 +19,15 @@ const base::FilePath::CharType kOldDownloadsFolderPath[] =
FILE_PATH_LITERAL("/home/chronos/user/Downloads"); FILE_PATH_LITERAL("/home/chronos/user/Downloads");
base::FilePath GetDownloadsFolderForProfile(Profile* profile) { base::FilePath GetDownloadsFolderForProfile(Profile* profile) {
// TODO(kinaba) crbug/309556: "Downloads" directory should be per-profile. if (!base::SysInfo::IsRunningOnChromeOS()) {
// // On the developer run on Linux desktop build, user $HOME/Downloads
// For this to be per-profile, a unique directory path from profile->GetPath() // for ease for accessing local files for debugging.
// should be used rather than the HOME directory. We'll switch to the new path base::FilePath path;
// once we have upgraded all code locations assuming the old path. CHECK(PathService::Get(base::DIR_HOME, &path));
base::FilePath path; return path.AppendASCII(kDownloadsFolderName);
CHECK(PathService::Get(base::DIR_HOME, &path)); }
return path.AppendASCII(kDownloadsFolderName);
return profile->GetPath().AppendASCII(kDownloadsFolderName);
} }
bool MigratePathFromOldFormat(Profile* profile, bool MigratePathFromOldFormat(Profile* profile,
......
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