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

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

Issue 2918203002: cros: Fix loading user profile w/o UserSessionManager (Closed)
Patch Set: fix tests, round 2 Created 3 years, 6 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
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 5f2317b7c992597829e7e6a8f91f739b4878e8ca..8244b6d48b609e114d7ba691ba134f6923db6e06 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -487,6 +487,13 @@ Profile* ProfileManager::GetActiveUserProfile() {
return profile;
}
+// static
+Profile* ProfileManager::CreateInitialProfile() {
+ ProfileManager* const profile_manager = g_browser_process->profile_manager();
+ return profile_manager->GetProfile(profile_manager->user_data_dir().Append(
+ profile_manager->GetInitialProfileDir()));
+}
+
Profile* ProfileManager::GetProfile(const base::FilePath& profile_dir) {
TRACE_EVENT0("browser", "ProfileManager::GetProfile");
@@ -633,8 +640,8 @@ Profile* ProfileManager::GetLastUsedProfile(
// 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.";
+ LOG(WARNING) << "Calling GetLastUsedProfile() before profile "
+ << "initialization is completed. Returning login profile.";
return GetActiveUserOrOffTheRecordProfileFromPath(user_data_dir);
}
return profile->IsGuestSession() ? profile->GetOffTheRecordProfile() :
@@ -1328,9 +1335,9 @@ Profile* ProfileManager::GetActiveUserOrOffTheRecordProfileFromPath(
default_profile_dir = default_profile_dir.Append(GetInitialProfileDir());
ProfileInfo* profile_info = GetProfileInfoByPath(default_profile_dir);
- // Fallback to default off-the-record profile, if user profile has not fully
- // loaded yet.
- if (profile_info && !profile_info->created)
+ // Fallback to default off-the-record profile, if user profile is not loaded
+ // or has not fully loaded yet.
emaxx 2017/06/08 19:43:54 nit: "not loaded or has not fully loaded" sounds l
xiyuan 2017/06/08 20:30:40 Changed to "is not started loading or has not full
+ if (!profile_info || !profile_info->created)
default_profile_dir = profiles::GetDefaultProfileDir(user_data_dir);
Profile* profile = GetProfile(default_profile_dir);

Powered by Google App Engine
This is Rietveld 408576698