#include "base/logging.h"
#include "base/sys_info.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
-#include "chrome/browser/chromeos/login/users/user.h"
-#include "chrome/browser/chromeos/login/users/user_manager.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/profiles/profile.h"
+#include "components/user_manager/user.h"
+#include "components/user_manager/user_manager.h"
#include "net/base/escape.h"
namespace file_manager {
// 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(
+ user_manager::UserManager::IsInitialized()) {
+ const user_manager::User* const user =
+ chromeos::ProfileHelper::Get()->GetUserByProfile(
profile->GetOriginalProfile());
- const chromeos::User* const primary_user =
- chromeos::UserManager::Get()->GetPrimaryUser();
+ const user_manager::User* const primary_user =
+ user_manager::UserManager::Get()->GetPrimaryUser();
if (user == primary_user)
return DownloadPrefs::GetDefaultDownloadDirectory();
}
// no-op when multi-profile is enabled. This is necessary for (1) back
// migration when multi-profile flag is enabled and then disabled, or (2) in
// some edge cases (crbug.com/356322) that u-<hash> path is temporarily used.
- if (chromeos::UserManager::IsInitialized()) {
- const chromeos::User* const user =
- chromeos::UserManager::Get()->GetUserByProfile(profile);
+ if (user_manager::UserManager::IsInitialized()) {
+ const user_manager::User* const user =
+ chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
if (user) {
const base::FilePath hashed_downloads =
chromeos::ProfileHelper::GetProfilePathByUserIdHash(
// to "Downloads". Note that some profiles (like login or test profiles)
// are not associated with an user account. In that case, no suffix is added
// because such a profile never belongs to a multi-profile session.
- chromeos::User* const user =
- chromeos::UserManager::IsInitialized() ?
- chromeos::UserManager::Get()->GetUserByProfile(
- profile->GetOriginalProfile()) : NULL;
+ user_manager::User* const user =
+ user_manager::UserManager::IsInitialized()
+ ? chromeos::ProfileHelper::Get()->GetUserByProfile(
+ profile->GetOriginalProfile())
+ : NULL;
const std::string id = user ? "-" + user->username_hash() : "";
- return net::EscapePath(kDownloadsFolderName + id);
+ return net::EscapeQueryParamValue(kDownloadsFolderName + id, false);
}
} // namespace util