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

Unified Diff: chrome/browser/profiles/profile_impl.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/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 30c73a5822f240339cc5ee61bd71d2964f562ea8..f8c4cb20d62bf320f2644152a5c3b214c72ce34a 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -167,6 +167,24 @@ FilePath GetMediaCachePath(const FilePath& base) {
return base.Append(chrome::kMediaCacheDirname);
}
+void SaveSessionStateOnIOThread(
+ net::URLRequestContextGetter* url_request_context_getter) {
+ url_request_context_getter->GetURLRequestContext()->cookie_store()->
+ GetCookieMonster()->SaveSessionCookies();
+}
+
+void RestoreSessionStateOnIOThread(
+ net::URLRequestContextGetter* url_request_context_getter) {
+ url_request_context_getter->GetURLRequestContext()->cookie_store()->
+ GetCookieMonster()->RestoreOldSessionCookies();
+}
+
+void DiscardSessionStateOnIOThread(
+ net::URLRequestContextGetter* url_request_context_getter) {
+ url_request_context_getter->GetURLRequestContext()->cookie_store()->
+ GetCookieMonster()->DiscardOldSessionCookies();
+}
+
} // namespace
// static
@@ -1551,6 +1569,27 @@ NetworkActionPredictor* ProfileImpl::GetNetworkActionPredictor() {
return network_action_predictor_.get();
}
+void ProfileImpl::SaveSessionState() {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&SaveSessionStateOnIOThread,
+ make_scoped_refptr(GetRequestContext())));
+}
+
+void ProfileImpl::RestoreSessionState() {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&RestoreSessionStateOnIOThread,
+ make_scoped_refptr(GetRequestContext())));
+}
+
+void ProfileImpl::DiscardSessionState() {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&DiscardSessionStateOnIOThread,
+ make_scoped_refptr(GetRequestContext())));
+}
+
SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() {
if (!spellcheck_profile_.get())
spellcheck_profile_.reset(new SpellCheckProfile(path_));

Powered by Google App Engine
This is Rietveld 408576698