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

Side by Side Diff: net/cookies/cookie_store.h

Issue 1741123002: Add removal filter support for Cookies, Storage, and Content Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Cookies, Tests, etc 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 unified diff | Download patch
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 // Returns if we should clear the given cookie.
47 typedef base::Callback<bool(const CanonicalCookie& cookie)>
48 ClearCookiesPredicate;
46 49
47 virtual ~CookieStore(); 50 virtual ~CookieStore();
48 51
49 // Returns the cookie line (e.g. "cookie1=value1; cookie2=value2") represented 52 // 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. 53 // by |cookies|. The string is built in the same order as the given list.
51 // 54 //
52 // TODO(mkwst): We really should standardize on either 55 // TODO(mkwst): We really should standardize on either
53 // 'std::vector<CanonicalCookie>' or 'std::vector<CanonicalCookie*>'. 56 // 'std::vector<CanonicalCookie>' or 'std::vector<CanonicalCookie*>'.
54 static std::string BuildCookieLine( 57 static std::string BuildCookieLine(
55 const std::vector<CanonicalCookie>& cookies); 58 const std::vector<CanonicalCookie>& cookies);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // equal to |delete_begin| and less then |delete_end|. This includes 163 // equal to |delete_begin| and less then |delete_end|. This includes
161 // all http_only and secure cookies, but does not include any domain 164 // all http_only and secure cookies, but does not include any domain
162 // cookies that may apply to this host. 165 // cookies that may apply to this host.
163 // Returns the number of cookies deleted. 166 // Returns the number of cookies deleted.
164 virtual void DeleteAllCreatedBetweenForHostAsync( 167 virtual void DeleteAllCreatedBetweenForHostAsync(
165 const base::Time delete_begin, 168 const base::Time delete_begin,
166 const base::Time delete_end, 169 const base::Time delete_end,
167 const GURL& url, 170 const GURL& url,
168 const DeleteCallback& callback) = 0; 171 const DeleteCallback& callback) = 0;
169 172
173 // Deletes all of the cookies that match the given predicate and that have a
174 // creation_date greater than or equal to |delete_begin| and less then
175 // |delete_end|. Make sure you know what you are doing here so you don't break
176 // the web.
177 // Returns the number of cookies deleted.
178 virtual void DeleteAllCreatedBetweenWithPredicateAsync(
179 const base::Time& delete_begin,
180 const base::Time& delete_end,
181 const ClearCookiesPredicate& predicate,
182 const DeleteCallback& callback) = 0;
183
170 virtual void DeleteSessionCookiesAsync(const DeleteCallback&) = 0; 184 virtual void DeleteSessionCookiesAsync(const DeleteCallback&) = 0;
171 185
172 // Deletes all cookies in the store. 186 // Deletes all cookies in the store.
173 void DeleteAllAsync(const DeleteCallback& callback); 187 void DeleteAllAsync(const DeleteCallback& callback);
174 188
175 // Flush the backing store (if any) to disk and post the given callback when 189 // Flush the backing store (if any) to disk and post the given callback when
176 // done. 190 // done.
177 virtual void FlushStore(const base::Closure& callback) = 0; 191 virtual void FlushStore(const base::Closure& callback) = 0;
178 192
179 // Protects session cookies from deletion on shutdown, if the underlying 193 // Protects session cookies from deletion on shutdown, if the underlying
(...skipping 22 matching lines...) Expand all
202 const std::string& name, 216 const std::string& name,
203 const CookieChangedCallback& callback) = 0; 217 const CookieChangedCallback& callback) = 0;
204 218
205 protected: 219 protected:
206 CookieStore(); 220 CookieStore();
207 }; 221 };
208 222
209 } // namespace net 223 } // namespace net
210 224
211 #endif // NET_COOKIES_COOKIE_STORE_H_ 225 #endif // NET_COOKIES_COOKIE_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698