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 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 | 925 |
926 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); | 926 DISALLOW_COPY_AND_ASSIGN(ParsedCookie); |
927 }; | 927 }; |
928 | 928 |
929 typedef base::RefCountedThreadSafe<CookieMonster::PersistentCookieStore> | 929 typedef base::RefCountedThreadSafe<CookieMonster::PersistentCookieStore> |
930 RefcountedPersistentCookieStore; | 930 RefcountedPersistentCookieStore; |
931 | 931 |
932 class CookieMonster::PersistentCookieStore | 932 class CookieMonster::PersistentCookieStore |
933 : public RefcountedPersistentCookieStore { | 933 : public RefcountedPersistentCookieStore { |
934 public: | 934 public: |
935 virtual ~PersistentCookieStore() {} | |
936 | |
937 typedef base::Callback<void(const std::vector< | 935 typedef base::Callback<void(const std::vector< |
938 CookieMonster::CanonicalCookie*>&)> LoadedCallback; | 936 CookieMonster::CanonicalCookie*>&)> LoadedCallback; |
939 | 937 |
940 // Initializes the store and retrieves the existing cookies. This will be | 938 // Initializes the store and retrieves the existing cookies. This will be |
941 // called only once at startup. The callback will return all the cookies | 939 // called only once at startup. The callback will return all the cookies |
942 // that are not yet returned to CookieMonster by previous priority loads. | 940 // that are not yet returned to CookieMonster by previous priority loads. |
943 virtual void Load(const LoadedCallback& loaded_callback) = 0; | 941 virtual void Load(const LoadedCallback& loaded_callback) = 0; |
944 | 942 |
945 // Does a priority load of all cookies for the domain key (eTLD+1). The | 943 // Does a priority load of all cookies for the domain key (eTLD+1). The |
946 // callback will return all the cookies that are not yet returned by previous | 944 // callback will return all the cookies that are not yet returned by previous |
947 // loads, which includes cookies for the requested domain key if they are not | 945 // loads, which includes cookies for the requested domain key if they are not |
948 // already returned, plus all cookies that are chain-loaded and not yet | 946 // already returned, plus all cookies that are chain-loaded and not yet |
949 // returned to CookieMonster. | 947 // returned to CookieMonster. |
950 virtual void LoadCookiesForKey(const std::string& key, | 948 virtual void LoadCookiesForKey(const std::string& key, |
951 const LoadedCallback& loaded_callback) = 0; | 949 const LoadedCallback& loaded_callback) = 0; |
952 | 950 |
953 virtual void AddCookie(const CanonicalCookie& cc) = 0; | 951 virtual void AddCookie(const CanonicalCookie& cc) = 0; |
954 virtual void UpdateCookieAccessTime(const CanonicalCookie& cc) = 0; | 952 virtual void UpdateCookieAccessTime(const CanonicalCookie& cc) = 0; |
955 virtual void DeleteCookie(const CanonicalCookie& cc) = 0; | 953 virtual void DeleteCookie(const CanonicalCookie& cc) = 0; |
956 | 954 |
957 // Sets the value of the user preference whether the persistent storage | 955 // Sets the value of the user preference whether the persistent storage |
958 // must be deleted upon destruction. | 956 // must be deleted upon destruction. |
959 virtual void SetClearLocalStateOnExit(bool clear_local_state) = 0; | 957 virtual void SetClearLocalStateOnExit(bool clear_local_state) = 0; |
960 | 958 |
961 // Flushes the store and posts |callback| when complete. | 959 // Flushes the store and posts |callback| when complete. |
962 virtual void Flush(const base::Closure& callback) = 0; | 960 virtual void Flush(const base::Closure& callback) = 0; |
963 | 961 |
964 protected: | 962 protected: |
965 PersistentCookieStore() {} | 963 PersistentCookieStore() {} |
| 964 virtual ~PersistentCookieStore() {} |
966 | 965 |
967 private: | 966 private: |
| 967 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
968 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 968 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
969 }; | 969 }; |
970 | 970 |
971 class CookieList : public std::vector<CookieMonster::CanonicalCookie> { | 971 class CookieList : public std::vector<CookieMonster::CanonicalCookie> { |
972 }; | 972 }; |
973 | 973 |
974 } // namespace net | 974 } // namespace net |
975 | 975 |
976 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 976 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
OLD | NEW |