Chromium Code Reviews| Index: chrome/browser/chrome_browser_main.cc |
| diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc |
| index fb5034032e2085bdb551bd929c5420f4eb78b692..01c1521cf7396f827ec2d05d616825dc1d85acc4 100644 |
| --- a/chrome/browser/chrome_browser_main.cc |
| +++ b/chrome/browser/chrome_browser_main.cc |
| @@ -353,13 +353,22 @@ Profile* CreatePrimaryProfile(const content::MainFunctionParams& parameters, |
| #else |
| base::FilePath profile_path = |
| GetStartupProfilePath(user_data_dir, parsed_command_line); |
| + ProfileInfoCache& cache = |
|
Mike Lerman
2015/03/31 20:48:30
nit: Can this be a const ProfileInfoCache&?
noms (inactive)
2015/03/31 21:01:33
Done.
|
| + g_browser_process->profile_manager()->GetProfileInfoCache(); |
| // Without NewAvatarMenu, replace guest with any existing profile. |
| if (!switches::IsNewAvatarMenu() && |
| profile_path == ProfileManager::GetGuestProfilePath()) { |
| - profile_path = g_browser_process->profile_manager()->GetProfileInfoCache(). |
| - GetPathOfProfileAtIndex(0); |
| + profile_path = cache.GetPathOfProfileAtIndex(0); |
| } |
| + |
| + // If we are trying to load a profile that has been deleted (for example from |
| + // an old shortcut, or using an incorrect kProfileDirectory argument), set |
| + // the active profile to Guest to force showing the User Manager. |
| + size_t profile_index = cache.GetIndexOfProfileWithPath(profile_path); |
| + if (profile_index == std::string::npos) |
|
Mike Lerman
2015/03/31 20:48:30
We need to make sure that those folks who have dis
noms (inactive)
2015/03/31 21:01:33
Ughhhhh that's a weird result now, though (but you
|
| + profile_path = ProfileManager::GetGuestProfilePath(); |
| + |
| profile = g_browser_process->profile_manager()->GetProfile( |
| profile_path); |
| @@ -370,10 +379,6 @@ Profile* CreatePrimaryProfile(const content::MainFunctionParams& parameters, |
| if (switches::IsNewProfileManagement() && |
| profile && |
| !profile->IsGuestSession()) { |
| - ProfileInfoCache& cache = |
| - g_browser_process->profile_manager()->GetProfileInfoCache(); |
| - size_t profile_index = cache.GetIndexOfProfileWithPath(profile_path); |
| - |
| if (profile_index != std::string::npos && |
|
Mike Lerman
2015/03/31 20:48:30
We can remove the profile_index != std::string::np
noms (inactive)
2015/03/31 21:01:33
Done.
|
| cache.ProfileIsSigninRequiredAtIndex(profile_index)) { |
| profile = g_browser_process->profile_manager()->GetProfile( |