diff options
| author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-05 16:29:58 +0000 |
|---|---|---|
| committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-05 16:29:58 +0000 |
| commit | 88c887847a7e19356adccb1b94cc79712343ca93 (patch) | |
| tree | eff0f67cd3e24ccaf2d7310f73eaed3035a5cd32 /chrome/browser/ui/browser_list.cc | |
| parent | a995d04ab4c452670e4b14d83182ccea49aad41b (diff) | |
| download | chromium_src-88c887847a7e19356adccb1b94cc79712343ca93.zip chromium_src-88c887847a7e19356adccb1b94cc79712343ca93.tar.gz chromium_src-88c887847a7e19356adccb1b94cc79712343ca93.tar.bz2 | |
Store the "browser autorestarted, last session must be restored" information in a preference.
This way ChromiumOS can run the same session restore code as Chrome.
BUG=1870
TEST=NONE
Review URL: http://codereview.chromium.org/8745015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_list.cc')
| -rw-r--r-- | chrome/browser/ui/browser_list.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc index 3ce3e51..8c7fd14 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) |
