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 <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <memory> | 11 #include <memory> |
10 #include <string> | 12 #include <string> |
11 #include <utility> | 13 #include <utility> |
12 #include <vector> | 14 #include <vector> |
13 | 15 |
14 #include "base/callback.h" | 16 #include "base/callback.h" |
15 #include "base/cancelable_callback.h" | 17 #include "base/cancelable_callback.h" |
16 #include "base/mac/scoped_nsobject.h" | 18 #include "base/mac/scoped_nsobject.h" |
17 #include "base/macros.h" | 19 #include "base/macros.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // that hooks get run, but only after the changes have been written back to | 248 // that hooks get run, but only after the changes have been written back to |
247 // CookieMonster. To do this, the mutators wrap the user-supplied callback in | 249 // CookieMonster. To do this, the mutators wrap the user-supplied callback in |
248 // a callback which schedules an asynchronous task to synchronize the cache | 250 // a callback which schedules an asynchronous task to synchronize the cache |
249 // and run callbacks, then calls through to the user-specified callback. | 251 // and run callbacks, then calls through to the user-specified callback. |
250 // | 252 // |
251 // These three UpdateCachesAfter functions are responsible for scheduling an | 253 // These three UpdateCachesAfter functions are responsible for scheduling an |
252 // asynchronous cache update (using UpdateCachesFromCookieMonster()) and | 254 // asynchronous cache update (using UpdateCachesFromCookieMonster()) and |
253 // calling the provided callback. | 255 // calling the provided callback. |
254 | 256 |
255 void UpdateCachesAfterSet(SetCookiesCallback callback, bool success); | 257 void UpdateCachesAfterSet(SetCookiesCallback callback, bool success); |
256 void UpdateCachesAfterDelete(DeleteCallback callback, int num_deleted); | 258 void UpdateCachesAfterDelete(DeleteCallback callback, uint32_t num_deleted); |
257 void UpdateCachesAfterClosure(base::OnceClosure callback); | 259 void UpdateCachesAfterClosure(base::OnceClosure callback); |
258 | 260 |
259 // Takes an NSArray of NSHTTPCookies as returns a net::CookieList. | 261 // Takes an NSArray of NSHTTPCookies as returns a net::CookieList. |
260 // The returned cookies are ordered by longest path, then earliest | 262 // The returned cookies are ordered by longest path, then earliest |
261 // creation date. | 263 // creation date. |
262 net::CookieList CanonicalCookieListFromSystemCookies(NSArray* cookies); | 264 net::CookieList CanonicalCookieListFromSystemCookies(NSArray* cookies); |
263 | 265 |
264 // Cached values of system cookies. Only cookies which have an observer added | 266 // Cached values of system cookies. Only cookies which have an observer added |
265 // with AddCallbackForCookie are kept in this cache. | 267 // with AddCallbackForCookie are kept in this cache. |
266 std::unique_ptr<CookieCache> cookie_cache_; | 268 std::unique_ptr<CookieCache> cookie_cache_; |
267 | 269 |
268 // Callbacks for cookie changes installed by AddCallbackForCookie. | 270 // Callbacks for cookie changes installed by AddCallbackForCookie. |
269 std::map<std::pair<GURL, std::string>, | 271 std::map<std::pair<GURL, std::string>, |
270 std::unique_ptr<CookieChangedCallbackList>> | 272 std::unique_ptr<CookieChangedCallbackList>> |
271 hook_map_; | 273 hook_map_; |
272 | 274 |
273 base::WeakPtrFactory<CookieStoreIOS> weak_factory_; | 275 base::WeakPtrFactory<CookieStoreIOS> weak_factory_; |
274 | 276 |
275 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS); | 277 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS); |
276 }; | 278 }; |
277 | 279 |
278 } // namespace net | 280 } // namespace net |
279 | 281 |
280 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ | 282 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ |
OLD | NEW |