Commit 1156ebf8 authored by kinaba@chromium.org's avatar kinaba@chromium.org

Multi-Profile in Files.app: always mount per-profile "Downloads" folder.

Now the multi-profile feature is turned on by default.
Files.app also always mounts per-profile separated "Downloads"
folder even in the test environment.

BUG=375131

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272370 0039d316-1c4b-4281-b951-d872f2087c98
parent e7d9cc26
......@@ -6,7 +6,6 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/sys_info.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/login/users/user.h"
......@@ -33,12 +32,17 @@ const base::FilePath::CharType kBuggyDriveFolderPath[] =
} // namespace
base::FilePath GetDownloadsFolderForProfile(Profile* profile) {
if (!base::SysInfo::IsRunningOnChromeOS()) {
// On the developer run on Linux desktop build, use $HOME/Downloads for ease
// for accessing local files for debugging.
base::FilePath path;
CHECK(PathService::Get(base::DIR_HOME, &path));
return path.AppendASCII(kDownloadsFolderName);
// On non-ChromeOS system (test+development), the primary profile uses
// $HOME/Downloads for ease for accessing local files for debugging.
if (!base::SysInfo::IsRunningOnChromeOS() &&
chromeos::UserManager::IsInitialized()) {
const chromeos::User* const user =
chromeos::UserManager::Get()->GetUserByProfile(
profile->GetOriginalProfile());
const chromeos::User* const primary_user =
chromeos::UserManager::Get()->GetPrimaryUser();
if (user == primary_user)
return DownloadPrefs::GetDefaultDownloadDirectory();
}
return profile->GetPath().AppendASCII(kDownloadsFolderName);
}
......
......@@ -292,21 +292,15 @@ void VolumeManager::Initialize() {
new_path);
}
static bool added_downloads = false;
if (base::SysInfo::IsRunningOnChromeOS() || !added_downloads) {
// Register 'Downloads' folder for the profile to the file system.
// On non-ChromeOS system (test+development), we should do this only for
// the first registered profile.
const base::FilePath downloads =
file_manager::util::GetDownloadsFolderForProfile(profile_);
const bool success = RegisterDownloadsMountPoint(profile_, downloads);
added_downloads = success;
DCHECK(success);
DoMountEvent(chromeos::MOUNT_ERROR_NONE,
CreateDownloadsVolumeInfo(downloads),
kNotRemounting);
}
// Subscribe to DriveIntegrationService.
if (drive_integration_service_) {
......
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