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

Unified Diff: net/cookies/cookie_store.h

Issue 1844243002: [CookieStore] Upgrading host-based deleting to predicate-based deleting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added android changes Created 4 years, 9 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 f6426c5d695cb8d5f71702594f1709d10fcc2364..9be066a1e0e53eb2b2f176530b9a93ee533f5767 100644
--- a/net/cookies/cookie_store.h
+++ b/net/cookies/cookie_store.h
@@ -10,7 +10,7 @@
#include <string>
#include <vector>
-#include "base/callback.h"
+#include "base/callback_forward.h"
#include "base/callback_list.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
@@ -43,6 +43,7 @@ class NET_EXPORT CookieStore {
typedef base::CallbackList<void(const CanonicalCookie& cookie, bool removed)>
CookieChangedCallbackList;
typedef CookieChangedCallbackList::Subscription CookieChangedSubscription;
+ typedef base::Callback<bool(const CanonicalCookie& cookie)> CookiePredicate;
virtual ~CookieStore();
@@ -56,6 +57,11 @@ class NET_EXPORT CookieStore {
static std::string BuildCookieLine(
const std::vector<CanonicalCookie*>& cookies);
+ // This creates a CookiePredicate that matches all host (NOT domain) cookies
+ // that match the host of |url|. This is intended to be used with
+ // DeleteAllCreatedBetweenWithPredicateAsync.
+ static CookiePredicate CreatePredicateForHostCookies(const GURL& url);
Mike West 2016/04/01 07:40:52 This is only used by StoragePartition, right? Did
dmurph 2016/04/01 23:16:46 Done.
+
// Sets the cookies specified by |cookie_list| returned from |url|
// with options |options| in effect. Expects a cookie line, like
// "a=1; domain=b.com".
@@ -150,21 +156,20 @@ class NET_EXPORT CookieStore {
// Deletes all of the cookies that have a creation_date greater than or equal
// to |delete_begin| and less than |delete_end|
- // Returns the number of cookies that have been deleted.
+ // Calls |callback| with the number of cookies deleted.
virtual void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
const base::Time& delete_end,
const DeleteCallback& callback) = 0;
- // Deletes all of the cookies that match the host of the given URL
- // regardless of path and that have a creation_date greater than or
- // equal to |delete_begin| and less then |delete_end|. This includes
- // all http_only and secure cookies, but does not include any domain
- // cookies that may apply to this host.
- // Returns the number of cookies deleted.
- virtual void DeleteAllCreatedBetweenForHostAsync(
- const base::Time delete_begin,
- const base::Time delete_end,
- const GURL& url,
+ // Deletes all of the cookies that match the given predicate and that have a
+ // creation_date greater than or equal to |delete_begin| and less then
+ // |delete_end|. This includes all http_only and secure cookies. Make sure you
+ // know what you are doing here so you don't break the web.
Mike West 2016/04/01 07:40:52 This warning isn't very helpful. :) What should de
dmurph 2016/04/01 23:16:46 Changed.
+ // Calls |callback| with the number of cookies deleted.
+ virtual void DeleteAllCreatedBetweenWithPredicateAsync(
+ const base::Time& delete_begin,
+ const base::Time& delete_end,
+ const CookiePredicate& predicate,
const DeleteCallback& callback) = 0;
virtual void DeleteSessionCookiesAsync(const DeleteCallback&) = 0;

Powered by Google App Engine
This is Rietveld 408576698