| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 CookieMonsterDelegate* delegate, | 142 CookieMonsterDelegate* delegate, |
| 143 ChannelIDService* channel_id_service); | 143 ChannelIDService* channel_id_service); |
| 144 | 144 |
| 145 // Only used during unit testing. | 145 // Only used during unit testing. |
| 146 CookieMonster(PersistentCookieStore* store, | 146 CookieMonster(PersistentCookieStore* store, |
| 147 CookieMonsterDelegate* delegate, | 147 CookieMonsterDelegate* delegate, |
| 148 base::TimeDelta last_access_threshold); | 148 base::TimeDelta last_access_threshold); |
| 149 | 149 |
| 150 ~CookieMonster() override; | 150 ~CookieMonster() override; |
| 151 | 151 |
| 152 // Writes all the cookies in |list| into the store, replacing existing | 152 // Writes all the cookies in |list| into the store, replacing all cookies |
| 153 // cookies that collide. Does not affect cookies not listed in |list|. | 153 // currently present in store. |
| 154 // This method does not flush the backend. | 154 // This method does not flush the backend. |
| 155 // TODO(rdsmith, mmenke): Do not use this function; it is deprecated | 155 // TODO(rdsmith, mmenke): Do not use this function; it is deprecated |
| 156 // and should be removed. | 156 // and should be removed. |
| 157 // See https://codereview.chromium.org/2882063002/#msg64. | 157 // See https://codereview.chromium.org/2882063002/#msg64. |
| 158 void SetAllCookiesAsync(const CookieList& list, SetCookiesCallback callback); | 158 void SetAllCookiesAsync(const CookieList& list, SetCookiesCallback callback); |
| 159 | 159 |
| 160 // CookieStore implementation. | 160 // CookieStore implementation. |
| 161 void SetCookieWithOptionsAsync(const GURL& url, | 161 void SetCookieWithOptionsAsync(const GURL& url, |
| 162 const std::string& cookie_line, | 162 const std::string& cookie_line, |
| 163 const CookieOptions& options, | 163 const CookieOptions& options, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 // For validation of key values. | 249 // For validation of key values. |
| 250 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestDomainTree); | 250 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestDomainTree); |
| 251 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestImport); | 251 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestImport); |
| 252 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, GetKey); | 252 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, GetKey); |
| 253 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestGetKey); | 253 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestGetKey); |
| 254 | 254 |
| 255 // For FindCookiesForKey. | 255 // For FindCookiesForKey. |
| 256 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, ShortLivedSessionCookies); | 256 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, ShortLivedSessionCookies); |
| 257 | 257 |
| 258 // For ComputeCookieDiff. | |
| 259 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, ComputeCookieDiff); | |
| 260 | |
| 261 // For CookieSource histogram enum. | 258 // For CookieSource histogram enum. |
| 262 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, CookieSourceHistogram); | 259 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, CookieSourceHistogram); |
| 263 | 260 |
| 264 // For kSafeFromGlobalPurgeDays in CookieStore. | 261 // For kSafeFromGlobalPurgeDays in CookieStore. |
| 265 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, EvictSecureCookies); | 262 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, EvictSecureCookies); |
| 266 | 263 |
| 267 // For CookieDeleteEquivalent histogram enum. | 264 // For CookieDeleteEquivalent histogram enum. |
| 268 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, | 265 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, |
| 269 CookieDeleteEquivalentHistogramTest); | 266 CookieDeleteEquivalentHistogramTest); |
| 270 | 267 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 base::Time CurrentTime(); | 628 base::Time CurrentTime(); |
| 632 | 629 |
| 633 // Runs the callback if, or defers the callback until, the full cookie | 630 // Runs the callback if, or defers the callback until, the full cookie |
| 634 // database is loaded. | 631 // database is loaded. |
| 635 void DoCookieCallback(base::OnceClosure callback); | 632 void DoCookieCallback(base::OnceClosure callback); |
| 636 | 633 |
| 637 // Runs the callback if, or defers the callback until, the cookies for the | 634 // Runs the callback if, or defers the callback until, the cookies for the |
| 638 // given URL are loaded. | 635 // given URL are loaded. |
| 639 void DoCookieCallbackForURL(base::OnceClosure callback, const GURL& url); | 636 void DoCookieCallbackForURL(base::OnceClosure callback, const GURL& url); |
| 640 | 637 |
| 641 // Computes the difference between |old_cookies| and |new_cookies|, and writes | |
| 642 // the result in |cookies_to_add| and |cookies_to_delete|. | |
| 643 // This function has the side effect of changing the order of |old_cookies| | |
| 644 // and |new_cookies|. |cookies_to_add| and |cookies_to_delete| must be empty, | |
| 645 // and none of the arguments can be null. | |
| 646 void ComputeCookieDiff(CookieList* old_cookies, | |
| 647 CookieList* new_cookies, | |
| 648 CookieList* cookies_to_add, | |
| 649 CookieList* cookies_to_delete); | |
| 650 | |
| 651 // Run all cookie changed callbacks that are monitoring |cookie|. | 638 // Run all cookie changed callbacks that are monitoring |cookie|. |
| 652 // |removed| is true if the cookie was deleted. | 639 // |removed| is true if the cookie was deleted. |
| 653 void RunCookieChangedCallbacks(const CanonicalCookie& cookie, | 640 void RunCookieChangedCallbacks(const CanonicalCookie& cookie, |
| 654 CookieStore::ChangeCause cause); | 641 CookieStore::ChangeCause cause); |
| 655 | 642 |
| 656 // Histogram variables; see CookieMonster::InitializeHistograms() in | 643 // Histogram variables; see CookieMonster::InitializeHistograms() in |
| 657 // cookie_monster.cc for details. | 644 // cookie_monster.cc for details. |
| 658 base::HistogramBase* histogram_expiration_duration_minutes_; | 645 base::HistogramBase* histogram_expiration_duration_minutes_; |
| 659 base::HistogramBase* histogram_count_; | 646 base::HistogramBase* histogram_count_; |
| 660 base::HistogramBase* histogram_cookie_type_; | 647 base::HistogramBase* histogram_cookie_type_; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 virtual ~PersistentCookieStore() {} | 795 virtual ~PersistentCookieStore() {} |
| 809 | 796 |
| 810 private: | 797 private: |
| 811 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 798 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
| 812 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 799 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
| 813 }; | 800 }; |
| 814 | 801 |
| 815 } // namespace net | 802 } // namespace net |
| 816 | 803 |
| 817 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 804 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
| OLD | NEW |