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 <deque> | 10 #include <deque> |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // WARNING: THE CALLBACK WILL RUN ON A RANDOM THREAD. IT MUST BE THREAD SAFE. | 232 // WARNING: THE CALLBACK WILL RUN ON A RANDOM THREAD. IT MUST BE THREAD SAFE. |
233 // It may be posted to the current thread, or it may run on the thread that | 233 // It may be posted to the current thread, or it may run on the thread that |
234 // actually does the flushing. Your Task should generally post a notification | 234 // actually does the flushing. Your Task should generally post a notification |
235 // to the thread you actually want to be notified on. | 235 // to the thread you actually want to be notified on. |
236 void FlushStore(const base::Closure& callback); | 236 void FlushStore(const base::Closure& callback); |
237 | 237 |
238 // CookieStore implementation. | 238 // CookieStore implementation. |
239 | 239 |
240 // Sets the cookies specified by |cookie_list| returned from |url| | 240 // Sets the cookies specified by |cookie_list| returned from |url| |
241 // with options |options| in effect. | 241 // with options |options| in effect. |
242 virtual void SetCookieWithOptionsAsync( | 242 void SetCookieWithOptionsAsync(const GURL& url, |
243 const GURL& url, | 243 const std::string& cookie_line, |
244 const std::string& cookie_line, | 244 const CookieOptions& options, |
245 const CookieOptions& options, | 245 const SetCookiesCallback& callback) override; |
246 const SetCookiesCallback& callback) override; | |
247 | 246 |
248 // Gets all cookies that apply to |url| given |options|. | 247 // Gets all cookies that apply to |url| given |options|. |
249 // The returned cookies are ordered by longest path, then earliest | 248 // The returned cookies are ordered by longest path, then earliest |
250 // creation date. | 249 // creation date. |
251 virtual void GetCookiesWithOptionsAsync( | 250 void GetCookiesWithOptionsAsync(const GURL& url, |
252 const GURL& url, | 251 const CookieOptions& options, |
253 const CookieOptions& options, | 252 const GetCookiesCallback& callback) override; |
254 const GetCookiesCallback& callback) override; | |
255 | 253 |
256 // Invokes GetAllCookiesForURLWithOptions with options set to include HTTP | 254 // Invokes GetAllCookiesForURLWithOptions with options set to include HTTP |
257 // only cookies. | 255 // only cookies. |
258 virtual void GetAllCookiesForURLAsync( | 256 void GetAllCookiesForURLAsync(const GURL& url, |
259 const GURL& url, | 257 const GetCookieListCallback& callback) override; |
260 const GetCookieListCallback& callback) override; | |
261 | 258 |
262 // Deletes all cookies with that might apply to |url| that has |cookie_name|. | 259 // Deletes all cookies with that might apply to |url| that has |cookie_name|. |
263 virtual void DeleteCookieAsync( | 260 void DeleteCookieAsync(const GURL& url, |
264 const GURL& url, const std::string& cookie_name, | 261 const std::string& cookie_name, |
265 const base::Closure& callback) override; | 262 const base::Closure& callback) override; |
266 | 263 |
267 // Deletes all of the cookies that have a creation_date greater than or equal | 264 // Deletes all of the cookies that have a creation_date greater than or equal |
268 // to |delete_begin| and less than |delete_end|. | 265 // to |delete_begin| and less than |delete_end|. |
269 // Returns the number of cookies that have been deleted. | 266 // Returns the number of cookies that have been deleted. |
270 virtual void DeleteAllCreatedBetweenAsync( | 267 void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, |
271 const base::Time& delete_begin, | 268 const base::Time& delete_end, |
272 const base::Time& delete_end, | 269 const DeleteCallback& callback) override; |
273 const DeleteCallback& callback) override; | |
274 | 270 |
275 // Deletes all of the cookies that match the host of the given URL | 271 // Deletes all of the cookies that match the host of the given URL |
276 // regardless of path and that have a creation_date greater than or | 272 // regardless of path and that have a creation_date greater than or |
277 // equal to |delete_begin| and less then |delete_end|. This includes | 273 // equal to |delete_begin| and less then |delete_end|. This includes |
278 // all http_only and secure cookies, but does not include any domain | 274 // all http_only and secure cookies, but does not include any domain |
279 // cookies that may apply to this host. | 275 // cookies that may apply to this host. |
280 // Returns the number of cookies deleted. | 276 // Returns the number of cookies deleted. |
281 virtual void DeleteAllCreatedBetweenForHostAsync( | 277 void DeleteAllCreatedBetweenForHostAsync( |
282 const base::Time delete_begin, | 278 const base::Time delete_begin, |
283 const base::Time delete_end, | 279 const base::Time delete_end, |
284 const GURL& url, | 280 const GURL& url, |
285 const DeleteCallback& callback) override; | 281 const DeleteCallback& callback) override; |
286 | 282 |
287 virtual void DeleteSessionCookiesAsync(const DeleteCallback&) override; | 283 void DeleteSessionCookiesAsync(const DeleteCallback&) override; |
288 | 284 |
289 virtual CookieMonster* GetCookieMonster() override; | 285 CookieMonster* GetCookieMonster() override; |
290 | 286 |
291 // Enables writing session cookies into the cookie database. If this this | 287 // Enables writing session cookies into the cookie database. If this this |
292 // method is called, it must be called before first use of the instance | 288 // method is called, it must be called before first use of the instance |
293 // (i.e. as part of the instance initialization process). | 289 // (i.e. as part of the instance initialization process). |
294 void SetPersistSessionCookies(bool persist_session_cookies); | 290 void SetPersistSessionCookies(bool persist_session_cookies); |
295 | 291 |
296 // Debugging method to perform various validation checks on the map. | 292 // Debugging method to perform various validation checks on the map. |
297 // Currently just checking that there are no null CanonicalCookie pointers | 293 // Currently just checking that there are no null CanonicalCookie pointers |
298 // in the map. | 294 // in the map. |
299 // Argument |arg| is to allow retaining of arbitrary data if the CHECKs | 295 // Argument |arg| is to allow retaining of arbitrary data if the CHECKs |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 DELETE_COOKIE_LAST_ENTRY | 397 DELETE_COOKIE_LAST_ENTRY |
402 }; | 398 }; |
403 | 399 |
404 // The number of days since last access that cookies will not be subject | 400 // The number of days since last access that cookies will not be subject |
405 // to global garbage collection. | 401 // to global garbage collection. |
406 static const int kSafeFromGlobalPurgeDays; | 402 static const int kSafeFromGlobalPurgeDays; |
407 | 403 |
408 // Record statistics every kRecordStatisticsIntervalSeconds of uptime. | 404 // Record statistics every kRecordStatisticsIntervalSeconds of uptime. |
409 static const int kRecordStatisticsIntervalSeconds = 10 * 60; | 405 static const int kRecordStatisticsIntervalSeconds = 10 * 60; |
410 | 406 |
411 virtual ~CookieMonster(); | 407 ~CookieMonster() override; |
412 | 408 |
413 // The following are synchronous calls to which the asynchronous methods | 409 // The following are synchronous calls to which the asynchronous methods |
414 // delegate either immediately (if the store is loaded) or through a deferred | 410 // delegate either immediately (if the store is loaded) or through a deferred |
415 // task (if the store is not yet loaded). | 411 // task (if the store is not yet loaded). |
416 bool SetCookieWithDetails(const GURL& url, | 412 bool SetCookieWithDetails(const GURL& url, |
417 const std::string& name, | 413 const std::string& name, |
418 const std::string& value, | 414 const std::string& value, |
419 const std::string& domain, | 415 const std::string& domain, |
420 const std::string& path, | 416 const std::string& path, |
421 const base::Time& expiration_time, | 417 const base::Time& expiration_time, |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 virtual ~PersistentCookieStore() {} | 775 virtual ~PersistentCookieStore() {} |
780 | 776 |
781 private: | 777 private: |
782 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 778 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
783 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 779 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
784 }; | 780 }; |
785 | 781 |
786 } // namespace net | 782 } // namespace net |
787 | 783 |
788 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 784 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
OLD | NEW |