Chromium Code Reviews| Index: net/cookies/cookie_store.h |
| diff --git a/net/cookies/cookie_store.h b/net/cookies/cookie_store.h |
| index f56fedd90392877b24e554276579a12733617700..b664ebb87636761feebc93f220ef9bf786b4b785 100644 |
| --- a/net/cookies/cookie_store.h |
| +++ b/net/cookies/cookie_store.h |
| @@ -33,14 +33,36 @@ class CookieMonster; |
| // Destroying the CookieStore will cancel pending async callbacks. |
| class NET_EXPORT CookieStore { |
| public: |
| + // The publicly relevant reasons a cookie might be changed. |
| + enum class ChangeCause { |
| + // The cookie was inserted. |
| + INSERTED, |
| + // The cookie was changed directly by a consumer's action. |
| + EXPLICIT, |
| + // The cookie was deleted, but no more details are known. |
| + UNKNOWN_DELETION, |
| + // The cookie was automatically removed due to an insert operation that |
| + // overwrote it. |
| + OVERWRITE, |
| + // The cookie was automatically removed as it expired. |
| + EXPIRED, |
| + // The cookie was automatically evicted during garbage collection. |
| + EVICTED, |
| + // The cookie was overwritten with an already-expired expiration date. |
| + EXPIRED_OVERWRITE |
| + }; |
| + |
| + static bool ChangeCauseIsDeletion(ChangeCause cause); |
|
mmenke
2016/09/27 18:09:21
Need to document this.
nharper
2016/09/27 21:50:53
Done.
|
| + |
| // Callback definitions. |
| typedef base::Callback<void(const CookieList& cookies)> GetCookieListCallback; |
| typedef base::Callback<void(const std::string& cookie)> GetCookiesCallback; |
| typedef base::Callback<void(bool success)> SetCookiesCallback; |
| typedef base::Callback<void(int num_deleted)> DeleteCallback; |
| - typedef base::Callback<void(const CanonicalCookie& cookie, bool removed)> |
| + typedef base::Callback<void(const CanonicalCookie& cookie, ChangeCause cause)> |
| CookieChangedCallback; |
| - typedef base::CallbackList<void(const CanonicalCookie& cookie, bool removed)> |
| + typedef base::CallbackList<void(const CanonicalCookie& cookie, |
| + ChangeCause cause)> |
| CookieChangedCallbackList; |
| typedef CookieChangedCallbackList::Subscription CookieChangedSubscription; |
| typedef base::Callback<bool(const CanonicalCookie& cookie)> CookiePredicate; |
| @@ -198,6 +220,8 @@ class NET_EXPORT CookieStore { |
| // (url, name) pair are removed. If this method ever needs to support an |
| // unbounded amount of such pairs, this contract needs to change and |
| // implementors need to be improved to not behave this way. |
| + // |
| + // The callback must not synchronously modify another cookie. |
| virtual std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie( |
| const GURL& url, |
| const std::string& name, |