| 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 #import "ios/net/cookies/cookie_store_ios_persistent.h" |
| 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(persistent_store, |
| 20 [NSHTTPCookieStorage sharedHTTPCookieStorage]) {} |
| 21 |
| 22 CookieStoreIOSPersistent::~CookieStoreIOSPersistent() {} |
| 23 |
| 24 #pragma mark - |
| 25 #pragma mark CookieStoreIOSPersistent methods |
| 26 |
| 27 void CookieStoreIOSPersistent::SetCookieWithOptionsAsync( |
| 28 const GURL& url, |
| 29 const std::string& cookie_line, |
| 30 const net::CookieOptions& options, |
| 31 const SetCookiesCallback& callback) { |
| 32 DCHECK(thread_checker().CalledOnValidThread()); |
| 33 |
| 34 cookie_monster()->SetCookieWithOptionsAsync(url, cookie_line, options, |
| 35 WrapSetCallback(callback)); |
| 36 } |
| 37 |
| 38 void CookieStoreIOSPersistent::SetCookieWithDetailsAsync( |
| 39 const GURL& url, |
| 40 const std::string& name, |
| 41 const std::string& value, |
| 42 const std::string& domain, |
| 43 const std::string& path, |
| 44 base::Time creation_time, |
| 45 base::Time expiration_time, |
| 46 base::Time last_access_time, |
| 47 bool secure, |
| 48 bool http_only, |
| 49 CookieSameSite same_site, |
| 50 CookiePriority priority, |
| 51 const SetCookiesCallback& callback) { |
| 52 DCHECK(thread_checker().CalledOnValidThread()); |
| 53 |
| 54 cookie_monster()->SetCookieWithDetailsAsync( |
| 55 url, name, value, domain, path, creation_time, expiration_time, |
| 56 last_access_time, secure, http_only, same_site, priority, |
| 57 WrapSetCallback(callback)); |
| 58 } |
| 59 |
| 60 void CookieStoreIOSPersistent::GetCookiesWithOptionsAsync( |
| 61 const GURL& url, |
| 62 const net::CookieOptions& options, |
| 63 const GetCookiesCallback& callback) { |
| 64 DCHECK(thread_checker().CalledOnValidThread()); |
| 65 cookie_monster()->GetCookiesWithOptionsAsync(url, options, callback); |
| 66 } |
| 67 |
| 68 void CookieStoreIOSPersistent::GetCookieListWithOptionsAsync( |
| 69 const GURL& url, |
| 70 const net::CookieOptions& options, |
| 71 const GetCookieListCallback& callback) { |
| 72 DCHECK(thread_checker().CalledOnValidThread()); |
| 73 |
| 74 cookie_monster()->GetCookieListWithOptionsAsync(url, options, callback); |
| 75 } |
| 76 |
| 77 void CookieStoreIOSPersistent::GetAllCookiesAsync( |
| 78 const GetCookieListCallback& callback) { |
| 79 DCHECK(thread_checker().CalledOnValidThread()); |
| 80 cookie_monster()->GetAllCookiesAsync(callback); |
| 81 } |
| 82 |
| 83 void CookieStoreIOSPersistent::DeleteCookieAsync( |
| 84 const GURL& url, |
| 85 const std::string& cookie_name, |
| 86 const base::Closure& callback) { |
| 87 DCHECK(thread_checker().CalledOnValidThread()); |
| 88 cookie_monster()->DeleteCookieAsync(url, cookie_name, WrapClosure(callback)); |
| 89 } |
| 90 |
| 91 void CookieStoreIOSPersistent::DeleteCanonicalCookieAsync( |
| 92 const CanonicalCookie& cookie, |
| 93 const DeleteCallback& callback) { |
| 94 DCHECK(thread_checker().CalledOnValidThread()); |
| 95 cookie_monster()->DeleteCanonicalCookieAsync(cookie, |
| 96 WrapDeleteCallback(callback)); |
| 97 } |
| 98 |
| 99 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenAsync( |
| 100 const base::Time& delete_begin, |
| 101 const base::Time& delete_end, |
| 102 const DeleteCallback& callback) { |
| 103 DCHECK(thread_checker().CalledOnValidThread()); |
| 104 if (metrics_enabled()) |
| 105 ResetCookieCountMetrics(); |
| 106 |
| 107 cookie_monster()->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, |
| 108 WrapDeleteCallback(callback)); |
| 109 } |
| 110 |
| 111 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenWithPredicateAsync( |
| 112 const base::Time& delete_begin, |
| 113 const base::Time& delete_end, |
| 114 const CookiePredicate& predicate, |
| 115 const DeleteCallback& callback) { |
| 116 DCHECK(thread_checker().CalledOnValidThread()); |
| 117 |
| 118 if (metrics_enabled()) |
| 119 ResetCookieCountMetrics(); |
| 120 |
| 121 cookie_monster()->DeleteAllCreatedBetweenWithPredicateAsync( |
| 122 delete_begin, delete_end, predicate, WrapDeleteCallback(callback)); |
| 123 } |
| 124 |
| 125 void CookieStoreIOSPersistent::DeleteSessionCookiesAsync( |
| 126 const DeleteCallback& callback) { |
| 127 DCHECK(thread_checker().CalledOnValidThread()); |
| 128 if (metrics_enabled()) |
| 129 ResetCookieCountMetrics(); |
| 130 |
| 131 cookie_monster()->DeleteSessionCookiesAsync(WrapDeleteCallback(callback)); |
| 132 } |
| 133 |
| 134 #pragma mark - |
| 135 #pragma mark Private methods |
| 136 |
| 137 void CookieStoreIOSPersistent::WriteToCookieMonster(NSArray* system_cookies) {} |
| 138 |
| 139 void CookieStoreIOSPersistent::OnSystemCookiesChanged() {} |
| 140 |
| 141 } // namespace net |
| OLD | NEW |