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 the letter D and the number 2. | 5 // Brought to you by the letter D and the number 2. |
| 6 | 6 |
| 7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_ | 7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_ |
| 8 #define NET_COOKIES_COOKIE_MONSTER_H_ | 8 #define NET_COOKIES_COOKIE_MONSTER_H_ |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 // Deletes all cookies that match the host of the given URL | 197 // Deletes all cookies that match the host of the given URL |
| 198 // regardless of path. This includes all http_only and secure cookies, | 198 // regardless of path. This includes all http_only and secure cookies, |
| 199 // but does not include any domain cookies that may apply to this host. | 199 // but does not include any domain cookies that may apply to this host. |
| 200 // Returns the number of cookies deleted. | 200 // Returns the number of cookies deleted. |
| 201 void DeleteAllForHostAsync(const GURL& url, const DeleteCallback& callback); | 201 void DeleteAllForHostAsync(const GURL& url, const DeleteCallback& callback); |
| 202 | 202 |
| 203 // Deletes one specific cookie. | 203 // Deletes one specific cookie. |
| 204 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, | 204 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, |
| 205 const DeleteCookieCallback& callback); | 205 const DeleteCookieCallback& callback); |
| 206 | 206 |
| 207 // Resets the list of cookieable schemes to the supplied schemes. Does | |
| 208 // nothing if called after first use of the instance (i.e. after the | |
| 209 // instance initialization process). | |
| 210 void SetCookieableSchemes(const char* const schemes[], size_t num_schemes); | |
| 211 | |
| 212 // Instructs the cookie monster to not delete expired cookies. This is used | |
| 213 // in cases where the cookie monster is used as a data structure to keep | |
| 214 // arbitrary cookies. | |
| 215 void SetKeepExpiredCookies(); | |
| 216 | |
| 217 // Protects session cookies from deletion on shutdown. | |
| 218 void SetForceKeepSessionState(); | |
| 219 | |
| 220 // Flush the backing store (if any) to disk and post the given callback when | 207 // Flush the backing store (if any) to disk and post the given callback when |
| 221 // done. | 208 // done. |
| 222 // WARNING: THE CALLBACK WILL RUN ON A RANDOM THREAD. IT MUST BE THREAD SAFE. | 209 // WARNING: THE CALLBACK WILL RUN ON A RANDOM THREAD. IT MUST BE THREAD SAFE. |
| 223 // It may be posted to the current thread, or it may run on the thread that | 210 // It may be posted to the current thread, or it may run on the thread that |
| 224 // actually does the flushing. Your Task should generally post a notification | 211 // actually does the flushing. Your Task should generally post a notification |
| 225 // to the thread you actually want to be notified on. | 212 // to the thread you actually want to be notified on. |
| 226 void FlushStore(const base::Closure& callback); | 213 void FlushStore(const base::Closure& callback); |
| 227 | 214 |
| 228 // Replaces all the cookies by |list|. This method does not flush the backend. | 215 // Replaces all the cookies by |list|. This method does not flush the backend. |
| 229 void SetAllCookiesAsync(const CookieList& list, | 216 void SetAllCookiesAsync(const CookieList& list, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 void DeleteAllCreatedBetweenForHostAsync( | 258 void DeleteAllCreatedBetweenForHostAsync( |
| 272 const base::Time delete_begin, | 259 const base::Time delete_begin, |
| 273 const base::Time delete_end, | 260 const base::Time delete_end, |
| 274 const GURL& url, | 261 const GURL& url, |
| 275 const DeleteCallback& callback) override; | 262 const DeleteCallback& callback) override; |
| 276 | 263 |
| 277 void DeleteSessionCookiesAsync(const DeleteCallback&) override; | 264 void DeleteSessionCookiesAsync(const DeleteCallback&) override; |
| 278 | 265 |
| 279 CookieMonster* GetCookieMonster() override; | 266 CookieMonster* GetCookieMonster() override; |
| 280 | 267 |
| 268 // Resets the list of cookieable schemes to the supplied schemes. Does | |
| 269 // nothing if called after first use of the instance (i.e. after the | |
| 270 // instance initialization process). | |
| 271 void SetCookieableSchemes(const char* const schemes[], size_t num_schemes); | |
| 272 | |
| 273 // Instructs the cookie monster to not delete expired cookies. This is used | |
| 274 // in cases where the cookie monster is used as a data structure to keep | |
| 275 // arbitrary cookies. | |
| 276 void SetKeepExpiredCookies(); | |
| 277 | |
| 278 // Protects session cookies from deletion on shutdown. | |
| 279 void SetForceKeepSessionState(); | |
| 280 | |
| 281 // Enables writing session cookies into the cookie database. If this this | 281 // Enables writing session cookies into the cookie database. If this this |
| 282 // method is called, it must be called before first use of the instance | 282 // method is called, it must be called before first use of the instance |
| 283 // (i.e. as part of the instance initialization process). | 283 // (i.e. as part of the instance initialization process). |
| 284 void SetPersistSessionCookies(bool persist_session_cookies); | 284 void SetPersistSessionCookies(bool persist_session_cookies); |
| 285 | 285 |
| 286 // Debugging method to perform various validation checks on the map. | |
| 287 // Currently just checking that there are no null CanonicalCookie pointers | |
| 288 // in the map. | |
| 289 // Argument |arg| is to allow retaining of arbitrary data if the CHECKs | |
| 290 // in the function trip. TODO(rdsmith):Remove hack. | |
| 291 void ValidateMap(int arg); | |
|
mmenke
2016/01/20 22:14:03
I removed this, since this method doesn't actually
Mike West
2016/01/21 09:28:36
These are the best. :)
| |
| 292 | |
| 293 // Determines if the scheme of the URL is a scheme that cookies will be | 286 // Determines if the scheme of the URL is a scheme that cookies will be |
| 294 // stored for. | 287 // stored for. |
| 295 bool IsCookieableScheme(const std::string& scheme); | 288 bool IsCookieableScheme(const std::string& scheme); |
| 296 | 289 |
| 297 // The default list of schemes the cookie monster can handle. | 290 // The default list of schemes the cookie monster can handle. |
| 298 static const char* const kDefaultCookieableSchemes[]; | 291 static const char* const kDefaultCookieableSchemes[]; |
| 299 static const int kDefaultCookieableSchemesCount; | 292 static const int kDefaultCookieableSchemesCount; |
| 300 | 293 |
| 301 scoped_ptr<CookieChangedSubscription> AddCallbackForCookie( | 294 scoped_ptr<CookieChangedSubscription> AddCallbackForCookie( |
| 302 const GURL& url, | 295 const GURL& url, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 | 502 |
| 510 CookieList GetAllCookiesForURLWithOptions(const GURL& url, | 503 CookieList GetAllCookiesForURLWithOptions(const GURL& url, |
| 511 const CookieOptions& options); | 504 const CookieOptions& options); |
| 512 | 505 |
| 513 int DeleteAll(bool sync_to_store); | 506 int DeleteAll(bool sync_to_store); |
| 514 | 507 |
| 515 int DeleteAllCreatedBetween(const base::Time& delete_begin, | 508 int DeleteAllCreatedBetween(const base::Time& delete_begin, |
| 516 const base::Time& delete_end); | 509 const base::Time& delete_end); |
| 517 | 510 |
| 518 int DeleteAllForHost(const GURL& url); | 511 int DeleteAllForHost(const GURL& url); |
| 512 | |
| 519 int DeleteAllCreatedBetweenForHost(const base::Time delete_begin, | 513 int DeleteAllCreatedBetweenForHost(const base::Time delete_begin, |
| 520 const base::Time delete_end, | 514 const base::Time delete_end, |
| 521 const GURL& url); | 515 const GURL& url); |
| 522 | 516 |
| 523 bool DeleteCanonicalCookie(const CanonicalCookie& cookie); | 517 bool DeleteCanonicalCookie(const CanonicalCookie& cookie); |
| 524 | 518 |
| 525 bool SetCookieWithOptions(const GURL& url, | 519 bool SetCookieWithOptions(const GURL& url, |
| 526 const std::string& cookie_line, | 520 const std::string& cookie_line, |
| 527 const CookieOptions& options); | 521 const CookieOptions& options); |
| 528 | 522 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 894 virtual ~PersistentCookieStore() {} | 888 virtual ~PersistentCookieStore() {} |
| 895 | 889 |
| 896 private: | 890 private: |
| 897 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 891 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
| 898 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 892 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
| 899 }; | 893 }; |
| 900 | 894 |
| 901 } // namespace net | 895 } // namespace net |
| 902 | 896 |
| 903 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 897 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
| OLD | NEW |