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

Side by Side Diff: android_webview/browser/net/aw_cookie_store_wrapper.cc

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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "android_webview/browser/net/aw_cookie_store_wrapper.h" 5 #include "android_webview/browser/net/aw_cookie_store_wrapper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "android_webview/browser/net/init_native_callback.h" 9 #include "android_webview/browser/net/init_native_callback.h"
10 #include "base/memory/ref_counted_delete_on_sequence.h" 10 #include "base/memory/ref_counted_delete_on_sequence.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 net::CookieStore::CookieChangedCallbackList callback_list_; 97 net::CookieStore::CookieChangedCallbackList callback_list_;
98 base::WeakPtrFactory<SubscriptionWrapper> weak_factory_; 98 base::WeakPtrFactory<SubscriptionWrapper> weak_factory_;
99 99
100 DISALLOW_COPY_AND_ASSIGN(SubscriptionWrapper); 100 DISALLOW_COPY_AND_ASSIGN(SubscriptionWrapper);
101 }; 101 };
102 102
103 void SetCookieWithOptionsAsyncOnCookieThread( 103 void SetCookieWithOptionsAsyncOnCookieThread(
104 const GURL& url, 104 const GURL& url,
105 const std::string& cookie_line, 105 const std::string& cookie_line,
106 const net::CookieOptions& options, 106 const net::CookieOptions& options,
107 const net::CookieStore::SetCookiesCallback& callback) { 107 net::CookieStore::SetCookiesCallback callback) {
108 GetCookieStore()->SetCookieWithOptionsAsync(url, cookie_line, options, 108 GetCookieStore()->SetCookieWithOptionsAsync(url, cookie_line, options,
109 callback); 109 std::move(callback));
110 } 110 }
111 111
112 void SetCookieWithDetailsAsyncOnCookieThread( 112 void SetCookieWithDetailsAsyncOnCookieThread(
113 const GURL& url, 113 const GURL& url,
114 const std::string& name, 114 const std::string& name,
115 const std::string& value, 115 const std::string& value,
116 const std::string& domain, 116 const std::string& domain,
117 const std::string& path, 117 const std::string& path,
118 base::Time creation_time, 118 base::Time creation_time,
119 base::Time expiration_time, 119 base::Time expiration_time,
120 base::Time last_access_time, 120 base::Time last_access_time,
121 bool secure, 121 bool secure,
122 bool http_only, 122 bool http_only,
123 net::CookieSameSite same_site, 123 net::CookieSameSite same_site,
124 net::CookiePriority priority, 124 net::CookiePriority priority,
125 const net::CookieStore::SetCookiesCallback& callback) { 125 net::CookieStore::SetCookiesCallback callback) {
126 GetCookieStore()->SetCookieWithDetailsAsync( 126 GetCookieStore()->SetCookieWithDetailsAsync(
127 url, name, value, domain, path, creation_time, expiration_time, 127 url, name, value, domain, path, creation_time, expiration_time,
128 last_access_time, secure, http_only, same_site, priority, callback); 128 last_access_time, secure, http_only, same_site, priority,
129 std::move(callback));
129 } 130 }
130 131
131 void SetCanonicalCookieAsyncOnCookieThread( 132 void SetCanonicalCookieAsyncOnCookieThread(
132 std::unique_ptr<net::CanonicalCookie> cookie, 133 std::unique_ptr<net::CanonicalCookie> cookie,
133 bool secure_source, 134 bool secure_source,
134 bool modify_http_only, 135 bool modify_http_only,
135 const net::CookieStore::SetCookiesCallback& callback) { 136 net::CookieStore::SetCookiesCallback callback) {
136 GetCookieStore()->SetCanonicalCookieAsync(std::move(cookie), secure_source, 137 GetCookieStore()->SetCanonicalCookieAsync(
137 modify_http_only, callback); 138 std::move(cookie), secure_source, modify_http_only, std::move(callback));
138 } 139 }
139 140
140 void GetCookiesWithOptionsAsyncOnCookieThread( 141 void GetCookiesWithOptionsAsyncOnCookieThread(
141 const GURL& url, 142 const GURL& url,
142 const net::CookieOptions& options, 143 const net::CookieOptions& options,
143 const net::CookieStore::GetCookiesCallback& callback) { 144 net::CookieStore::GetCookiesCallback callback) {
144 GetCookieStore()->GetCookiesWithOptionsAsync(url, options, callback); 145 GetCookieStore()->GetCookiesWithOptionsAsync(url, options,
146 std::move(callback));
145 } 147 }
146 148
147 void GetCookieListWithOptionsAsyncOnCookieThread( 149 void GetCookieListWithOptionsAsyncOnCookieThread(
148 const GURL& url, 150 const GURL& url,
149 const net::CookieOptions& options, 151 const net::CookieOptions& options,
150 const net::CookieStore::GetCookieListCallback& callback) { 152 net::CookieStore::GetCookieListCallback callback) {
151 GetCookieStore()->GetCookieListWithOptionsAsync(url, options, callback); 153 GetCookieStore()->GetCookieListWithOptionsAsync(url, options,
154 std::move(callback));
152 } 155 }
153 156
154 void GetAllCookiesAsyncOnCookieThread( 157 void GetAllCookiesAsyncOnCookieThread(
155 const net::CookieStore::GetCookieListCallback& callback) { 158 net::CookieStore::GetCookieListCallback callback) {
156 GetCookieStore()->GetAllCookiesAsync(callback); 159 GetCookieStore()->GetAllCookiesAsync(std::move(callback));
157 } 160 }
158 161
159 void DeleteCookieAsyncOnCookieThread(const GURL& url, 162 void DeleteCookieAsyncOnCookieThread(const GURL& url,
160 const std::string& cookie_name, 163 const std::string& cookie_name,
161 const base::Closure& callback) { 164 base::OnceClosure callback) {
162 GetCookieStore()->DeleteCookieAsync(url, cookie_name, callback); 165 GetCookieStore()->DeleteCookieAsync(url, cookie_name, std::move(callback));
163 } 166 }
164 167
165 void DeleteCanonicalCookieAsyncOnCookieThread( 168 void DeleteCanonicalCookieAsyncOnCookieThread(
166 const net::CanonicalCookie& cookie, 169 const net::CanonicalCookie& cookie,
167 const net::CookieStore::DeleteCallback& callback) { 170 net::CookieStore::DeleteCallback callback) {
168 GetCookieStore()->DeleteCanonicalCookieAsync(cookie, callback); 171 GetCookieStore()->DeleteCanonicalCookieAsync(cookie, std::move(callback));
169 } 172 }
170 173
171 void DeleteAllCreatedBetweenAsyncOnCookieThread( 174 void DeleteAllCreatedBetweenAsyncOnCookieThread(
172 const base::Time& delete_begin, 175 const base::Time& delete_begin,
173 const base::Time& delete_end, 176 const base::Time& delete_end,
174 const net::CookieStore::DeleteCallback& callback) { 177 net::CookieStore::DeleteCallback callback) {
175 GetCookieStore()->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, 178 GetCookieStore()->DeleteAllCreatedBetweenAsync(delete_begin, delete_end,
176 callback); 179 std::move(callback));
177 } 180 }
178 181
179 void DeleteAllCreatedBetweenWithPredicateAsyncOnCookieThread( 182 void DeleteAllCreatedBetweenWithPredicateAsyncOnCookieThread(
180 const base::Time& delete_begin, 183 const base::Time& delete_begin,
181 const base::Time& delete_end, 184 const base::Time& delete_end,
182 const net::CookieStore::CookiePredicate& predicate, 185 const net::CookieStore::CookiePredicate& predicate,
183 const net::CookieStore::DeleteCallback& callback) { 186 net::CookieStore::DeleteCallback callback) {
184 GetCookieStore()->DeleteAllCreatedBetweenWithPredicateAsync( 187 GetCookieStore()->DeleteAllCreatedBetweenWithPredicateAsync(
185 delete_begin, delete_end, predicate, callback); 188 delete_begin, delete_end, predicate, std::move(callback));
186 } 189 }
187 190
188 void DeleteSessionCookiesAsyncOnCookieThread( 191 void DeleteSessionCookiesAsyncOnCookieThread(
189 const net::CookieStore::DeleteCallback& callback) { 192 net::CookieStore::DeleteCallback callback) {
190 GetCookieStore()->DeleteSessionCookiesAsync(callback); 193 GetCookieStore()->DeleteSessionCookiesAsync(std::move(callback));
191 } 194 }
192 195
193 void FlushStoreOnCookieThread(const base::Closure& callback) { 196 void FlushStoreOnCookieThread(base::OnceClosure callback) {
194 GetCookieStore()->FlushStore(callback); 197 GetCookieStore()->FlushStore(std::move(callback));
195 } 198 }
196 199
197 void SetForceKeepSessionStateOnCookieThread() { 200 void SetForceKeepSessionStateOnCookieThread() {
198 GetCookieStore()->SetForceKeepSessionState(); 201 GetCookieStore()->SetForceKeepSessionState();
199 } 202 }
200 203
201 } // namespace 204 } // namespace
202 205
203 AwCookieStoreWrapper::AwCookieStoreWrapper() 206 AwCookieStoreWrapper::AwCookieStoreWrapper()
204 : client_task_runner_(base::ThreadTaskRunnerHandle::Get()), 207 : client_task_runner_(base::ThreadTaskRunnerHandle::Get()),
205 weak_factory_(this) {} 208 weak_factory_(this) {}
206 209
207 AwCookieStoreWrapper::~AwCookieStoreWrapper() {} 210 AwCookieStoreWrapper::~AwCookieStoreWrapper() {}
208 211
209 void AwCookieStoreWrapper::SetCookieWithOptionsAsync( 212 void AwCookieStoreWrapper::SetCookieWithOptionsAsync(
210 const GURL& url, 213 const GURL& url,
211 const std::string& cookie_line, 214 const std::string& cookie_line,
212 const net::CookieOptions& options, 215 const net::CookieOptions& options,
213 const net::CookieStore::SetCookiesCallback& callback) { 216 net::CookieStore::SetCookiesCallback callback) {
214 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 217 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
215 PostTaskToCookieStoreTaskRunner( 218 PostTaskToCookieStoreTaskRunner(base::BindOnce(
216 base::Bind(&SetCookieWithOptionsAsyncOnCookieThread, url, cookie_line, 219 &SetCookieWithOptionsAsyncOnCookieThread, url, cookie_line, options,
217 options, CreateWrappedCallback<bool>(callback))); 220 CreateWrappedCallback<bool>(std::move(callback))));
218 } 221 }
219 222
220 void AwCookieStoreWrapper::SetCookieWithDetailsAsync( 223 void AwCookieStoreWrapper::SetCookieWithDetailsAsync(
221 const GURL& url, 224 const GURL& url,
222 const std::string& name, 225 const std::string& name,
223 const std::string& value, 226 const std::string& value,
224 const std::string& domain, 227 const std::string& domain,
225 const std::string& path, 228 const std::string& path,
226 base::Time creation_time, 229 base::Time creation_time,
227 base::Time expiration_time, 230 base::Time expiration_time,
228 base::Time last_access_time, 231 base::Time last_access_time,
229 bool secure, 232 bool secure,
230 bool http_only, 233 bool http_only,
231 net::CookieSameSite same_site, 234 net::CookieSameSite same_site,
232 net::CookiePriority priority, 235 net::CookiePriority priority,
233 const SetCookiesCallback& callback) { 236 SetCookiesCallback callback) {
234 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 237 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
235 PostTaskToCookieStoreTaskRunner( 238 PostTaskToCookieStoreTaskRunner(base::BindOnce(
236 base::Bind(&SetCookieWithDetailsAsyncOnCookieThread, url, name, value, 239 &SetCookieWithDetailsAsyncOnCookieThread, url, name, value, domain, path,
237 domain, path, creation_time, expiration_time, last_access_time, 240 creation_time, expiration_time, last_access_time, secure, http_only,
238 secure, http_only, same_site, priority, 241 same_site, priority, CreateWrappedCallback<bool>(std::move(callback))));
239 CreateWrappedCallback<bool>(callback)));
240 } 242 }
241 243
242 void AwCookieStoreWrapper::SetCanonicalCookieAsync( 244 void AwCookieStoreWrapper::SetCanonicalCookieAsync(
243 std::unique_ptr<net::CanonicalCookie> cookie, 245 std::unique_ptr<net::CanonicalCookie> cookie,
244 bool secure_source, 246 bool secure_source,
245 bool modify_http_only, 247 bool modify_http_only,
246 const SetCookiesCallback& callback) { 248 SetCookiesCallback callback) {
247 DCHECK(client_task_runner_->RunsTasksOnCurrentThread()); 249 DCHECK(client_task_runner_->RunsTasksOnCurrentThread());
248 PostTaskToCookieStoreTaskRunner(base::BindOnce( 250 PostTaskToCookieStoreTaskRunner(base::BindOnce(
249 &SetCanonicalCookieAsyncOnCookieThread, std::move(cookie), secure_source, 251 &SetCanonicalCookieAsyncOnCookieThread, std::move(cookie), secure_source,
250 modify_http_only, CreateWrappedCallback<bool>(callback))); 252 modify_http_only, CreateWrappedCallback<bool>(std::move(callback))));
251 } 253 }
252 254
253 void AwCookieStoreWrapper::GetCookiesWithOptionsAsync( 255 void AwCookieStoreWrapper::GetCookiesWithOptionsAsync(
254 const GURL& url, 256 const GURL& url,
255 const net::CookieOptions& options, 257 const net::CookieOptions& options,
256 const GetCookiesCallback& callback) { 258 GetCookiesCallback callback) {
257 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 259 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
258 PostTaskToCookieStoreTaskRunner( 260 PostTaskToCookieStoreTaskRunner(base::BindOnce(
259 base::Bind(&GetCookiesWithOptionsAsyncOnCookieThread, url, options, 261 &GetCookiesWithOptionsAsyncOnCookieThread, url, options,
260 CreateWrappedCallback<const std::string&>(callback))); 262 CreateWrappedCallback<const std::string&>(std::move(callback))));
261 } 263 }
262 264
263 void AwCookieStoreWrapper::GetCookieListWithOptionsAsync( 265 void AwCookieStoreWrapper::GetCookieListWithOptionsAsync(
264 const GURL& url, 266 const GURL& url,
265 const net::CookieOptions& options, 267 const net::CookieOptions& options,
266 const GetCookieListCallback& callback) { 268 GetCookieListCallback callback) {
267 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 269 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
268 PostTaskToCookieStoreTaskRunner( 270 PostTaskToCookieStoreTaskRunner(base::BindOnce(
269 base::Bind(&GetCookieListWithOptionsAsyncOnCookieThread, url, options, 271 &GetCookieListWithOptionsAsyncOnCookieThread, url, options,
270 CreateWrappedCallback<const net::CookieList&>(callback))); 272 CreateWrappedCallback<const net::CookieList&>(std::move(callback))));
271 } 273 }
272 274
273 void AwCookieStoreWrapper::GetAllCookiesAsync( 275 void AwCookieStoreWrapper::GetAllCookiesAsync(GetCookieListCallback callback) {
274 const GetCookieListCallback& callback) {
275 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 276 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
276 PostTaskToCookieStoreTaskRunner( 277 PostTaskToCookieStoreTaskRunner(base::BindOnce(
277 base::Bind(&GetAllCookiesAsyncOnCookieThread, 278 &GetAllCookiesAsyncOnCookieThread,
278 CreateWrappedCallback<const net::CookieList&>(callback))); 279 CreateWrappedCallback<const net::CookieList&>(std::move(callback))));
279 } 280 }
280 281
281 void AwCookieStoreWrapper::DeleteCookieAsync(const GURL& url, 282 void AwCookieStoreWrapper::DeleteCookieAsync(const GURL& url,
282 const std::string& cookie_name, 283 const std::string& cookie_name,
283 const base::Closure& callback) { 284 base::OnceClosure callback) {
284 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 285 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
285 PostTaskToCookieStoreTaskRunner( 286 PostTaskToCookieStoreTaskRunner(
286 base::Bind(&DeleteCookieAsyncOnCookieThread, url, cookie_name, 287 base::BindOnce(&DeleteCookieAsyncOnCookieThread, url, cookie_name,
287 CreateWrappedClosureCallback(callback))); 288 CreateWrappedClosureCallback(std::move(callback))));
288 } 289 }
289 290
290 void AwCookieStoreWrapper::DeleteCanonicalCookieAsync( 291 void AwCookieStoreWrapper::DeleteCanonicalCookieAsync(
291 const net::CanonicalCookie& cookie, 292 const net::CanonicalCookie& cookie,
292 const DeleteCallback& callback) { 293 DeleteCallback callback) {
293 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 294 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
294 PostTaskToCookieStoreTaskRunner( 295 PostTaskToCookieStoreTaskRunner(
295 base::Bind(&DeleteCanonicalCookieAsyncOnCookieThread, cookie, 296 base::BindOnce(&DeleteCanonicalCookieAsyncOnCookieThread, cookie,
296 CreateWrappedCallback<int>(callback))); 297 CreateWrappedCallback<int>(std::move(callback))));
297 } 298 }
298 299
299 void AwCookieStoreWrapper::DeleteAllCreatedBetweenAsync( 300 void AwCookieStoreWrapper::DeleteAllCreatedBetweenAsync(
300 const base::Time& delete_begin, 301 const base::Time& delete_begin,
301 const base::Time& delete_end, 302 const base::Time& delete_end,
302 const DeleteCallback& callback) { 303 DeleteCallback callback) {
303 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 304 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
304 PostTaskToCookieStoreTaskRunner( 305 PostTaskToCookieStoreTaskRunner(base::BindOnce(
305 base::Bind(&DeleteAllCreatedBetweenAsyncOnCookieThread, delete_begin, 306 &DeleteAllCreatedBetweenAsyncOnCookieThread, delete_begin, delete_end,
306 delete_end, CreateWrappedCallback<int>(callback))); 307 CreateWrappedCallback<int>(std::move(callback))));
307 } 308 }
308 309
309 void AwCookieStoreWrapper::DeleteAllCreatedBetweenWithPredicateAsync( 310 void AwCookieStoreWrapper::DeleteAllCreatedBetweenWithPredicateAsync(
310 const base::Time& delete_begin, 311 const base::Time& delete_begin,
311 const base::Time& delete_end, 312 const base::Time& delete_end,
312 const CookiePredicate& predicate, 313 const CookiePredicate& predicate,
313 const DeleteCallback& callback) { 314 DeleteCallback callback) {
314 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 315 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
315 PostTaskToCookieStoreTaskRunner(base::Bind( 316 PostTaskToCookieStoreTaskRunner(base::BindOnce(
316 &DeleteAllCreatedBetweenWithPredicateAsyncOnCookieThread, delete_begin, 317 &DeleteAllCreatedBetweenWithPredicateAsyncOnCookieThread, delete_begin,
317 delete_end, predicate, CreateWrappedCallback<int>(callback))); 318 delete_end, predicate, CreateWrappedCallback<int>(std::move(callback))));
318 } 319 }
319 320
320 void AwCookieStoreWrapper::DeleteSessionCookiesAsync( 321 void AwCookieStoreWrapper::DeleteSessionCookiesAsync(DeleteCallback callback) {
321 const DeleteCallback& callback) {
322 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 322 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
323 PostTaskToCookieStoreTaskRunner( 323 PostTaskToCookieStoreTaskRunner(
324 base::Bind(&DeleteSessionCookiesAsyncOnCookieThread, 324 base::BindOnce(&DeleteSessionCookiesAsyncOnCookieThread,
325 CreateWrappedCallback<int>(callback))); 325 CreateWrappedCallback<int>(std::move(callback))));
326 } 326 }
327 327
328 void AwCookieStoreWrapper::FlushStore(const base::Closure& callback) { 328 void AwCookieStoreWrapper::FlushStore(base::OnceClosure callback) {
329 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 329 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
330 PostTaskToCookieStoreTaskRunner(base::Bind( 330 PostTaskToCookieStoreTaskRunner(
331 &FlushStoreOnCookieThread, CreateWrappedClosureCallback(callback))); 331 base::BindOnce(&FlushStoreOnCookieThread,
332 CreateWrappedClosureCallback(std::move(callback))));
332 } 333 }
333 334
334 void AwCookieStoreWrapper::SetForceKeepSessionState() { 335 void AwCookieStoreWrapper::SetForceKeepSessionState() {
335 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 336 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
336 PostTaskToCookieStoreTaskRunner( 337 PostTaskToCookieStoreTaskRunner(
337 base::Bind(&SetForceKeepSessionStateOnCookieThread)); 338 base::Bind(&SetForceKeepSessionStateOnCookieThread));
338 } 339 }
339 340
340 std::unique_ptr<net::CookieStore::CookieChangedSubscription> 341 std::unique_ptr<net::CookieStore::CookieChangedSubscription>
341 AwCookieStoreWrapper::AddCallbackForCookie( 342 AwCookieStoreWrapper::AddCallbackForCookie(
342 const GURL& url, 343 const GURL& url,
343 const std::string& name, 344 const std::string& name,
344 const CookieChangedCallback& callback) { 345 const CookieChangedCallback& callback) {
345 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 346 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
346 347
347 // The SubscriptionWrapper is owned by the subscription itself, and has no 348 // The SubscriptionWrapper is owned by the subscription itself, and has no
348 // connection to the AwCookieStoreWrapper after creation. Other CookieStore 349 // connection to the AwCookieStoreWrapper after creation. Other CookieStore
349 // implementations DCHECK if a subscription outlasts the cookie store, 350 // implementations DCHECK if a subscription outlasts the cookie store,
350 // unfortunately, this design makes DCHECKing if there's an outstanding 351 // unfortunately, this design makes DCHECKing if there's an outstanding
351 // subscription when the AwCookieStoreWrapper is destroyed a bit ugly. 352 // subscription when the AwCookieStoreWrapper is destroyed a bit ugly.
352 // TODO(mmenke): Still worth adding a DCHECK? 353 // TODO(mmenke): Still worth adding a DCHECK?
353 SubscriptionWrapper* subscription = new SubscriptionWrapper(); 354 SubscriptionWrapper* subscription = new SubscriptionWrapper();
354 return subscription->Subscribe(url, name, callback); 355 return subscription->Subscribe(url, name, callback);
355 } 356 }
356 357
357 bool AwCookieStoreWrapper::IsEphemeral() { 358 bool AwCookieStoreWrapper::IsEphemeral() {
358 return GetCookieStore()->IsEphemeral(); 359 return GetCookieStore()->IsEphemeral();
359 } 360 }
360 361
361 base::Closure AwCookieStoreWrapper::CreateWrappedClosureCallback( 362 base::OnceClosure AwCookieStoreWrapper::CreateWrappedClosureCallback(
362 const base::Closure& callback) { 363 base::OnceClosure callback) {
363 if (callback.is_null()) 364 if (callback.is_null())
364 return callback; 365 return callback;
365 return base::Bind(base::IgnoreResult(&base::TaskRunner::PostTask), 366 return base::BindOnce(
366 client_task_runner_, FROM_HERE, 367 base::IgnoreResult(&base::TaskRunner::PostTask), client_task_runner_,
367 base::Bind(&AwCookieStoreWrapper::RunClosureCallback, 368 FROM_HERE,
368 weak_factory_.GetWeakPtr(), callback)); 369 base::BindOnce(&AwCookieStoreWrapper::RunClosureCallback,
370 weak_factory_.GetWeakPtr(), std::move(callback)));
369 } 371 }
370 372
371 void AwCookieStoreWrapper::RunClosureCallback(const base::Closure& callback) { 373 void AwCookieStoreWrapper::RunClosureCallback(base::OnceClosure callback) {
372 DCHECK(client_task_runner_->RunsTasksInCurrentSequence()); 374 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
373 callback.Run(); 375 std::move(callback).Run();
374 } 376 }
375 377
376 } // namespace android_webview 378 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698