Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: ios/net/cookies/cookie_store_ios.h

Issue 2603403002: [ios] Removed CookieStoreIOS::SetSynchronizedWithSystemStore. (Closed)
Patch Set: Removed g_current_synchronized_store Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ios/net/cookies/cookie_store_ios.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void DeleteSessionCookiesAsync(const DeleteCallback& callback) override; 129 void DeleteSessionCookiesAsync(const DeleteCallback& callback) override;
130 void FlushStore(const base::Closure& callback) override; 130 void FlushStore(const base::Closure& callback) override;
131 131
132 std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie( 132 std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie(
133 const GURL& url, 133 const GURL& url,
134 const std::string& name, 134 const std::string& name,
135 const CookieChangedCallback& callback) override; 135 const CookieChangedCallback& callback) override;
136 136
137 bool IsEphemeral() override; 137 bool IsEphemeral() override;
138 138
139 // Changes the synchronization of the store.
140 // If |synchronized| is true, then the system cookie store is used as a
141 // backend, else |cookie_monster_| is used. Cookies are moved from one to
142 // the other accordingly.
143 // TODO(crbug.com/676144): Remove this method. It is used only in tests.
144 void SetSynchronizedWithSystemStore(bool synchronized);
145
146 private: 139 private:
147 CookieStoreIOS( 140 CookieStoreIOS(
148 net::CookieMonster::PersistentCookieStore* persistent_store, 141 net::CookieMonster::PersistentCookieStore* persistent_store,
149 NSHTTPCookieStorage* system_store); 142 NSHTTPCookieStorage* system_store);
150 143
151 // For tests. 144 // For tests.
152 friend struct CookieStoreIOSTestTraits; 145 friend struct CookieStoreIOSTestTraits;
153 146
154 enum SynchronizationState { 147 enum SynchronizationState {
155 NOT_SYNCHRONIZED, // Uses CookieMonster as backend. 148 NOT_SYNCHRONIZED, // Uses CookieMonster as backend.
156 SYNCHRONIZING, // Moves from NSHTTPCookieStorage to CookieMonster. 149 SYNCHRONIZING, // Moves from NSHTTPCookieStorage to CookieMonster.
157 SYNCHRONIZED // Uses NSHTTPCookieStorage as backend. 150 SYNCHRONIZED // Uses NSHTTPCookieStorage as backend.
158 }; 151 };
159 152
160 // Cookie fliter for DeleteCookiesWithFilter(). 153 // Cookie fliter for DeleteCookiesWithFilter().
161 // Takes a cookie and a creation time and returns true if the cookie must be 154 // Takes a cookie and a creation time and returns true if the cookie must be
162 // deleted. 155 // deleted.
163 typedef base::Callback<bool(NSHTTPCookie*, base::Time)> CookieFilterFunction; 156 typedef base::Callback<bool(NSHTTPCookie*, base::Time)> CookieFilterFunction;
164 157
165 // Clears the system cookie store. 158 // Clears the system cookie store.
166 void ClearSystemStore(); 159 void ClearSystemStore();
167 // Returns true if the system cookie store policy is 160 // Returns true if the system cookie store policy is
168 // |NSHTTPCookieAcceptPolicyAlways|. 161 // |NSHTTPCookieAcceptPolicyAlways|.
169 bool SystemCookiesAllowed(); 162 bool SystemCookiesAllowed();
170 // Converts |cookies| to NSHTTPCookie and add them to the system store.
171 void AddCookiesToSystemStore(const net::CookieList& cookies);
172 // Copies the cookies to the backing CookieMonster. If the cookie store is not 163 // Copies the cookies to the backing CookieMonster. If the cookie store is not
173 // synchronized with the system store, this is a no-op. 164 // synchronized with the system store, this is a no-op.
174 void WriteToCookieMonster(NSArray* system_cookies); 165 void WriteToCookieMonster(NSArray* system_cookies);
175 // Runs all the pending tasks.
176 void RunAllPendingTasks();
177 166
178 // Inherited CookieNotificationObserver methods. 167 // Inherited CookieNotificationObserver methods.
179 void OnSystemCookiesChanged() override; 168 void OnSystemCookiesChanged() override;
180 169
181 void DeleteCookiesWithFilter(const CookieFilterFunction& filter, 170 void DeleteCookiesWithFilter(const CookieFilterFunction& filter,
182 const DeleteCallback& callback); 171 const DeleteCallback& callback);
183 172
184 std::unique_ptr<net::CookieMonster> cookie_monster_; 173 std::unique_ptr<net::CookieMonster> cookie_monster_;
185 base::scoped_nsobject<NSHTTPCookieStorage> system_store_; 174 base::scoped_nsobject<NSHTTPCookieStorage> system_store_;
186 std::unique_ptr<CookieCreationTimeManager> creation_time_manager_; 175 std::unique_ptr<CookieCreationTimeManager> creation_time_manager_;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 hook_map_; 295 hook_map_;
307 296
308 base::WeakPtrFactory<CookieStoreIOS> weak_factory_; 297 base::WeakPtrFactory<CookieStoreIOS> weak_factory_;
309 298
310 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS); 299 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS);
311 }; 300 };
312 301
313 } // namespace net 302 } // namespace net
314 303
315 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ 304 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_
OLDNEW
« no previous file with comments | « no previous file | ios/net/cookies/cookie_store_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698