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

Unified Diff: chrome/browser/ui/browser_list.cc

Issue 8937001: Fixes for the kWasRestarted pref. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test build fix. Created 9 years 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/ui/browser_list.cc
diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc
index d1bc58ae02d5419cb919e47a15fd6f510693fe1b..de3db752e66d1f92c9328897384577386aca16a5 100644
--- a/chrome/browser/ui/browser_list.cc
+++ b/chrome/browser/ui/browser_list.cc
@@ -302,9 +302,7 @@ void BrowserList::MarkAsCleanShutdown() {
}
}
-void BrowserList::AttemptExitInternal(bool restart) {
- PrefService* pref_service = g_browser_process->local_state();
- pref_service->SetBoolean(prefs::kWasRestarted, restart);
+void BrowserList::AttemptExitInternal() {
content::NotificationService::current()->Notify(
content::NOTIFICATION_APP_EXITING,
content::NotificationService::AllSources(),
@@ -481,7 +479,7 @@ void BrowserList::CloseAllBrowsersWithProfile(Profile* profile) {
}
// static
-void BrowserList::AttemptUserExit(bool restart) {
+void BrowserList::AttemptUserExit() {
#if defined(OS_CHROMEOS)
chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false);
// Write /tmp/uptime-logout-started as well.
@@ -508,7 +506,7 @@ void BrowserList::AttemptUserExit(bool restart) {
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false);
#endif
- AttemptExitInternal(restart);
+ AttemptExitInternal();
}
// static
@@ -520,28 +518,31 @@ void BrowserList::AttemptRestart() {
(*it)->profile()->SaveSessionState();
}
+ PrefService* pref_service = g_browser_process->local_state();
+ pref_service->SetBoolean(prefs::kWasRestarted, true);
+ pref_service->ScheduleSavePersistentPrefs();
+
#if defined(OS_CHROMEOS)
// For CrOS instead of browser restart (which is not supported) perform a full
// sign out. Session will be only restored if user has that setting set.
// Same session restore behavior happens in case of full restart after update.
- AttemptUserExit(true);
+ AttemptUserExit();
#else
// Set the flag to restore state after the restart.
- PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true);
- AttemptExit(true);
+ AttemptExit();
#endif
}
// static
-void BrowserList::AttemptExit(bool restart) {
+void BrowserList::AttemptExit() {
// If we know that all browsers can be closed without blocking,
// don't notify users of crashes beyond this point.
// Note that MarkAsCleanShutdown does not set UMA's exit cleanly bit
// so crashes during shutdown are still reported in UMA.
if (AreAllBrowsersCloseable())
MarkAsCleanShutdown();
- AttemptExitInternal(restart);
+ AttemptExitInternal();
}
#if defined(OS_CHROMEOS)
@@ -557,7 +558,7 @@ void BrowserList::ExitCleanly() {
// screen locker.
if (!AreAllBrowsersCloseable())
browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION);
- AttemptExitInternal(false);
+ AttemptExitInternal();
}
#endif

Powered by Google App Engine
This is Rietveld 408576698