| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // monster's existence. If |store| is NULL, then no backing store will be | 139 // monster's existence. If |store| is NULL, then no backing store will be |
| 140 // updated. If |delegate| is non-NULL, it will be notified on | 140 // updated. If |delegate| is non-NULL, it will be notified on |
| 141 // creation/deletion of cookies. | 141 // creation/deletion of cookies. |
| 142 CookieMonster(PersistentCookieStore* store, CookieMonsterDelegate* delegate); | 142 CookieMonster(PersistentCookieStore* store, CookieMonsterDelegate* delegate); |
| 143 | 143 |
| 144 // Only used during unit testing. | 144 // Only used during unit testing. |
| 145 CookieMonster(PersistentCookieStore* store, | 145 CookieMonster(PersistentCookieStore* store, |
| 146 CookieMonsterDelegate* delegate, | 146 CookieMonsterDelegate* delegate, |
| 147 int last_access_threshold_milliseconds); | 147 int last_access_threshold_milliseconds); |
| 148 | 148 |
| 149 typedef base::Callback<void(const CookieList& cookies)> GetCookieListCallback; | |
| 150 typedef base::Callback<void(bool success)> DeleteCookieCallback; | |
| 151 | |
| 152 // Returns all the cookies, for use in management UI, etc. Filters results | 149 // Returns all the cookies, for use in management UI, etc. Filters results |
| 153 // using given url scheme, host / domain and path and options. This does not | 150 // using given url scheme, host / domain and path and options. This does not |
| 154 // mark the cookies as having been accessed. | 151 // mark the cookies as having been accessed. |
| 155 // The returned cookies are ordered by longest path, then earliest | 152 // The returned cookies are ordered by longest path, then earliest |
| 156 // creation date. | 153 // creation date. |
| 157 void GetAllCookiesForURLWithOptionsAsync( | 154 void GetAllCookiesForURLWithOptionsAsync( |
| 158 const GURL& url, | 155 const GURL& url, |
| 159 const CookieOptions& options, | 156 const CookieOptions& options, |
| 160 const GetCookieListCallback& callback); | 157 const GetCookieListCallback& callback); |
| 161 | 158 |
| 162 // Deletes one specific cookie. | |
| 163 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, | |
| 164 const DeleteCookieCallback& callback); | |
| 165 | |
| 166 // Replaces all the cookies by |list|. This method does not flush the backend. | 159 // Replaces all the cookies by |list|. This method does not flush the backend. |
| 167 void SetAllCookiesAsync(const CookieList& list, | 160 void SetAllCookiesAsync(const CookieList& list, |
| 168 const SetCookiesCallback& callback); | 161 const SetCookiesCallback& callback); |
| 169 | 162 |
| 170 // CookieStore implementation. | 163 // CookieStore implementation. |
| 171 void SetCookieWithOptionsAsync(const GURL& url, | 164 void SetCookieWithOptionsAsync(const GURL& url, |
| 172 const std::string& cookie_line, | 165 const std::string& cookie_line, |
| 173 const CookieOptions& options, | 166 const CookieOptions& options, |
| 174 const SetCookiesCallback& callback) override; | 167 const SetCookiesCallback& callback) override; |
| 175 void SetCookieWithDetailsAsync(const GURL& url, | 168 void SetCookieWithDetailsAsync(const GURL& url, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 188 const SetCookiesCallback& callback) override; | 181 const SetCookiesCallback& callback) override; |
| 189 void GetCookiesWithOptionsAsync(const GURL& url, | 182 void GetCookiesWithOptionsAsync(const GURL& url, |
| 190 const CookieOptions& options, | 183 const CookieOptions& options, |
| 191 const GetCookiesCallback& callback) override; | 184 const GetCookiesCallback& callback) override; |
| 192 void GetAllCookiesForURLAsync(const GURL& url, | 185 void GetAllCookiesForURLAsync(const GURL& url, |
| 193 const GetCookieListCallback& callback) override; | 186 const GetCookieListCallback& callback) override; |
| 194 void GetAllCookiesAsync(const GetCookieListCallback& callback) override; | 187 void GetAllCookiesAsync(const GetCookieListCallback& callback) override; |
| 195 void DeleteCookieAsync(const GURL& url, | 188 void DeleteCookieAsync(const GURL& url, |
| 196 const std::string& cookie_name, | 189 const std::string& cookie_name, |
| 197 const base::Closure& callback) override; | 190 const base::Closure& callback) override; |
| 191 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, |
| 192 const DeleteCallback& callback) override; |
| 198 void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, | 193 void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, |
| 199 const base::Time& delete_end, | 194 const base::Time& delete_end, |
| 200 const DeleteCallback& callback) override; | 195 const DeleteCallback& callback) override; |
| 201 void DeleteAllCreatedBetweenForHostAsync( | 196 void DeleteAllCreatedBetweenForHostAsync( |
| 202 const base::Time delete_begin, | 197 const base::Time delete_begin, |
| 203 const base::Time delete_end, | 198 const base::Time delete_end, |
| 204 const GURL& url, | 199 const GURL& url, |
| 205 const DeleteCallback& callback) override; | 200 const DeleteCallback& callback) override; |
| 206 void DeleteSessionCookiesAsync(const DeleteCallback&) override; | 201 void DeleteSessionCookiesAsync(const DeleteCallback&) override; |
| 207 void FlushStore(const base::Closure& callback) override; | 202 void FlushStore(const base::Closure& callback) override; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 CookieList GetAllCookiesForURLWithOptions(const GURL& url, | 424 CookieList GetAllCookiesForURLWithOptions(const GURL& url, |
| 430 const CookieOptions& options); | 425 const CookieOptions& options); |
| 431 | 426 |
| 432 int DeleteAllCreatedBetween(const base::Time& delete_begin, | 427 int DeleteAllCreatedBetween(const base::Time& delete_begin, |
| 433 const base::Time& delete_end); | 428 const base::Time& delete_end); |
| 434 | 429 |
| 435 int DeleteAllCreatedBetweenForHost(const base::Time delete_begin, | 430 int DeleteAllCreatedBetweenForHost(const base::Time delete_begin, |
| 436 const base::Time delete_end, | 431 const base::Time delete_end, |
| 437 const GURL& url); | 432 const GURL& url); |
| 438 | 433 |
| 439 bool DeleteCanonicalCookie(const CanonicalCookie& cookie); | |
| 440 | |
| 441 bool SetCookieWithOptions(const GURL& url, | 434 bool SetCookieWithOptions(const GURL& url, |
| 442 const std::string& cookie_line, | 435 const std::string& cookie_line, |
| 443 const CookieOptions& options); | 436 const CookieOptions& options); |
| 444 | 437 |
| 445 std::string GetCookiesWithOptions(const GURL& url, | 438 std::string GetCookiesWithOptions(const GURL& url, |
| 446 const CookieOptions& options); | 439 const CookieOptions& options); |
| 447 | 440 |
| 448 void DeleteCookie(const GURL& url, const std::string& cookie_name); | 441 void DeleteCookie(const GURL& url, const std::string& cookie_name); |
| 449 | 442 |
| 443 int DeleteCanonicalCookie(const CanonicalCookie& cookie); |
| 444 |
| 450 bool SetCookieWithCreationTime(const GURL& url, | 445 bool SetCookieWithCreationTime(const GURL& url, |
| 451 const std::string& cookie_line, | 446 const std::string& cookie_line, |
| 452 const base::Time& creation_time); | 447 const base::Time& creation_time); |
| 453 | 448 |
| 454 int DeleteSessionCookies(); | 449 int DeleteSessionCookies(); |
| 455 | 450 |
| 456 // The first access to the cookie store initializes it. This method should be | 451 // The first access to the cookie store initializes it. This method should be |
| 457 // called before any access to the cookie store. | 452 // called before any access to the cookie store. |
| 458 void MarkCookieStoreAsInitialized(); | 453 void MarkCookieStoreAsInitialized(); |
| 459 | 454 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 virtual ~PersistentCookieStore() {} | 804 virtual ~PersistentCookieStore() {} |
| 810 | 805 |
| 811 private: | 806 private: |
| 812 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 807 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
| 813 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 808 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
| 814 }; | 809 }; |
| 815 | 810 |
| 816 } // namespace net | 811 } // namespace net |
| 817 | 812 |
| 818 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 813 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
| OLD | NEW |