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

Unified Diff: net/cookies/cookie_store.h

Issue 2349823003: Pass a RemovalCause to CookieChangedCallback (Closed)
Patch Set: Merge enums Created 4 years, 3 months 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/cookies/cookie_store.h
diff --git a/net/cookies/cookie_store.h b/net/cookies/cookie_store.h
index f56fedd90392877b24e554276579a12733617700..dd2cff9e725d57d126230d80a33c165e3e8d3b9c 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 ChangeCause {
+ // The cookie was inserted.
+ CHANGE_COOKIE_INSERTED,
mmenke 2016/09/26 18:29:26 Can we make this an enum class (And maybe get rid
nharper 2016/09/26 21:09:10 Done.
+ // The cookie was changed directly by a consumer's action.
+ CHANGE_COOKIE_EXPLICIT,
+ // The cookie was deleted, but no more details are known.
+ CHANGE_COOKIE_UNKNOWN_DELETION,
+ // The cookie was automatically removed due to an insert operation that
+ // overwrote it.
+ CHANGE_COOKIE_OVERWRITE,
+ // The cookie was automatically removed as it expired.
+ CHANGE_COOKIE_EXPIRED,
+ // The cookie was automatically evicted during garbage collection.
+ CHANGE_COOKIE_EVICTED,
+ // The cookie was overwritten with an already-expired expiration date.
+ CHANGE_COOKIE_EXPIRED_OVERWRITE
+ };
+
+ static bool ChangeCauseIsDeletion(ChangeCause cause);
+
// 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)>
Mike West 2016/09/26 07:55:37 Can you add some tests for this change? It looks l
nharper 2016/09/26 21:09:10 I've updated cookie_monster_unittest.cc to check t
CookieChangedCallbackList;
typedef CookieChangedCallbackList::Subscription CookieChangedSubscription;
typedef base::Callback<bool(const CanonicalCookie& cookie)> CookiePredicate;

Powered by Google App Engine
This is Rietveld 408576698