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

Unified Diff: chrome/browser/sessions/session_restore.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: Cleanup. 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/sessions/session_restore.cc
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index eefb94b3061820883afdbaf5e61a2077856b3287..9f7d13ab148cbc984bf435d8a87c873b0b85018d 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -406,12 +406,14 @@ class SessionRestoreImpl : public content::NotificationObserver {
bool synchronous,
bool clobber_existing_tab,
bool always_create_tabbed_browser,
+ bool restore_session_state,
const std::vector<GURL>& urls_to_open)
: profile_(profile),
browser_(browser),
synchronous_(synchronous),
clobber_existing_tab_(clobber_existing_tab),
always_create_tabbed_browser_(always_create_tabbed_browser),
+ restore_session_state_(restore_session_state),
urls_to_open_(urls_to_open),
restore_started_(base::TimeTicks::Now()) {
// When asynchronous its possible for there to be no windows. To make sure
@@ -424,6 +426,9 @@ class SessionRestoreImpl : public content::NotificationObserver {
SessionService* session_service =
SessionServiceFactory::GetForProfile(profile_);
DCHECK(session_service);
+
+ session_service->RestoreOrResetSessionState(restore_session_state_);
+
SessionService::SessionCallback* callback =
NewCallback(this, &SessionRestoreImpl::OnGotSession);
session_service->GetLastSession(&request_consumer_, callback);
@@ -788,6 +793,9 @@ class SessionRestoreImpl : public content::NotificationObserver {
// at least one window is created.
const bool always_create_tabbed_browser_;
+ // See description of RESTORE_SESSION_STATE.
+ const bool restore_session_state_;
+
// Set of URLs to open in addition to those restored from the session.
std::vector<GURL> urls_to_open_;
@@ -837,6 +845,7 @@ Browser* SessionRestore::RestoreSession(Profile* profile,
profile, browser, (behavior & SYNCHRONOUS) != 0,
(behavior & CLOBBER_CURRENT_TAB) != 0,
(behavior & ALWAYS_CREATE_TABBED_BROWSER) != 0,
+ (behavior & RESTORE_SESSION_STATE) != 0,
urls_to_open);
return restorer->Restore();
}
@@ -849,7 +858,7 @@ void SessionRestore::RestoreForeignSessionWindows(
// Create a SessionRestore object to eventually restore the tabs.
std::vector<GURL> gurls;
SessionRestoreImpl restorer(profile,
- static_cast<Browser*>(NULL), true, false, true, gurls);
+ static_cast<Browser*>(NULL), true, false, true, false, gurls);
restorer.RestoreForeignSession(begin, end);
}
@@ -859,7 +868,7 @@ void SessionRestore::RestoreForeignSessionTab(Profile* profile,
// Create a SessionRestore object to eventually restore the tabs.
std::vector<GURL> gurls;
SessionRestoreImpl restorer(profile,
- static_cast<Browser*>(NULL), true, false, true, gurls);
+ static_cast<Browser*>(NULL), true, false, true, false, gurls);
restorer.RestoreForeignTab(tab);
}

Powered by Google App Engine
This is Rietveld 408576698