| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 // constants for details. | 542 // constants for details. |
| 543 // | 543 // |
| 544 // Returns the number of cookies deleted (useful for debugging). | 544 // Returns the number of cookies deleted (useful for debugging). |
| 545 size_t GarbageCollect(const base::Time& current, | 545 size_t GarbageCollect(const base::Time& current, |
| 546 const std::string& key, | 546 const std::string& key, |
| 547 bool enforce_strict_secure); | 547 bool enforce_strict_secure); |
| 548 | 548 |
| 549 // Helper for GarbageCollect(). Deletes up to |purge_goal| cookies with a | 549 // Helper for GarbageCollect(). Deletes up to |purge_goal| cookies with a |
| 550 // priority less than or equal to |priority| from |cookies|, while ensuring | 550 // priority less than or equal to |priority| from |cookies|, while ensuring |
| 551 // that at least the |to_protect| most-recent cookies are retained. | 551 // that at least the |to_protect| most-recent cookies are retained. |
| 552 // |protected_secure_cookies| specifies whether or not secure cookies should |
| 553 // be protected from deletion. |
| 552 // | 554 // |
| 553 // |cookies| must be sorted from least-recent to most-recent. | 555 // |cookies| must be sorted from least-recent to most-recent. |
| 554 // | 556 // |
| 555 // Returns the number of cookies deleted. | 557 // Returns the number of cookies deleted. |
| 556 size_t PurgeLeastRecentMatches(CookieItVector* cookies, | 558 size_t PurgeLeastRecentMatches(CookieItVector* cookies, |
| 557 CookiePriority priority, | 559 CookiePriority priority, |
| 558 size_t to_protect, | 560 size_t to_protect, |
| 559 size_t purge_goal); | 561 size_t purge_goal, |
| 562 bool protect_secure_cookies); |
| 560 | 563 |
| 561 // Helper for GarbageCollect(); can be called directly as well. Deletes all | 564 // Helper for GarbageCollect(); can be called directly as well. Deletes all |
| 562 // expired cookies in |itpair|. If |cookie_its| is non-NULL, all the | 565 // expired cookies in |itpair|. If |cookie_its| is non-NULL, all the |
| 563 // non-expired cookies from |itpair| are appended to |cookie_its|. | 566 // non-expired cookies from |itpair| are appended to |cookie_its|. |
| 564 // | 567 // |
| 565 // Returns the number of cookies deleted. | 568 // Returns the number of cookies deleted. |
| 566 size_t GarbageCollectExpired(const base::Time& current, | 569 size_t GarbageCollectExpired(const base::Time& current, |
| 567 const CookieMapItPair& itpair, | 570 const CookieMapItPair& itpair, |
| 568 CookieItVector* cookie_its); | 571 CookieItVector* cookie_its); |
| 569 | 572 |
| 570 // Helper for GarbageCollect(). Deletes all cookies not marked Secure in | |
| 571 // |valid_cookies_its|. If |cookie_its| is non-NULL, all the Secure cookies | |
| 572 // from |itpair| are appended to |cookie_its|. | |
| 573 // | |
| 574 // Returns the numeber of cookies deleted. | |
| 575 size_t GarbageCollectNonSecure(const CookieItVector& valid_cookies, | |
| 576 CookieItVector* cookie_its); | |
| 577 | |
| 578 // Helper for GarbageCollect(). Deletes all cookies in the range specified by | 573 // Helper for GarbageCollect(). Deletes all cookies in the range specified by |
| 579 // [|it_begin|, |it_end|). Returns the number of cookies deleted. | 574 // [|it_begin|, |it_end|). Returns the number of cookies deleted. |
| 580 size_t GarbageCollectDeleteRange(const base::Time& current, | 575 size_t GarbageCollectDeleteRange(const base::Time& current, |
| 581 DeletionCause cause, | 576 DeletionCause cause, |
| 582 CookieItVector::iterator cookie_its_begin, | 577 CookieItVector::iterator cookie_its_begin, |
| 583 CookieItVector::iterator cookie_its_end); | 578 CookieItVector::iterator cookie_its_end); |
| 584 | 579 |
| 585 // Helper for GarbageCollect(). Deletes cookies in |cookie_its| from least to | 580 // Helper for GarbageCollect(). Deletes cookies in |cookie_its| from least to |
| 586 // most recently used, but only before |safe_date|. Also will stop deleting | 581 // most recently used, but only before |safe_date|. Also will stop deleting |
| 587 // when the number of remaining cookies hits |purge_goal|. | 582 // when the number of remaining cookies hits |purge_goal|. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 virtual ~PersistentCookieStore() {} | 802 virtual ~PersistentCookieStore() {} |
| 808 | 803 |
| 809 private: | 804 private: |
| 810 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 805 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
| 811 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 806 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
| 812 }; | 807 }; |
| 813 | 808 |
| 814 } // namespace net | 809 } // namespace net |
| 815 | 810 |
| 816 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 811 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
| OLD | NEW |