Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ios/net/cookies/cookie_store_ios_persistent.h" | |
|
Eugene But (OOO till 7-30)
2017/01/23 17:37:48
s/include/import
maksims (do not use this acc)
2017/01/24 10:23:46
Done.
| |
| 6 | |
| 7 #import <Foundation/Foundation.h> | |
| 8 | |
| 9 #include "ios/net/cookies/system_cookie_util.h" | |
| 10 #include "net/cookies/cookie_monster.h" | |
| 11 | |
| 12 namespace net { | |
| 13 | |
| 14 #pragma mark - | |
| 15 #pragma mark CookieStoreIOSPersistent | |
| 16 | |
| 17 CookieStoreIOSPersistent::CookieStoreIOSPersistent( | |
| 18 net::CookieMonster::PersistentCookieStore* persistent_store) | |
| 19 : CookieStoreIOS(SynchronizationState::NOT_SYNCHRONIZED, | |
| 20 persistent_store, | |
| 21 [NSHTTPCookieStorage sharedHTTPCookieStorage]) {} | |
| 22 | |
| 23 CookieStoreIOSPersistent::~CookieStoreIOSPersistent() {} | |
| 24 | |
| 25 #pragma mark - | |
| 26 #pragma mark CookieStoreIOSPersistent methods | |
| 27 | |
| 28 void CookieStoreIOSPersistent::SetCookieWithOptionsAsync( | |
| 29 const GURL& url, | |
| 30 const std::string& cookie_line, | |
| 31 const net::CookieOptions& options, | |
| 32 const SetCookiesCallback& callback) { | |
| 33 DCHECK(thread_checker().CalledOnValidThread()); | |
| 34 | |
| 35 cookie_monster()->SetCookieWithOptionsAsync(url, cookie_line, options, | |
| 36 WrapSetCallback(callback)); | |
| 37 } | |
| 38 | |
| 39 void CookieStoreIOSPersistent::SetCookieWithDetailsAsync( | |
| 40 const GURL& url, | |
| 41 const std::string& name, | |
| 42 const std::string& value, | |
| 43 const std::string& domain, | |
| 44 const std::string& path, | |
| 45 base::Time creation_time, | |
| 46 base::Time expiration_time, | |
| 47 base::Time last_access_time, | |
| 48 bool secure, | |
| 49 bool http_only, | |
| 50 CookieSameSite same_site, | |
| 51 bool enforce_strict_secure, | |
| 52 CookiePriority priority, | |
| 53 const SetCookiesCallback& callback) { | |
| 54 DCHECK(thread_checker().CalledOnValidThread()); | |
| 55 | |
| 56 cookie_monster()->SetCookieWithDetailsAsync( | |
| 57 url, name, value, domain, path, creation_time, expiration_time, | |
| 58 last_access_time, secure, http_only, same_site, enforce_strict_secure, | |
| 59 priority, WrapSetCallback(callback)); | |
| 60 } | |
| 61 | |
| 62 void CookieStoreIOSPersistent::GetCookiesWithOptionsAsync( | |
| 63 const GURL& url, | |
| 64 const net::CookieOptions& options, | |
| 65 const GetCookiesCallback& callback) { | |
| 66 DCHECK(thread_checker().CalledOnValidThread()); | |
| 67 cookie_monster()->GetCookiesWithOptionsAsync(url, options, callback); | |
| 68 } | |
| 69 | |
| 70 void CookieStoreIOSPersistent::GetCookieListWithOptionsAsync( | |
| 71 const GURL& url, | |
| 72 const net::CookieOptions& options, | |
| 73 const GetCookieListCallback& callback) { | |
| 74 DCHECK(thread_checker().CalledOnValidThread()); | |
| 75 | |
| 76 cookie_monster()->GetCookieListWithOptionsAsync(url, options, callback); | |
| 77 } | |
| 78 | |
| 79 void CookieStoreIOSPersistent::GetAllCookiesAsync( | |
| 80 const GetCookieListCallback& callback) { | |
| 81 DCHECK(thread_checker().CalledOnValidThread()); | |
| 82 | |
| 83 cookie_monster()->GetAllCookiesAsync(callback); | |
| 84 } | |
| 85 | |
| 86 void CookieStoreIOSPersistent::DeleteCookieAsync( | |
| 87 const GURL& url, | |
| 88 const std::string& cookie_name, | |
| 89 const base::Closure& callback) { | |
| 90 DCHECK(thread_checker().CalledOnValidThread()); | |
| 91 | |
| 92 cookie_monster()->DeleteCookieAsync(url, cookie_name, WrapClosure(callback)); | |
| 93 } | |
| 94 | |
| 95 void CookieStoreIOSPersistent::DeleteCanonicalCookieAsync( | |
| 96 const CanonicalCookie& cookie, | |
| 97 const DeleteCallback& callback) { | |
| 98 DCHECK(thread_checker().CalledOnValidThread()); | |
| 99 | |
| 100 cookie_monster()->DeleteCanonicalCookieAsync(cookie, | |
| 101 WrapDeleteCallback(callback)); | |
| 102 } | |
| 103 | |
| 104 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenAsync( | |
| 105 const base::Time& delete_begin, | |
| 106 const base::Time& delete_end, | |
| 107 const DeleteCallback& callback) { | |
| 108 DCHECK(thread_checker().CalledOnValidThread()); | |
| 109 | |
| 110 if (metrics_enabled()) | |
| 111 ResetCookieCountMetrics(); | |
| 112 | |
| 113 cookie_monster()->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, | |
| 114 WrapDeleteCallback(callback)); | |
| 115 } | |
| 116 | |
| 117 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenWithPredicateAsync( | |
| 118 const base::Time& delete_begin, | |
| 119 const base::Time& delete_end, | |
| 120 const CookiePredicate& predicate, | |
| 121 const DeleteCallback& callback) { | |
| 122 DCHECK(thread_checker().CalledOnValidThread()); | |
| 123 | |
| 124 if (metrics_enabled()) | |
| 125 ResetCookieCountMetrics(); | |
| 126 | |
| 127 cookie_monster()->DeleteAllCreatedBetweenWithPredicateAsync( | |
| 128 delete_begin, delete_end, predicate, WrapDeleteCallback(callback)); | |
| 129 } | |
| 130 | |
| 131 void CookieStoreIOSPersistent::DeleteSessionCookiesAsync( | |
| 132 const DeleteCallback& callback) { | |
| 133 DCHECK(thread_checker().CalledOnValidThread()); | |
| 134 | |
| 135 if (metrics_enabled()) | |
| 136 ResetCookieCountMetrics(); | |
| 137 | |
| 138 cookie_monster()->DeleteSessionCookiesAsync(WrapDeleteCallback(callback)); | |
| 139 } | |
| 140 | |
| 141 } // namespace net | |
| OLD | NEW |