| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 // If the number of cookies for CookieMap key |key|, or globally, are | 532 // If the number of cookies for CookieMap key |key|, or globally, are |
| 533 // over the preset maximums above, garbage collect, first for the host and | 533 // over the preset maximums above, garbage collect, first for the host and |
| 534 // then globally. See comments above garbage collection threshold | 534 // then globally. See comments above garbage collection threshold |
| 535 // constants for details. | 535 // constants for details. |
| 536 // | 536 // |
| 537 // Returns the number of cookies deleted (useful for debugging). | 537 // Returns the number of cookies deleted (useful for debugging). |
| 538 size_t GarbageCollect(const base::Time& current, | 538 size_t GarbageCollect(const base::Time& current, |
| 539 const std::string& key, | 539 const std::string& key, |
| 540 bool enforce_strict_secure); | 540 bool enforce_strict_secure); |
| 541 | 541 |
| 542 // Helper for GarbageCollect(). Deletes up to |purge_goal| cookies with a |
| 543 // priority less than or equal to |priority| from |cookies|, while ensuring |
| 544 // that at least the |to_protect| most-recent cookies are retained. |
| 545 // |
| 546 // |cookies| must be sorted from least-recent to most-recent. |
| 547 // |
| 548 // |safe_date| is only used to determine the deletion cause for histograms. |
| 549 // |
| 550 // Returns the number of cookies deleted. |
| 551 size_t PurgeLeastRecentMatches(CookieItVector* cookies, |
| 552 CookiePriority priority, |
| 553 size_t to_protect, |
| 554 size_t purge_goal, |
| 555 const base::Time& safe_date); |
| 556 |
| 542 // Helper for GarbageCollect(); can be called directly as well. Deletes all | 557 // Helper for GarbageCollect(); can be called directly as well. Deletes all |
| 543 // expired cookies in |itpair|. If |cookie_its| is non-NULL, all the | 558 // expired cookies in |itpair|. If |cookie_its| is non-NULL, all the |
| 544 // non-expired cookies from |itpair| are appended to |cookie_its|. | 559 // non-expired cookies from |itpair| are appended to |cookie_its|. |
| 545 // | 560 // |
| 546 // Returns the number of cookies deleted. | 561 // Returns the number of cookies deleted. |
| 547 size_t GarbageCollectExpired(const base::Time& current, | 562 size_t GarbageCollectExpired(const base::Time& current, |
| 548 const CookieMapItPair& itpair, | 563 const CookieMapItPair& itpair, |
| 549 CookieItVector* cookie_its); | 564 CookieItVector* cookie_its); |
| 550 | 565 |
| 551 // Helper for GarbageCollect(). Deletes all cookies not marked Secure in | 566 // Helper for GarbageCollect(). Deletes all cookies not marked Secure in |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 virtual ~PersistentCookieStore() {} | 796 virtual ~PersistentCookieStore() {} |
| 782 | 797 |
| 783 private: | 798 private: |
| 784 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 799 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
| 785 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 800 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
| 786 }; | 801 }; |
| 787 | 802 |
| 788 } // namespace net | 803 } // namespace net |
| 789 | 804 |
| 790 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 805 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
| OLD | NEW |