| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ | 5 #ifndef IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ |
| 6 #define IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ | 6 #define IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // the backing store by OnSystemCookiesChanged, which is called by the system | 52 // the backing store by OnSystemCookiesChanged, which is called by the system |
| 53 // store once the change to the system store is written back. | 53 // store once the change to the system store is written back. |
| 54 class CookieStoreIOS : public net::CookieStore, | 54 class CookieStoreIOS : public net::CookieStore, |
| 55 public CookieNotificationObserver { | 55 public CookieNotificationObserver { |
| 56 public: | 56 public: |
| 57 // Creates a CookieStoreIOS with a default value of | 57 // Creates a CookieStoreIOS with a default value of |
| 58 // |NSHTTPCookieStorage sharedCookieStorage| as the system's cookie store. | 58 // |NSHTTPCookieStorage sharedCookieStorage| as the system's cookie store. |
| 59 explicit CookieStoreIOS( | 59 explicit CookieStoreIOS( |
| 60 net::CookieMonster::PersistentCookieStore* persistent_store); | 60 net::CookieMonster::PersistentCookieStore* persistent_store); |
| 61 | 61 |
| 62 explicit CookieStoreIOS( | |
| 63 net::CookieMonster::PersistentCookieStore* persistent_store, | |
| 64 NSHTTPCookieStorage* system_store); | |
| 65 | |
| 66 ~CookieStoreIOS() override; | 62 ~CookieStoreIOS() override; |
| 67 | 63 |
| 68 enum CookiePolicy { ALLOW, BLOCK }; | 64 enum CookiePolicy { ALLOW, BLOCK }; |
| 69 | 65 |
| 70 // Create an instance of CookieStoreIOS that is generated from the cookies | 66 // Create an instance of CookieStoreIOS that is generated from the cookies |
| 71 // stored in |cookie_storage|. The CookieStoreIOS uses the |cookie_storage| | 67 // stored in |cookie_storage|. The CookieStoreIOS uses the |cookie_storage| |
| 72 // as its default backend and is initially synchronized with it. | 68 // as its default backend and is initially synchronized with it. |
| 73 // Apple does not persist the cookies' creation dates in NSHTTPCookieStorage, | 69 // Apple does not persist the cookies' creation dates in NSHTTPCookieStorage, |
| 74 // so callers should not expect these values to be populated. | 70 // so callers should not expect these values to be populated. |
| 75 static std::unique_ptr<CookieStoreIOS> CreateCookieStore( | 71 static std::unique_ptr<CookieStoreIOS> CreateCookieStore( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 bool IsEphemeral() override; | 137 bool IsEphemeral() override; |
| 142 | 138 |
| 143 // Changes the synchronization of the store. | 139 // Changes the synchronization of the store. |
| 144 // If |synchronized| is true, then the system cookie store is used as a | 140 // If |synchronized| is true, then the system cookie store is used as a |
| 145 // backend, else |cookie_monster_| is used. Cookies are moved from one to | 141 // backend, else |cookie_monster_| is used. Cookies are moved from one to |
| 146 // the other accordingly. | 142 // the other accordingly. |
| 147 // TODO(crbug.com/676144): Remove this method. It is used only in tests. | 143 // TODO(crbug.com/676144): Remove this method. It is used only in tests. |
| 148 void SetSynchronizedWithSystemStore(bool synchronized); | 144 void SetSynchronizedWithSystemStore(bool synchronized); |
| 149 | 145 |
| 150 private: | 146 private: |
| 147 CookieStoreIOS( |
| 148 net::CookieMonster::PersistentCookieStore* persistent_store, |
| 149 NSHTTPCookieStorage* system_store); |
| 150 |
| 151 // For tests. | 151 // For tests. |
| 152 friend struct CookieStoreIOSTestTraits; | 152 friend struct CookieStoreIOSTestTraits; |
| 153 | 153 |
| 154 enum SynchronizationState { | 154 enum SynchronizationState { |
| 155 NOT_SYNCHRONIZED, // Uses CookieMonster as backend. | 155 NOT_SYNCHRONIZED, // Uses CookieMonster as backend. |
| 156 SYNCHRONIZING, // Moves from NSHTTPCookieStorage to CookieMonster. | 156 SYNCHRONIZING, // Moves from NSHTTPCookieStorage to CookieMonster. |
| 157 SYNCHRONIZED // Uses NSHTTPCookieStorage as backend. | 157 SYNCHRONIZED // Uses NSHTTPCookieStorage as backend. |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 // Cookie fliter for DeleteCookiesWithFilter(). | 160 // Cookie fliter for DeleteCookiesWithFilter(). |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 hook_map_; | 306 hook_map_; |
| 307 | 307 |
| 308 base::WeakPtrFactory<CookieStoreIOS> weak_factory_; | 308 base::WeakPtrFactory<CookieStoreIOS> weak_factory_; |
| 309 | 309 |
| 310 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS); | 310 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS); |
| 311 }; | 311 }; |
| 312 | 312 |
| 313 } // namespace net | 313 } // namespace net |
| 314 | 314 |
| 315 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ | 315 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ |
| OLD | NEW |