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

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

Issue 8745015: Store the "browser autorestarted, last session must be restored" information in a preference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix (browser_tests). 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
« no previous file with comments | « chrome/browser/ui/browser_list.h ('k') | chrome/browser/upgrade_detector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_list.cc
diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc
index 3ce3e514977fe7c12975d2d54f620dfebc2dfbf1..8c7fd14dad6b87e0c2cdbb5fcf3f33e29e4b52f6 100644
--- a/chrome/browser/ui/browser_list.cc
+++ b/chrome/browser/ui/browser_list.cc
@@ -302,7 +302,9 @@ void BrowserList::MarkAsCleanShutdown() {
}
}
-void BrowserList::AttemptExitInternal() {
+void BrowserList::AttemptExitInternal(bool restart) {
+ PrefService* pref_service = g_browser_process->local_state();
+ pref_service->SetBoolean(prefs::kWasRestarted, restart);
content::NotificationService::current()->Notify(
content::NOTIFICATION_APP_EXITING,
content::NotificationService::AllSources(),
@@ -479,7 +481,7 @@ void BrowserList::CloseAllBrowsersWithProfile(Profile* profile) {
}
// static
-void BrowserList::AttemptUserExit() {
+void BrowserList::AttemptUserExit(bool restart) {
#if defined(OS_CHROMEOS)
chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false);
// Write /tmp/uptime-logout-started as well.
@@ -506,7 +508,7 @@ void BrowserList::AttemptUserExit() {
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false);
#endif
- AttemptExitInternal();
+ AttemptExitInternal(restart);
}
// static
@@ -522,24 +524,24 @@ void BrowserList::AttemptRestart() {
// 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();
+ AttemptUserExit(true);
#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();
+ AttemptExit(true);
#endif
}
// static
-void BrowserList::AttemptExit() {
+void BrowserList::AttemptExit(bool restart) {
// 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();
+ AttemptExitInternal(restart);
}
#if defined(OS_CHROMEOS)
« no previous file with comments | « chrome/browser/ui/browser_list.h ('k') | chrome/browser/upgrade_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698