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

Side by Side Diff: ios/net/cookies/cookie_store_ios_persistent.mm

Issue 2937963003: Shift cookie system callbacks to OnceCallback to impedance match mojo. (Closed)
Patch Set: Finish Merge Created 3 years, 6 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
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 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 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 #import "ios/net/cookies/cookie_store_ios_persistent.h" 5 #import "ios/net/cookies/cookie_store_ios_persistent.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include "ios/net/cookies/system_cookie_util.h" 9 #include "ios/net/cookies/system_cookie_util.h"
10 #include "net/cookies/cookie_monster.h" 10 #include "net/cookies/cookie_monster.h"
(...skipping 10 matching lines...) Expand all
21 21
22 CookieStoreIOSPersistent::~CookieStoreIOSPersistent() {} 22 CookieStoreIOSPersistent::~CookieStoreIOSPersistent() {}
23 23
24 #pragma mark - 24 #pragma mark -
25 #pragma mark CookieStoreIOSPersistent methods 25 #pragma mark CookieStoreIOSPersistent methods
26 26
27 void CookieStoreIOSPersistent::SetCookieWithOptionsAsync( 27 void CookieStoreIOSPersistent::SetCookieWithOptionsAsync(
28 const GURL& url, 28 const GURL& url,
29 const std::string& cookie_line, 29 const std::string& cookie_line,
30 const net::CookieOptions& options, 30 const net::CookieOptions& options,
31 const SetCookiesCallback& callback) { 31 SetCookiesCallback callback) {
32 DCHECK(thread_checker().CalledOnValidThread()); 32 DCHECK(thread_checker().CalledOnValidThread());
33 33
34 cookie_monster()->SetCookieWithOptionsAsync(url, cookie_line, options, 34 cookie_monster()->SetCookieWithOptionsAsync(
35 WrapSetCallback(callback)); 35 url, cookie_line, options, WrapSetCallback(std::move(callback)));
36 } 36 }
37 37
38 void CookieStoreIOSPersistent::SetCookieWithDetailsAsync( 38 void CookieStoreIOSPersistent::SetCookieWithDetailsAsync(
39 const GURL& url, 39 const GURL& url,
40 const std::string& name, 40 const std::string& name,
41 const std::string& value, 41 const std::string& value,
42 const std::string& domain, 42 const std::string& domain,
43 const std::string& path, 43 const std::string& path,
44 base::Time creation_time, 44 base::Time creation_time,
45 base::Time expiration_time, 45 base::Time expiration_time,
46 base::Time last_access_time, 46 base::Time last_access_time,
47 bool secure, 47 bool secure,
48 bool http_only, 48 bool http_only,
49 CookieSameSite same_site, 49 CookieSameSite same_site,
50 CookiePriority priority, 50 CookiePriority priority,
51 const SetCookiesCallback& callback) { 51 SetCookiesCallback callback) {
52 DCHECK(thread_checker().CalledOnValidThread()); 52 DCHECK(thread_checker().CalledOnValidThread());
53 53
54 cookie_monster()->SetCookieWithDetailsAsync( 54 cookie_monster()->SetCookieWithDetailsAsync(
55 url, name, value, domain, path, creation_time, expiration_time, 55 url, name, value, domain, path, creation_time, expiration_time,
56 last_access_time, secure, http_only, same_site, priority, 56 last_access_time, secure, http_only, same_site, priority,
57 WrapSetCallback(callback)); 57 WrapSetCallback(std::move(callback)));
58 } 58 }
59 59
60 void CookieStoreIOSPersistent::SetCanonicalCookieAsync( 60 void CookieStoreIOSPersistent::SetCanonicalCookieAsync(
61 std::unique_ptr<CanonicalCookie> cookie, 61 std::unique_ptr<CanonicalCookie> cookie,
62 bool secure_source, 62 bool secure_source,
63 bool modify_http_only, 63 bool modify_http_only,
64 const SetCookiesCallback& callback) { 64 SetCookiesCallback callback) {
65 DCHECK(thread_checker().CalledOnValidThread()); 65 DCHECK(thread_checker().CalledOnValidThread());
66 66
67 cookie_monster()->SetCanonicalCookieAsync(std::move(cookie), secure_source, 67 cookie_monster()->SetCanonicalCookieAsync(
68 modify_http_only, 68 std::move(cookie), secure_source, modify_http_only,
69 WrapSetCallback(callback)); 69 WrapSetCallback(std::move(callback)));
70 } 70 }
71 71
72 void CookieStoreIOSPersistent::GetCookiesWithOptionsAsync( 72 void CookieStoreIOSPersistent::GetCookiesWithOptionsAsync(
73 const GURL& url, 73 const GURL& url,
74 const net::CookieOptions& options, 74 const net::CookieOptions& options,
75 const GetCookiesCallback& callback) { 75 GetCookiesCallback callback) {
76 DCHECK(thread_checker().CalledOnValidThread()); 76 DCHECK(thread_checker().CalledOnValidThread());
77 cookie_monster()->GetCookiesWithOptionsAsync(url, options, callback); 77 cookie_monster()->GetCookiesWithOptionsAsync(url, options,
78 std::move(callback));
78 } 79 }
79 80
80 void CookieStoreIOSPersistent::GetCookieListWithOptionsAsync( 81 void CookieStoreIOSPersistent::GetCookieListWithOptionsAsync(
81 const GURL& url, 82 const GURL& url,
82 const net::CookieOptions& options, 83 const net::CookieOptions& options,
83 const GetCookieListCallback& callback) { 84 GetCookieListCallback callback) {
84 DCHECK(thread_checker().CalledOnValidThread()); 85 DCHECK(thread_checker().CalledOnValidThread());
85 86
86 cookie_monster()->GetCookieListWithOptionsAsync(url, options, callback); 87 cookie_monster()->GetCookieListWithOptionsAsync(url, options,
88 std::move(callback));
87 } 89 }
88 90
89 void CookieStoreIOSPersistent::GetAllCookiesAsync( 91 void CookieStoreIOSPersistent::GetAllCookiesAsync(
90 const GetCookieListCallback& callback) { 92 GetCookieListCallback callback) {
91 DCHECK(thread_checker().CalledOnValidThread()); 93 DCHECK(thread_checker().CalledOnValidThread());
92 cookie_monster()->GetAllCookiesAsync(callback); 94 cookie_monster()->GetAllCookiesAsync(std::move(callback));
93 } 95 }
94 96
95 void CookieStoreIOSPersistent::DeleteCookieAsync( 97 void CookieStoreIOSPersistent::DeleteCookieAsync(const GURL& url,
96 const GURL& url, 98 const std::string& cookie_name,
97 const std::string& cookie_name, 99 base::OnceClosure callback) {
98 const base::Closure& callback) {
99 DCHECK(thread_checker().CalledOnValidThread()); 100 DCHECK(thread_checker().CalledOnValidThread());
100 cookie_monster()->DeleteCookieAsync(url, cookie_name, WrapClosure(callback)); 101 cookie_monster()->DeleteCookieAsync(url, cookie_name,
102 WrapClosure(std::move(callback)));
101 } 103 }
102 104
103 void CookieStoreIOSPersistent::DeleteCanonicalCookieAsync( 105 void CookieStoreIOSPersistent::DeleteCanonicalCookieAsync(
104 const CanonicalCookie& cookie, 106 const CanonicalCookie& cookie,
105 const DeleteCallback& callback) { 107 DeleteCallback callback) {
106 DCHECK(thread_checker().CalledOnValidThread()); 108 DCHECK(thread_checker().CalledOnValidThread());
107 cookie_monster()->DeleteCanonicalCookieAsync(cookie, 109 cookie_monster()->DeleteCanonicalCookieAsync(
108 WrapDeleteCallback(callback)); 110 cookie, WrapDeleteCallback(std::move(callback)));
109 } 111 }
110 112
111 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenAsync( 113 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenAsync(
112 const base::Time& delete_begin, 114 const base::Time& delete_begin,
113 const base::Time& delete_end, 115 const base::Time& delete_end,
114 const DeleteCallback& callback) { 116 DeleteCallback callback) {
115 DCHECK(thread_checker().CalledOnValidThread()); 117 DCHECK(thread_checker().CalledOnValidThread());
116 if (metrics_enabled()) 118 if (metrics_enabled())
117 ResetCookieCountMetrics(); 119 ResetCookieCountMetrics();
118 120
119 cookie_monster()->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, 121 cookie_monster()->DeleteAllCreatedBetweenAsync(
120 WrapDeleteCallback(callback)); 122 delete_begin, delete_end, WrapDeleteCallback(std::move(callback)));
121 } 123 }
122 124
123 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenWithPredicateAsync( 125 void CookieStoreIOSPersistent::DeleteAllCreatedBetweenWithPredicateAsync(
124 const base::Time& delete_begin, 126 const base::Time& delete_begin,
125 const base::Time& delete_end, 127 const base::Time& delete_end,
126 const CookiePredicate& predicate, 128 const CookiePredicate& predicate,
127 const DeleteCallback& callback) { 129 DeleteCallback callback) {
128 DCHECK(thread_checker().CalledOnValidThread()); 130 DCHECK(thread_checker().CalledOnValidThread());
129 131
130 if (metrics_enabled()) 132 if (metrics_enabled())
131 ResetCookieCountMetrics(); 133 ResetCookieCountMetrics();
132 134
133 cookie_monster()->DeleteAllCreatedBetweenWithPredicateAsync( 135 cookie_monster()->DeleteAllCreatedBetweenWithPredicateAsync(
134 delete_begin, delete_end, predicate, WrapDeleteCallback(callback)); 136 delete_begin, delete_end, predicate,
137 WrapDeleteCallback(std::move(callback)));
135 } 138 }
136 139
137 void CookieStoreIOSPersistent::DeleteSessionCookiesAsync( 140 void CookieStoreIOSPersistent::DeleteSessionCookiesAsync(
138 const DeleteCallback& callback) { 141 DeleteCallback callback) {
139 DCHECK(thread_checker().CalledOnValidThread()); 142 DCHECK(thread_checker().CalledOnValidThread());
140 if (metrics_enabled()) 143 if (metrics_enabled())
141 ResetCookieCountMetrics(); 144 ResetCookieCountMetrics();
142 145
143 cookie_monster()->DeleteSessionCookiesAsync(WrapDeleteCallback(callback)); 146 cookie_monster()->DeleteSessionCookiesAsync(
147 WrapDeleteCallback(std::move(callback)));
144 } 148 }
145 149
146 #pragma mark - 150 #pragma mark -
147 #pragma mark Private methods 151 #pragma mark Private methods
148 152
149 void CookieStoreIOSPersistent::WriteToCookieMonster(NSArray* system_cookies) {} 153 void CookieStoreIOSPersistent::WriteToCookieMonster(NSArray* system_cookies) {}
150 154
151 void CookieStoreIOSPersistent::OnSystemCookiesChanged() {} 155 void CookieStoreIOSPersistent::OnSystemCookiesChanged() {}
152 156
153 } // namespace net 157 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698