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

Unified Diff: chrome/browser/profiles/profile_manager.cc

Issue 1773113002: Fixed a few places that incorrectly assumed that profile was initialized (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment Created 4 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 | « chrome/browser/extensions/extension_garbage_collector_chromeos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index a5de32353bfd31510a41fb5424bf5be5538b831b..a47d7fd8f5c69e9ad1ae1d2cc6b0ad308a2b8b19 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -514,13 +514,21 @@ Profile* ProfileManager::GetLastUsedProfile(
profile_dir = chromeos::ProfileHelper::Get()->GetActiveUserProfileDir();
base::FilePath profile_path(user_data_dir);
- Profile* profile = GetProfile(profile_path.Append(profile_dir));
+ Profile* profile = GetProfileByPath(profile_path.Append(profile_dir));
+ // If we get here, it means the user has logged in but the profile has not
+ // finished initializing, so treat the user as not having logged in.
+ if (!profile) {
+ DLOG(WARNING) << "Calling GetLastUsedProfile() before profile "
+ << "initialization is completed. Returning login profile.";
+ return GetActiveUserOrOffTheRecordProfileFromPath(user_data_dir);
+ }
return profile->IsGuestSession() ? profile->GetOffTheRecordProfile() :
profile;
}
-#endif
+#else
return GetProfile(GetLastUsedProfileDir(user_data_dir));
+#endif
}
base::FilePath ProfileManager::GetLastUsedProfileDir(
« no previous file with comments | « chrome/browser/extensions/extension_garbage_collector_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698