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 #include "ios/net/cookies/cookie_store_ios.h" | 5 #include "ios/net/cookies/cookie_store_ios.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/threading/thread_restrictions.h" | 26 #include "base/threading/thread_restrictions.h" |
27 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
28 #include "ios/net/cookies/cookie_creation_time_manager.h" | 28 #include "ios/net/cookies/cookie_creation_time_manager.h" |
29 #include "ios/net/cookies/cookie_store_ios_client.h" | 29 #include "ios/net/cookies/cookie_store_ios_client.h" |
30 #include "ios/net/cookies/system_cookie_util.h" | 30 #include "ios/net/cookies/system_cookie_util.h" |
31 #import "net/base/mac/url_conversions.h" | 31 #import "net/base/mac/url_conversions.h" |
32 #include "net/cookies/cookie_util.h" | 32 #include "net/cookies/cookie_util.h" |
33 #include "net/cookies/parsed_cookie.h" | 33 #include "net/cookies/parsed_cookie.h" |
34 #include "url/gurl.h" | 34 #include "url/gurl.h" |
35 | 35 |
| 36 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 37 #error "This file requires ARC support." |
| 38 #endif |
| 39 |
36 namespace net { | 40 namespace net { |
37 | 41 |
38 namespace { | 42 namespace { |
39 | 43 |
40 #if !defined(NDEBUG) | 44 #if !defined(NDEBUG) |
41 // The current cookie store. This weak pointer must not be used to do actual | 45 // The current cookie store. This weak pointer must not be used to do actual |
42 // work. Its only purpose is to check that there is only one synchronized | 46 // work. Its only purpose is to check that there is only one synchronized |
43 // cookie store. | 47 // cookie store. |
44 CookieStoreIOS* g_current_synchronized_store = nullptr; | 48 CookieStoreIOS* g_current_synchronized_store = nullptr; |
45 #endif | 49 #endif |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 CookieStoreIOS::CookieStoreIOS( | 290 CookieStoreIOS::CookieStoreIOS( |
287 net::CookieMonster::PersistentCookieStore* persistent_store) | 291 net::CookieMonster::PersistentCookieStore* persistent_store) |
288 : CookieStoreIOS(persistent_store, | 292 : CookieStoreIOS(persistent_store, |
289 [NSHTTPCookieStorage sharedHTTPCookieStorage]) { | 293 [NSHTTPCookieStorage sharedHTTPCookieStorage]) { |
290 } | 294 } |
291 | 295 |
292 CookieStoreIOS::CookieStoreIOS( | 296 CookieStoreIOS::CookieStoreIOS( |
293 net::CookieMonster::PersistentCookieStore* persistent_store, | 297 net::CookieMonster::PersistentCookieStore* persistent_store, |
294 NSHTTPCookieStorage* system_store) | 298 NSHTTPCookieStorage* system_store) |
295 : cookie_monster_(new net::CookieMonster(persistent_store, nullptr)), | 299 : cookie_monster_(new net::CookieMonster(persistent_store, nullptr)), |
296 system_store_([system_store retain]), | 300 system_store_(system_store), |
297 creation_time_manager_(new CookieCreationTimeManager), | 301 creation_time_manager_(new CookieCreationTimeManager), |
298 metrics_enabled_(false), | 302 metrics_enabled_(false), |
299 flush_delay_(base::TimeDelta::FromSeconds(10)), | 303 flush_delay_(base::TimeDelta::FromSeconds(10)), |
300 synchronization_state_(NOT_SYNCHRONIZED), | 304 synchronization_state_(NOT_SYNCHRONIZED), |
301 cookie_cache_(new CookieCache()), | 305 cookie_cache_(new CookieCache()), |
302 weak_factory_(this) { | 306 weak_factory_(this) { |
303 DCHECK(system_store); | 307 DCHECK(system_store); |
304 | 308 |
305 NotificationTrampoline::GetInstance()->AddObserver(this); | 309 NotificationTrampoline::GetInstance()->AddObserver(this); |
306 | 310 |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 weak_factory_.GetWeakPtr(), callback); | 1159 weak_factory_.GetWeakPtr(), callback); |
1156 } | 1160 } |
1157 | 1161 |
1158 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { | 1162 base::Closure CookieStoreIOS::WrapClosure(const base::Closure& callback) { |
1159 DCHECK(thread_checker_.CalledOnValidThread()); | 1163 DCHECK(thread_checker_.CalledOnValidThread()); |
1160 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, | 1164 return base::Bind(&CookieStoreIOS::UpdateCachesAfterClosure, |
1161 weak_factory_.GetWeakPtr(), callback); | 1165 weak_factory_.GetWeakPtr(), callback); |
1162 } | 1166 } |
1163 | 1167 |
1164 } // namespace net | 1168 } // namespace net |
OLD | NEW |