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> |
11 #include <stdint.h> | 11 #include <stdint.h> |
12 | 12 |
13 #include <deque> | 13 #include <deque> |
14 #include <map> | 14 #include <map> |
| 15 #include <memory> |
15 #include <queue> | 16 #include <queue> |
16 #include <set> | 17 #include <set> |
17 #include <string> | 18 #include <string> |
18 #include <utility> | 19 #include <utility> |
19 #include <vector> | 20 #include <vector> |
20 | 21 |
21 #include "base/callback_forward.h" | 22 #include "base/callback_forward.h" |
22 #include "base/gtest_prod_util.h" | 23 #include "base/gtest_prod_util.h" |
23 #include "base/macros.h" | 24 #include "base/macros.h" |
24 #include "base/memory/linked_ptr.h" | 25 #include "base/memory/linked_ptr.h" |
25 #include "base/memory/ref_counted.h" | 26 #include "base/memory/ref_counted.h" |
26 #include "base/memory/scoped_ptr.h" | |
27 #include "base/memory/weak_ptr.h" | 27 #include "base/memory/weak_ptr.h" |
28 #include "base/threading/thread_checker.h" | 28 #include "base/threading/thread_checker.h" |
29 #include "base/time/time.h" | 29 #include "base/time/time.h" |
30 #include "net/base/net_export.h" | 30 #include "net/base/net_export.h" |
31 #include "net/cookies/canonical_cookie.h" | 31 #include "net/cookies/canonical_cookie.h" |
32 #include "net/cookies/cookie_constants.h" | 32 #include "net/cookies/cookie_constants.h" |
33 #include "net/cookies/cookie_store.h" | 33 #include "net/cookies/cookie_store.h" |
34 #include "url/gurl.h" | 34 #include "url/gurl.h" |
35 | 35 |
36 namespace base { | 36 namespace base { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 void SetPersistSessionCookies(bool persist_session_cookies); | 203 void SetPersistSessionCookies(bool persist_session_cookies); |
204 | 204 |
205 // Determines if the scheme of the URL is a scheme that cookies will be | 205 // Determines if the scheme of the URL is a scheme that cookies will be |
206 // stored for. | 206 // stored for. |
207 bool IsCookieableScheme(const std::string& scheme); | 207 bool IsCookieableScheme(const std::string& scheme); |
208 | 208 |
209 // The default list of schemes the cookie monster can handle. | 209 // The default list of schemes the cookie monster can handle. |
210 static const char* const kDefaultCookieableSchemes[]; | 210 static const char* const kDefaultCookieableSchemes[]; |
211 static const int kDefaultCookieableSchemesCount; | 211 static const int kDefaultCookieableSchemesCount; |
212 | 212 |
213 scoped_ptr<CookieChangedSubscription> AddCallbackForCookie( | 213 std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie( |
214 const GURL& url, | 214 const GURL& url, |
215 const std::string& name, | 215 const std::string& name, |
216 const CookieChangedCallback& callback) override; | 216 const CookieChangedCallback& callback) override; |
217 | 217 |
218 bool IsEphemeral() override; | 218 bool IsEphemeral() override; |
219 | 219 |
220 private: | 220 private: |
221 // For queueing the cookie monster calls. | 221 // For queueing the cookie monster calls. |
222 class CookieMonsterTask; | 222 class CookieMonsterTask; |
223 template <typename Result> | 223 template <typename Result> |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // Helper function that sets cookies with more control. | 512 // Helper function that sets cookies with more control. |
513 // Not exposed as we don't want callers to have the ability | 513 // Not exposed as we don't want callers to have the ability |
514 // to specify (potentially duplicate) creation times. | 514 // to specify (potentially duplicate) creation times. |
515 bool SetCookieWithCreationTimeAndOptions(const GURL& url, | 515 bool SetCookieWithCreationTimeAndOptions(const GURL& url, |
516 const std::string& cookie_line, | 516 const std::string& cookie_line, |
517 const base::Time& creation_time, | 517 const base::Time& creation_time, |
518 const CookieOptions& options); | 518 const CookieOptions& options); |
519 | 519 |
520 // Helper function that sets a canonical cookie, deleting equivalents and | 520 // Helper function that sets a canonical cookie, deleting equivalents and |
521 // performing garbage collection. | 521 // performing garbage collection. |
522 bool SetCanonicalCookie(scoped_ptr<CanonicalCookie> cc, | 522 bool SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cc, |
523 const CookieOptions& options); | 523 const CookieOptions& options); |
524 | 524 |
525 // Helper function calling SetCanonicalCookie() for all cookies in |list|. | 525 // Helper function calling SetCanonicalCookie() for all cookies in |list|. |
526 bool SetCanonicalCookies(const CookieList& list); | 526 bool SetCanonicalCookies(const CookieList& list); |
527 | 527 |
528 void InternalUpdateCookieAccessTime(CanonicalCookie* cc, | 528 void InternalUpdateCookieAccessTime(CanonicalCookie* cc, |
529 const base::Time& current_time); | 529 const base::Time& current_time); |
530 | 530 |
531 // |deletion_cause| argument is used for collecting statistics and choosing | 531 // |deletion_cause| argument is used for collecting statistics and choosing |
532 // the correct CookieMonsterDelegate::ChangeCause for OnCookieChanged | 532 // the correct CookieMonsterDelegate::ChangeCause for OnCookieChanged |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 virtual ~PersistentCookieStore() {} | 807 virtual ~PersistentCookieStore() {} |
808 | 808 |
809 private: | 809 private: |
810 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 810 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
811 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 811 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
812 }; | 812 }; |
813 | 813 |
814 } // namespace net | 814 } // namespace net |
815 | 815 |
816 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 816 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
OLD | NEW |