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

Unified Diff: net/base/cookie_monster.h

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: net/base/cookie_monster.h
diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h
index 6d590921b0e4413f4260956c665334a0289d48c6..0c03813ca27dfdff97522bfdff098176d53c8870 100644
--- a/net/base/cookie_monster.h
+++ b/net/base/cookie_monster.h
@@ -275,6 +275,18 @@ class NET_EXPORT CookieMonster : public CookieStore {
virtual CookieMonster* GetCookieMonster() OVERRIDE;
+ // Enables writing session cookies into the cookie database.
+ void SetPersistSessionCookies(bool persist_session_cookies);
+
+ // Protects session cookies from deletion on shutdown.
+ void SaveSessionCookies();
+
+ // Merges restored session cookies with other cookies.
+ void RestoreOldSessionCookies();
+
+ // Discards restored session cookies.
+ void DiscardOldSessionCookies();
+
// Debugging method to perform various validation checks on the map.
// Currently just checking that there are no null CanonicalCookie pointers
// in the map.
@@ -352,6 +364,10 @@ class NET_EXPORT CookieMonster : public CookieStore {
// already-expired expiration date. This captures that case.
DELETE_COOKIE_EXPIRED_OVERWRITE,
+ // Old session cookies can be explicitly deleted, and they also get
+ // automatically deleted when trying to read / write them.
+ DELETE_COOKIE_OLD_SESSION_COOKIE,
+
DELETE_COOKIE_LAST_ENTRY
};
@@ -517,7 +533,8 @@ class NET_EXPORT CookieMonster : public CookieStore {
// Takes ownership of *cc.
void InternalInsertCookie(const std::string& key,
CanonicalCookie* cc,
- bool sync_to_store);
+ bool sync_to_store,
+ bool notify);
// Helper function that sets cookies with more control.
// Not exposed as we don't want callers to have the ability
@@ -673,6 +690,19 @@ class NET_EXPORT CookieMonster : public CookieStore {
base::Time last_statistic_record_time_;
bool keep_expired_cookies_;
+ bool persist_session_cookies_;
+
+ // Describes what to do with old session cookies.
+ enum SessionCookieBehavior {
+ // Keep old session cookies separate, don't return them when cookies are
+ // read.
+ SESSION_COOKIES_UNDECIDED,
+ // Merge old session cookies in and treat them as normal cookies.
+ SESSION_COOKIES_MERGE,
+ // Discard old session cookies.
+ SESSION_COOKIES_DELETE
+ };
+ SessionCookieBehavior old_session_cookie_behavior_;
static bool enable_file_scheme_;
@@ -755,6 +785,14 @@ class NET_EXPORT CookieMonster::CanonicalCookie {
return has_expires_ && current >= expiry_date_;
}
+ bool IsOldSessionCookie() const {
+ return is_old_session_cookie_;
+ }
+
+ void SetIsOldSessionCookie(bool is_old_session_cookie) {
+ is_old_session_cookie_ = is_old_session_cookie;
+ }
+
// Are the cookies considered equivalent in the eyes of RFC 2965.
// The RFC says that name must match (case-sensitive), domain must
// match (case insensitive), and path must match (case sensitive).
@@ -809,6 +847,7 @@ class NET_EXPORT CookieMonster::CanonicalCookie {
bool httponly_;
bool has_expires_;
bool is_persistent_;
+ bool is_old_session_cookie_;
};
class CookieMonster::Delegate
@@ -984,6 +1023,8 @@ class CookieMonster::PersistentCookieStore
// Flush the store and post the given Task when complete.
virtual void Flush(Task* completion_task) = 0;
+ virtual void DeleteSessionCookies() = 0;
+
protected:
PersistentCookieStore() {}

Powered by Google App Engine
This is Rietveld 408576698