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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, | 181 void DeleteCanonicalCookieAsync(const CanonicalCookie& cookie, |
182 const DeleteCallback& callback) override; | 182 const DeleteCallback& callback) override; |
183 void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, | 183 void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, |
184 const base::Time& delete_end, | 184 const base::Time& delete_end, |
185 const DeleteCallback& callback) override; | 185 const DeleteCallback& callback) override; |
186 void DeleteAllCreatedBetweenForHostAsync( | 186 void DeleteAllCreatedBetweenForHostAsync( |
187 const base::Time delete_begin, | 187 const base::Time delete_begin, |
188 const base::Time delete_end, | 188 const base::Time delete_end, |
189 const GURL& url, | 189 const GURL& url, |
190 const DeleteCallback& callback) override; | 190 const DeleteCallback& callback) override; |
| 191 void DeleteAllCreatedBetweenWithPredicateAsync( |
| 192 const base::Time& delete_begin, |
| 193 const base::Time& delete_end, |
| 194 const base::Callback<bool(const CanonicalCookie&)>& predicate, |
| 195 const DeleteCallback& callback) override; |
191 void DeleteSessionCookiesAsync(const DeleteCallback&) override; | 196 void DeleteSessionCookiesAsync(const DeleteCallback&) override; |
192 void FlushStore(const base::Closure& callback) override; | 197 void FlushStore(const base::Closure& callback) override; |
193 void SetForceKeepSessionState() override; | 198 void SetForceKeepSessionState() override; |
194 | 199 |
195 // Resets the list of cookieable schemes to the supplied schemes. Does | 200 // Resets the list of cookieable schemes to the supplied schemes. Does |
196 // nothing if called after first use of the instance (i.e. after the | 201 // nothing if called after first use of the instance (i.e. after the |
197 // instance initialization process). | 202 // instance initialization process). |
198 void SetCookieableSchemes(const std::vector<std::string>& schemes); | 203 void SetCookieableSchemes(const std::vector<std::string>& schemes); |
199 | 204 |
200 // Enables writing session cookies into the cookie database. If this this | 205 // Enables writing session cookies into the cookie database. If this this |
(...skipping 14 matching lines...) Expand all Loading... |
215 const std::string& name, | 220 const std::string& name, |
216 const CookieChangedCallback& callback) override; | 221 const CookieChangedCallback& callback) override; |
217 | 222 |
218 private: | 223 private: |
219 // For queueing the cookie monster calls. | 224 // For queueing the cookie monster calls. |
220 class CookieMonsterTask; | 225 class CookieMonsterTask; |
221 template <typename Result> | 226 template <typename Result> |
222 class DeleteTask; | 227 class DeleteTask; |
223 class DeleteAllCreatedBetweenTask; | 228 class DeleteAllCreatedBetweenTask; |
224 class DeleteAllCreatedBetweenForHostTask; | 229 class DeleteAllCreatedBetweenForHostTask; |
| 230 class DeleteAllCreatedBetweenWithPredicateTask; |
225 class DeleteCookieTask; | 231 class DeleteCookieTask; |
226 class DeleteCanonicalCookieTask; | 232 class DeleteCanonicalCookieTask; |
227 class GetCookieListForURLWithOptionsTask; | 233 class GetCookieListForURLWithOptionsTask; |
228 class GetAllCookiesTask; | 234 class GetAllCookiesTask; |
229 class GetCookiesWithOptionsTask; | 235 class GetCookiesWithOptionsTask; |
230 class GetCookieListWithOptionsTask; | 236 class GetCookieListWithOptionsTask; |
231 class SetAllCookiesTask; | 237 class SetAllCookiesTask; |
232 class SetCookieWithDetailsTask; | 238 class SetCookieWithDetailsTask; |
233 class SetCookieWithOptionsTask; | 239 class SetCookieWithOptionsTask; |
234 class DeleteSessionCookiesTask; | 240 class DeleteSessionCookiesTask; |
235 | 241 |
236 // Testing support. | 242 // Testing support. |
237 // For SetCookieWithCreationTime. | 243 // For SetCookieWithCreationTime. |
238 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, | 244 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, |
239 TestCookieDeleteAllCreatedBetweenTimestamps); | 245 TestCookieDeleteAllCreatedBetweenTimestamps); |
| 246 FRIEND_TEST_ALL_PREFIXES( |
| 247 CookieMonsterTest, |
| 248 TestCookieDeleteAllCreatedBetweenTimestampsWithPredicate); |
240 | 249 |
241 // For gargage collection constants. | 250 // For gargage collection constants. |
242 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestHostGarbageCollection); | 251 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestHostGarbageCollection); |
243 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestTotalGarbageCollection); | 252 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestTotalGarbageCollection); |
244 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, GarbageCollectionTriggers); | 253 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, GarbageCollectionTriggers); |
245 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestGCTimes); | 254 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestGCTimes); |
246 | 255 |
247 // For validation of key values. | 256 // For validation of key values. |
248 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestDomainTree); | 257 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestDomainTree); |
249 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestImport); | 258 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestImport); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 CookieList GetCookieListWithOptions(const GURL& url, | 410 CookieList GetCookieListWithOptions(const GURL& url, |
402 const CookieOptions& options); | 411 const CookieOptions& options); |
403 | 412 |
404 int DeleteAllCreatedBetween(const base::Time& delete_begin, | 413 int DeleteAllCreatedBetween(const base::Time& delete_begin, |
405 const base::Time& delete_end); | 414 const base::Time& delete_end); |
406 | 415 |
407 int DeleteAllCreatedBetweenForHost(const base::Time delete_begin, | 416 int DeleteAllCreatedBetweenForHost(const base::Time delete_begin, |
408 const base::Time delete_end, | 417 const base::Time delete_end, |
409 const GURL& url); | 418 const GURL& url); |
410 | 419 |
| 420 // Predicate will be called with the calling thread. |
| 421 int DeleteAllCreatedBetweenWithPredicate( |
| 422 const base::Time& delete_begin, |
| 423 const base::Time& delete_end, |
| 424 const base::Callback<bool(const CanonicalCookie&)>& predicate); |
| 425 |
411 bool SetCookieWithOptions(const GURL& url, | 426 bool SetCookieWithOptions(const GURL& url, |
412 const std::string& cookie_line, | 427 const std::string& cookie_line, |
413 const CookieOptions& options); | 428 const CookieOptions& options); |
414 | 429 |
415 std::string GetCookiesWithOptions(const GURL& url, | 430 std::string GetCookiesWithOptions(const GURL& url, |
416 const CookieOptions& options); | 431 const CookieOptions& options); |
417 | 432 |
418 void DeleteCookie(const GURL& url, const std::string& cookie_name); | 433 void DeleteCookie(const GURL& url, const std::string& cookie_name); |
419 | 434 |
420 int DeleteCanonicalCookie(const CanonicalCookie& cookie); | 435 int DeleteCanonicalCookie(const CanonicalCookie& cookie); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 virtual ~PersistentCookieStore() {} | 803 virtual ~PersistentCookieStore() {} |
789 | 804 |
790 private: | 805 private: |
791 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 806 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
792 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 807 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
793 }; | 808 }; |
794 | 809 |
795 } // namespace net | 810 } // namespace net |
796 | 811 |
797 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 812 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
OLD | NEW |