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

Side by Side 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: rebase Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « net/cookies/cookie_monster_unittest.cc ('k') | net/cookies/cookie_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Brought to you by number 42. 5 // Brought to you by number 42.
6 6
7 #ifndef NET_COOKIES_COOKIE_STORE_H_ 7 #ifndef NET_COOKIES_COOKIE_STORE_H_
8 #define NET_COOKIES_COOKIE_STORE_H_ 8 #define NET_COOKIES_COOKIE_STORE_H_
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback_forward.h"
14 #include "base/callback_list.h" 14 #include "base/callback_list.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "net/base/net_export.h" 17 #include "net/base/net_export.h"
18 #include "net/cookies/canonical_cookie.h" 18 #include "net/cookies/canonical_cookie.h"
19 #include "net/cookies/cookie_options.h" 19 #include "net/cookies/cookie_options.h"
20 20
21 class GURL; 21 class GURL;
22 22
23 namespace net { 23 namespace net {
(...skipping 12 matching lines...) Expand all
36 // Callback definitions. 36 // Callback definitions.
37 typedef base::Callback<void(const CookieList& cookies)> GetCookieListCallback; 37 typedef base::Callback<void(const CookieList& cookies)> GetCookieListCallback;
38 typedef base::Callback<void(const std::string& cookie)> GetCookiesCallback; 38 typedef base::Callback<void(const std::string& cookie)> GetCookiesCallback;
39 typedef base::Callback<void(bool success)> SetCookiesCallback; 39 typedef base::Callback<void(bool success)> SetCookiesCallback;
40 typedef base::Callback<void(int num_deleted)> DeleteCallback; 40 typedef base::Callback<void(int num_deleted)> DeleteCallback;
41 typedef base::Callback<void(const CanonicalCookie& cookie, bool removed)> 41 typedef base::Callback<void(const CanonicalCookie& cookie, bool removed)>
42 CookieChangedCallback; 42 CookieChangedCallback;
43 typedef base::CallbackList<void(const CanonicalCookie& cookie, bool removed)> 43 typedef base::CallbackList<void(const CanonicalCookie& cookie, bool removed)>
44 CookieChangedCallbackList; 44 CookieChangedCallbackList;
45 typedef CookieChangedCallbackList::Subscription CookieChangedSubscription; 45 typedef CookieChangedCallbackList::Subscription CookieChangedSubscription;
46 typedef base::Callback<bool(const CanonicalCookie& cookie)> CookiePredicate;
46 47
47 virtual ~CookieStore(); 48 virtual ~CookieStore();
48 49
49 // Returns the cookie line (e.g. "cookie1=value1; cookie2=value2") represented 50 // Returns the cookie line (e.g. "cookie1=value1; cookie2=value2") represented
50 // by |cookies|. The string is built in the same order as the given list. 51 // by |cookies|. The string is built in the same order as the given list.
51 // 52 //
52 // TODO(mkwst): We really should standardize on either 53 // TODO(mkwst): We really should standardize on either
53 // 'std::vector<CanonicalCookie>' or 'std::vector<CanonicalCookie*>'. 54 // 'std::vector<CanonicalCookie>' or 'std::vector<CanonicalCookie*>'.
54 static std::string BuildCookieLine( 55 static std::string BuildCookieLine(
55 const std::vector<CanonicalCookie>& cookies); 56 const std::vector<CanonicalCookie>& cookies);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const base::Closure& callback) = 0; 144 const base::Closure& callback) = 0;
144 145
145 // Deletes one specific cookie. |cookie| must have been returned by a previous 146 // Deletes one specific cookie. |cookie| must have been returned by a previous
146 // query on this CookieStore. Invokes |callback| with 1 if a cookie was 147 // query on this CookieStore. Invokes |callback| with 1 if a cookie was
147 // deleted, 0 otherwise. 148 // deleted, 0 otherwise.
148 virtual void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, 149 virtual void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie,
149 const DeleteCallback& callback) = 0; 150 const DeleteCallback& callback) = 0;
150 151
151 // Deletes all of the cookies that have a creation_date greater than or equal 152 // Deletes all of the cookies that have a creation_date greater than or equal
152 // to |delete_begin| and less than |delete_end| 153 // to |delete_begin| and less than |delete_end|
153 // Returns the number of cookies that have been deleted. 154 // Calls |callback| with the number of cookies deleted.
154 virtual void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, 155 virtual void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
155 const base::Time& delete_end, 156 const base::Time& delete_end,
156 const DeleteCallback& callback) = 0; 157 const DeleteCallback& callback) = 0;
157 158
158 // Deletes all of the cookies that match the host of the given URL 159 // Deletes all of the cookies that match the given predicate and that have a
159 // regardless of path and that have a creation_date greater than or 160 // creation_date greater than or equal to |delete_begin| and less then
160 // equal to |delete_begin| and less then |delete_end|. This includes 161 // |delete_end|. This includes all http_only and secure cookies. Avoid
161 // all http_only and secure cookies, but does not include any domain 162 // deleting cookies that could leave websites with a partial set of visible
162 // cookies that may apply to this host. 163 // cookies.
163 // Returns the number of cookies deleted. 164 // Calls |callback| with the number of cookies deleted.
164 virtual void DeleteAllCreatedBetweenForHostAsync( 165 virtual void DeleteAllCreatedBetweenWithPredicateAsync(
165 const base::Time delete_begin, 166 const base::Time& delete_begin,
166 const base::Time delete_end, 167 const base::Time& delete_end,
167 const GURL& url, 168 const CookiePredicate& predicate,
168 const DeleteCallback& callback) = 0; 169 const DeleteCallback& callback) = 0;
169 170
170 virtual void DeleteSessionCookiesAsync(const DeleteCallback&) = 0; 171 virtual void DeleteSessionCookiesAsync(const DeleteCallback&) = 0;
171 172
172 // Deletes all cookies in the store. 173 // Deletes all cookies in the store.
173 void DeleteAllAsync(const DeleteCallback& callback); 174 void DeleteAllAsync(const DeleteCallback& callback);
174 175
175 // Flush the backing store (if any) to disk and post the given callback when 176 // Flush the backing store (if any) to disk and post the given callback when
176 // done. 177 // done.
177 virtual void FlushStore(const base::Closure& callback) = 0; 178 virtual void FlushStore(const base::Closure& callback) = 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 int GetChannelIDServiceID(); 211 int GetChannelIDServiceID();
211 212
212 protected: 213 protected:
213 CookieStore(); 214 CookieStore();
214 int channel_id_service_id_; 215 int channel_id_service_id_;
215 }; 216 };
216 217
217 } // namespace net 218 } // namespace net
218 219
219 #endif // NET_COOKIES_COOKIE_STORE_H_ 220 #endif // NET_COOKIES_COOKIE_STORE_H_
OLDNEW
« no previous file with comments | « net/cookies/cookie_monster_unittest.cc ('k') | net/cookies/cookie_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698