Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 host of the given URL |
| 159 // regardless of path and that have a creation_date greater than or | 160 // regardless of path and that have a creation_date greater than or |
| 160 // equal to |delete_begin| and less then |delete_end|. This includes | 161 // equal to |delete_begin| and less then |delete_end|. This includes |
| 161 // all http_only and secure cookies, but does not include any domain | 162 // all http_only and secure cookies, but does not include any domain |
| 162 // cookies that may apply to this host. | 163 // cookies that may apply to this host. |
| 163 // Returns the number of cookies deleted. | 164 // Returns the number of cookies deleted. |
| 164 virtual void DeleteAllCreatedBetweenForHostAsync( | 165 virtual void DeleteAllCreatedBetweenForHostAsync( |
|
Mike West
2016/03/11 08:36:11
Do we still need this if we have the method you're
dmurph
2016/03/30 22:21:27
Hmmm... yeah I could do this. I'll put my new patc
| |
| 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 GURL& url, |
| 168 const DeleteCallback& callback) = 0; | 169 const DeleteCallback& callback) = 0; |
| 169 | 170 |
| 171 // Deletes all of the cookies that match the given predicate and that have a | |
| 172 // creation_date greater than or equal to |delete_begin| and less then | |
| 173 // |delete_end|. Make sure you know what you are doing here so you don't break | |
| 174 // the web. | |
| 175 // Returns the number of cookies deleted. | |
|
Mike West
2016/03/11 08:36:11
It calls |callback| with the number of cookies del
dmurph
2016/03/30 22:21:27
Done.
| |
| 176 virtual void DeleteAllCreatedBetweenWithPredicateAsync( | |
| 177 const base::Time& delete_begin, | |
| 178 const base::Time& delete_end, | |
| 179 const CookiePredicate& predicate, | |
| 180 const DeleteCallback& callback) = 0; | |
| 181 | |
| 170 virtual void DeleteSessionCookiesAsync(const DeleteCallback&) = 0; | 182 virtual void DeleteSessionCookiesAsync(const DeleteCallback&) = 0; |
| 171 | 183 |
| 172 // Deletes all cookies in the store. | 184 // Deletes all cookies in the store. |
| 173 void DeleteAllAsync(const DeleteCallback& callback); | 185 void DeleteAllAsync(const DeleteCallback& callback); |
| 174 | 186 |
| 175 // Flush the backing store (if any) to disk and post the given callback when | 187 // Flush the backing store (if any) to disk and post the given callback when |
| 176 // done. | 188 // done. |
| 177 virtual void FlushStore(const base::Closure& callback) = 0; | 189 virtual void FlushStore(const base::Closure& callback) = 0; |
| 178 | 190 |
| 179 // Protects session cookies from deletion on shutdown, if the underlying | 191 // Protects session cookies from deletion on shutdown, if the underlying |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 202 const std::string& name, | 214 const std::string& name, |
| 203 const CookieChangedCallback& callback) = 0; | 215 const CookieChangedCallback& callback) = 0; |
| 204 | 216 |
| 205 protected: | 217 protected: |
| 206 CookieStore(); | 218 CookieStore(); |
| 207 }; | 219 }; |
| 208 | 220 |
| 209 } // namespace net | 221 } // namespace net |
| 210 | 222 |
| 211 #endif // NET_COOKIES_COOKIE_STORE_H_ | 223 #endif // NET_COOKIES_COOKIE_STORE_H_ |
| OLD | NEW |