Index: net/cookies/cookie_monster.h |
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h |
index 79f1bbff6e07156912b6f31d556ca82a13346634..b0f76fceb5c7bcaa2a61c185ca0317e73068fb0f 100644 |
--- a/net/cookies/cookie_monster.h |
+++ b/net/cookies/cookie_monster.h |
@@ -234,6 +234,14 @@ class NET_EXPORT CookieMonster : public CookieStore { |
// to the thread you actually want to be notified on. |
void FlushStore(const base::Closure& callback); |
+ // Replaces all the cookies by |list|. |
+ // This method does not flush the backend, and does not update the creation |
+ // time nor the last access time: if a cookie in |list| already exists in the |
+ // cookie monster with a different time, the cookie is left untouched in the |
+ // cookie monster. |
droger
2015/03/12 15:50:29
I don't know if this behavior w.r.t. creation time
erikwright (departed)
2015/03/13 13:59:01
Presumably the rationale for not needing to update
droger
2015/03/13 15:10:47
Some context: on iOS when a WebView is attached to
|
+ void SetAllCookiesAsync(const CookieList& list, |
+ const SetCookiesCallback& callback); |
+ |
// CookieStore implementation. |
// Sets the cookies specified by |cookie_list| returned from |url| |
@@ -322,6 +330,7 @@ class NET_EXPORT CookieMonster : public CookieStore { |
class GetAllCookiesForURLWithOptionsTask; |
class GetAllCookiesTask; |
class GetCookiesWithOptionsTask; |
+ class SetAllCookiesTask; |
class SetCookieWithDetailsTask; |
class SetCookieWithOptionsTask; |
class DeleteSessionCookiesTask; |
@@ -350,6 +359,9 @@ class NET_EXPORT CookieMonster : public CookieStore { |
// For FindCookiesForKey. |
FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, ShortLivedSessionCookies); |
+ // For ComputeCookieDiff. |
+ FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, ComputeCookieDiff); |
+ |
// Internal reasons for deletion, used to populate informative histograms |
// and to provide a public cause for onCookieChange notifications. |
// |
@@ -544,6 +556,9 @@ class NET_EXPORT CookieMonster : public CookieStore { |
const base::Time& creation_time, |
const CookieOptions& options); |
+ // Helper function calling SetCanonicalCookie() for all cookies in |list|. |
+ bool SetCanonicalCookies(const CookieList& list); |
+ |
void InternalUpdateCookieAccessTime(CanonicalCookie* cc, |
const base::Time& current_time); |
@@ -608,6 +623,18 @@ class NET_EXPORT CookieMonster : public CookieStore { |
void DoCookieTaskForURL(const scoped_refptr<CookieMonsterTask>& task_item, |
const GURL& url); |
+ // Computes the difference between |old_cookies| and |new_cookies|, and writes |
+ // the result in |cookies_to_add| and |cookies_to_delete|. |
+ // This function has the side effect of changing the order of |old_cookies| |
+ // and |new_cookies|. |cookies_to_add| and |cookies_to_delete| must be empty, |
+ // and none of the arguments can be null. |
+ // Creation time and last access time are ignored (cookies differing only by |
+ // their time are considered identical). |
+ void ComputeCookieDiff(CookieList* old_cookies, |
+ CookieList* new_cookies, |
+ CookieList* cookies_to_add, |
+ CookieList* cookies_to_delete); |
+ |
// Run all cookie changed callbacks that are monitoring |cookie|. |
// |removed| is true if the cookie was deleted. |
void RunCallbacks(const CanonicalCookie& cookie, bool removed); |