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

Unified Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 1815853002: cros: Flush profile files at critical moments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits and create test files to fix trybots 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
Index: chrome/browser/chromeos/login/session/user_session_manager.cc
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc
index 62797795a5d7f8920c5f65478da4ae47e75db461..710e3659c5970bf46774c09bb96bcca51d4966e5 100644
--- a/chrome/browser/chromeos/login/session/user_session_manager.cc
+++ b/chrome/browser/chromeos/login/session/user_session_manager.cc
@@ -801,6 +801,11 @@ void UserSessionManager::OnSessionRestoreStateChanged(
// We need to restart cleanly in this case to make sure OAuth2 RT is
// actually saved.
chrome::AttemptRestart();
+ } else {
+ // Schedule another flush after session restore for non-ephemeral profile
+ // if not restarting.
+ if (!ProfileHelper::IsEphemeralUserProfile(user_profile))
+ ProfileHelper::Get()->FlushProfile(user_profile);
}
}
@@ -1175,6 +1180,10 @@ void UserSessionManager::FinalizePrepareProfile(Profile* profile) {
// If needed, create browser observer to display first run OOBE Goodies page.
first_run::GoodiesDisplayer::Init();
+ // Schedule a flush if profile is not ephemeral.
+ if (!ProfileHelper::IsEphemeralUserProfile(profile))
+ ProfileHelper::Get()->FlushProfile(profile);
+
// TODO(nkostylev): This pointer should probably never be NULL, but it looks
// like OnProfileCreated() may be getting called before
// UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | chrome/browser/chromeos/profiles/profile_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698