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

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

Issue 8533013: SessionRestore: Store session cookies and restore them if chrome crashes or auto-restarts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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 daaead65e414840c0c2c728f111c15a82183655a..e8a42eb88310dfbb4b28f8329e3719d39bbd666e 100644
--- a/chrome/browser/ui/browser_list.cc
+++ b/chrome/browser/ui/browser_list.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/browser_list.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
@@ -14,10 +15,12 @@
#include "chrome/browser/metrics/thread_watcher.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/printing/background_printing_manager.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "content/browser/tab_contents/navigation_details.h"
#include "content/public/browser/notification_registrar.h"
@@ -507,12 +510,20 @@ void BrowserList::AttemptUserExit() {
// static
void BrowserList::AttemptRestart() {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableRestoreSessionState)) {
+ BrowserVector::const_iterator it;
+ for (it = begin(); it != end(); ++it) {
+ (*it)->profile()->SaveSessionState();
+ }
+ }
erikwright (departed) 2011/11/29 13:43:22 Add a blank line.
marja 2011/11/29 14:58:21 Done.
#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();
#else
+
erikwright (departed) 2011/11/29 13:43:22 Remove blank line.
marja 2011/11/29 14:58:21 Done.
// Set the flag to restore state after the restart.
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true);

Powered by Google App Engine
This is Rietveld 408576698