| Index: chrome/browser/profiles/profile_manager.cc
|
| diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
|
| index 9e25b1da6fc2a62e0f0631b42bdd39c25148c619..e5985b9f39ff3e968b5262bc82bc8e07cba76ad8 100644
|
| --- a/chrome/browser/profiles/profile_manager.cc
|
| +++ b/chrome/browser/profiles/profile_manager.cc
|
| @@ -83,6 +83,7 @@
|
| #include "chrome/browser/chromeos/login/user.h"
|
| #include "chrome/browser/chromeos/login/user_manager.h"
|
| #include "chrome/browser/chromeos/profiles/profile_helper.h"
|
| +#include "chrome/browser/profiles/profiles_state.h"
|
| #include "chromeos/chromeos_switches.h"
|
| #include "chromeos/dbus/cryptohome_client.h"
|
| #include "chromeos/dbus/dbus_thread_manager.h"
|
| @@ -326,11 +327,12 @@ Profile* ProfileManager::GetPrimaryUserProfile() {
|
| Profile* ProfileManager::GetActiveUserProfile() {
|
| ProfileManager* profile_manager = g_browser_process->profile_manager();
|
| #if defined(OS_CHROMEOS)
|
| - if (!chromeos::UserManager::IsMultipleProfilesAllowed() ||
|
| - !profile_manager->IsLoggedIn() ||
|
| - !chromeos::UserManager::IsInitialized())
|
| + if (!profile_manager->IsLoggedIn() ||
|
| + !chromeos::UserManager::IsInitialized()) {
|
| return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath(
|
| profile_manager->user_data_dir());
|
| + }
|
| +
|
| chromeos::UserManager* manager = chromeos::UserManager::Get();
|
| const chromeos::User* user = manager->GetActiveUser();
|
| // To avoid an endless loop (crbug.com/334098) we have to additionally check
|
| @@ -454,20 +456,13 @@ base::FilePath ProfileManager::GetInitialProfileDir() {
|
| // by default. http://crbug.com/294628
|
| profile_dir = chromeos::ProfileHelper::
|
| GetProfileDirByLegacyLoginProfileSwitch();
|
| - } else if (!command_line.HasSwitch(switches::kMultiProfiles)) {
|
| - // We should never be logged in with no profile dir unless
|
| - // multi-profiles are enabled.
|
| - // In that case profile dir will be defined by user_id hash.
|
| - NOTREACHED();
|
| - return base::FilePath("");
|
| }
|
| // In case of multi-profiles ignore --login-profile switch.
|
| // TODO(nkostylev): Some cases like Guest mode will have empty username_hash
|
| // so default kLoginProfile dir will be used.
|
| std::string user_id_hash = g_browser_process->platform_part()->
|
| profile_helper()->active_user_id_hash();
|
| - if (command_line.HasSwitch(switches::kMultiProfiles) &&
|
| - !user_id_hash.empty()) {
|
| + if (!user_id_hash.empty()) {
|
| profile_dir = g_browser_process->platform_part()->
|
| profile_helper()->GetActiveUserProfileDir();
|
| }
|
| @@ -491,20 +486,12 @@ Profile* ProfileManager::GetLastUsedProfile(
|
| // CrOS multi-profiles implementation is different so GetLastUsedProfile
|
| // has custom implementation too.
|
| base::FilePath profile_dir;
|
| - const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| - if (command_line.HasSwitch(switches::kMultiProfiles)) {
|
| - // In case of multi-profiles we ignore "last used profile" preference
|
| - // since it may refer to profile that has been in use in previous session.
|
| - // That profile dir may not be mounted in this session so instead return
|
| - // active profile from current session.
|
| - profile_dir = g_browser_process->platform_part()->
|
| - profile_helper()->GetActiveUserProfileDir();
|
| - } else {
|
| - // For legacy (not multi-profiles) implementation always default to
|
| - // --login-profile value.
|
| - profile_dir =
|
| - chromeos::ProfileHelper::GetProfileDirByLegacyLoginProfileSwitch();
|
| - }
|
| + // In case of multi-profiles we ignore "last used profile" preference
|
| + // since it may refer to profile that has been in use in previous session.
|
| + // That profile dir may not be mounted in this session so instead return
|
| + // active profile from current session.
|
| + profile_dir = g_browser_process->platform_part()->
|
| + profile_helper()->GetActiveUserProfileDir();
|
|
|
| base::FilePath profile_path(user_data_dir);
|
| Profile* profile = GetProfile(profile_path.Append(profile_dir));
|
|
|