Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 1042923003: Fail gracefully when starting Chrome with an invalid kProfileDirectory. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix indent Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/profiles/profiles_state.cc » ('j') | chrome/browser/profiles/profiles_state.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « no previous file | chrome/browser/profiles/profiles_state.cc » ('j') | chrome/browser/profiles/profiles_state.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698