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

Side by Side Diff: content/browser/payments/payment_app_database.cc

Issue 2958333002: [Payments] Implement web payment app manifest (Closed)
Patch Set: update comments Created 3 years, 5 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 "content/browser/payments/payment_app_database.h" 5 #include "content/browser/payments/payment_app_database.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/optional.h" 13 #include "base/optional.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "content/browser/payments/payment_app.pb.h" 15 #include "content/browser/payments/payment_app.pb.h"
16 #include "content/browser/payments/payment_app_context_impl.h" 16 #include "content/browser/payments/payment_app_context_impl.h"
17 #include "content/browser/service_worker/service_worker_context_wrapper.h" 17 #include "content/browser/service_worker/service_worker_context_wrapper.h"
18 #include "content/browser/service_worker/service_worker_registration.h" 18 #include "content/browser/service_worker/service_worker_registration.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/stored_payment_instrument.h"
20 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
21 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
22 23
23 namespace content { 24 namespace content {
24 namespace { 25 namespace {
25 26
26 using ::payments::mojom::PaymentHandlerStatus; 27 using ::payments::mojom::PaymentHandlerStatus;
27 using ::payments::mojom::PaymentInstrument; 28 using ::payments::mojom::PaymentInstrument;
28 using ::payments::mojom::PaymentInstrumentPtr; 29 using ::payments::mojom::PaymentInstrumentPtr;
29 30
31 const char kPaymentAppPrefix[] = "PaymentApp:";
30 const char kPaymentInstrumentPrefix[] = "PaymentInstrument:"; 32 const char kPaymentInstrumentPrefix[] = "PaymentInstrument:";
31 const char kPaymentInstrumentKeyInfoPrefix[] = "PaymentInstrumentKeyInfo:"; 33 const char kPaymentInstrumentKeyInfoPrefix[] = "PaymentInstrumentKeyInfo:";
32 34
35 std::string CreatePaymentAppKey(const std::string& origin) {
36 return kPaymentAppPrefix + origin;
37 }
38
33 std::string CreatePaymentInstrumentKey(const std::string& instrument_key) { 39 std::string CreatePaymentInstrumentKey(const std::string& instrument_key) {
34 return kPaymentInstrumentPrefix + instrument_key; 40 return kPaymentInstrumentPrefix + instrument_key;
35 } 41 }
36 42
37 std::string CreatePaymentInstrumentKeyInfoKey( 43 std::string CreatePaymentInstrumentKeyInfoKey(
38 const std::string& instrument_key) { 44 const std::string& instrument_key) {
39 return kPaymentInstrumentKeyInfoPrefix + instrument_key; 45 return kPaymentInstrumentKeyInfoPrefix + instrument_key;
40 } 46 }
41 47
42 std::map<uint64_t, std::string> ToStoredPaymentInstrumentKeyInfos( 48 std::map<uint64_t, std::string> ToStoredPaymentInstrumentKeyInfos(
(...skipping 23 matching lines...) Expand all
66 payments::mojom::ImageObject::New(GURL(icon.src()))); 72 payments::mojom::ImageObject::New(GURL(icon.src())));
67 } 73 }
68 for (const auto& method : instrument_proto.enabled_methods()) 74 for (const auto& method : instrument_proto.enabled_methods())
69 instrument->enabled_methods.push_back(method); 75 instrument->enabled_methods.push_back(method);
70 instrument->stringified_capabilities = 76 instrument->stringified_capabilities =
71 instrument_proto.stringified_capabilities(); 77 instrument_proto.stringified_capabilities();
72 78
73 return instrument; 79 return instrument;
74 } 80 }
75 81
82 std::unique_ptr<StoredPaymentApp> ToStoredPaymentApp(const std::string& input) {
83 StoredPaymentAppProto app_proto;
84 if (!app_proto.ParseFromString(input))
85 return std::unique_ptr<StoredPaymentApp>();
86
87 std::unique_ptr<StoredPaymentApp> app = base::MakeUnique<StoredPaymentApp>();
88 app->registration_id = app_proto.registration_id();
89 app->origin = GURL(app_proto.origin());
90 app->name = app_proto.name();
91
92 if (!app_proto.icon().empty()) {
93 std::string icon_raw_data;
94 base::Base64Decode(app_proto.icon(), &icon_raw_data);
95 // Note that the icon has been decoded to PNG raw data regardless of the
96 // original icon format that was downloaded.
97 gfx::Image icon_image = gfx::Image::CreateFrom1xPNGBytes(
98 reinterpret_cast<const unsigned char*>(icon_raw_data.data()),
99 icon_raw_data.size());
100 app->icon = base::MakeUnique<SkBitmap>(icon_image.AsBitmap());
101 }
102
103 return app;
104 }
105
76 std::unique_ptr<StoredPaymentInstrument> ToStoredPaymentInstrument( 106 std::unique_ptr<StoredPaymentInstrument> ToStoredPaymentInstrument(
77 const std::string& input) { 107 const std::string& input) {
78 StoredPaymentInstrumentProto instrument_proto; 108 StoredPaymentInstrumentProto instrument_proto;
79 if (!instrument_proto.ParseFromString(input)) 109 if (!instrument_proto.ParseFromString(input))
80 return std::unique_ptr<StoredPaymentInstrument>(); 110 return std::unique_ptr<StoredPaymentInstrument>();
81 111
82 std::unique_ptr<StoredPaymentInstrument> instrument = 112 std::unique_ptr<StoredPaymentInstrument> instrument =
83 base::MakeUnique<StoredPaymentInstrument>(); 113 base::MakeUnique<StoredPaymentInstrument>();
84 instrument->registration_id = instrument_proto.registration_id();
85 instrument->instrument_key = instrument_proto.instrument_key(); 114 instrument->instrument_key = instrument_proto.instrument_key();
86 instrument->origin = GURL(instrument_proto.origin()); 115 instrument->origin = GURL(instrument_proto.origin());
87 instrument->name = instrument_proto.name(); 116 instrument->name = instrument_proto.name();
88 117
89 if (!instrument_proto.decoded_instrument_icon().empty()) { 118 if (!instrument_proto.decoded_instrument_icon().empty()) {
90 std::string icon_raw_data; 119 std::string icon_raw_data;
91 base::Base64Decode(instrument_proto.decoded_instrument_icon(), 120 base::Base64Decode(instrument_proto.decoded_instrument_icon(),
92 &icon_raw_data); 121 &icon_raw_data);
93 // Note that the icon has been decoded to PNG raw data regardless of the 122 // Note that the icon has been decoded to PNG raw data regardless of the
94 // original icon format that was downloaded. 123 // original icon format that was downloaded.
(...skipping 18 matching lines...) Expand all
113 142
114 PaymentAppDatabase::~PaymentAppDatabase() { 143 PaymentAppDatabase::~PaymentAppDatabase() {
115 DCHECK_CURRENTLY_ON(BrowserThread::IO); 144 DCHECK_CURRENTLY_ON(BrowserThread::IO);
116 } 145 }
117 146
118 void PaymentAppDatabase::ReadAllPaymentApps( 147 void PaymentAppDatabase::ReadAllPaymentApps(
119 ReadAllPaymentAppsCallback callback) { 148 ReadAllPaymentAppsCallback callback) {
120 DCHECK_CURRENTLY_ON(BrowserThread::IO); 149 DCHECK_CURRENTLY_ON(BrowserThread::IO);
121 150
122 service_worker_context_->GetUserDataForAllRegistrationsByKeyPrefix( 151 service_worker_context_->GetUserDataForAllRegistrationsByKeyPrefix(
123 kPaymentInstrumentPrefix, 152 kPaymentAppPrefix, base::Bind(&PaymentAppDatabase::DidReadAllPaymentApps,
124 base::Bind(&PaymentAppDatabase::DidReadAllPaymentApps, 153 weak_ptr_factory_.GetWeakPtr(),
125 weak_ptr_factory_.GetWeakPtr(), 154 base::Passed(std::move(callback))));
126 base::Passed(std::move(callback))));
127 } 155 }
128 156
129 void PaymentAppDatabase::DeletePaymentInstrument( 157 void PaymentAppDatabase::DeletePaymentInstrument(
130 const GURL& scope, 158 const GURL& scope,
131 const std::string& instrument_key, 159 const std::string& instrument_key,
132 DeletePaymentInstrumentCallback callback) { 160 DeletePaymentInstrumentCallback callback) {
133 DCHECK_CURRENTLY_ON(BrowserThread::IO); 161 DCHECK_CURRENTLY_ON(BrowserThread::IO);
134 162
135 service_worker_context_->FindReadyRegistrationForPattern( 163 service_worker_context_->FindReadyRegistrationForPattern(
136 scope, 164 scope,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 249
222 service_worker_context_->FindReadyRegistrationForPattern( 250 service_worker_context_->FindReadyRegistrationForPattern(
223 scope, 251 scope,
224 base::Bind( 252 base::Bind(
225 &PaymentAppDatabase::DidFindRegistrationToWritePaymentInstrument, 253 &PaymentAppDatabase::DidFindRegistrationToWritePaymentInstrument,
226 weak_ptr_factory_.GetWeakPtr(), instrument_key, 254 weak_ptr_factory_.GetWeakPtr(), instrument_key,
227 base::Passed(std::move(instrument)), icon, 255 base::Passed(std::move(instrument)), icon,
228 base::Passed(std::move(callback)))); 256 base::Passed(std::move(callback))));
229 } 257 }
230 258
259 void PaymentAppDatabase::FetchAndWritePaymentAppInfo(
260 const GURL& context,
261 const GURL& scope,
262 FetchAndWritePaymentAppInfoCallback callback) {
263 DCHECK_CURRENTLY_ON(BrowserThread::IO);
264
265 payment_app_info_fetcher_ = new PaymentAppInfoFetcher();
266 payment_app_info_fetcher_->Start(
267 context, service_worker_context_,
268 base::BindOnce(&PaymentAppDatabase::FetchPaymentAppInfoCallback,
269 weak_ptr_factory_.GetWeakPtr(), scope,
270 std::move(callback)));
271 }
272
273 void PaymentAppDatabase::FetchPaymentAppInfoCallback(
274 const GURL& scope,
275 FetchAndWritePaymentAppInfoCallback callback,
276 const std::string& name,
277 const std::string& icon) {
278 DCHECK_CURRENTLY_ON(BrowserThread::IO);
279
280 payment_app_info_fetcher_ = nullptr;
281
282 service_worker_context_->FindReadyRegistrationForPattern(
283 scope,
284 base::Bind(&PaymentAppDatabase::DidFindRegistrationToWritePaymentAppInfo,
285 weak_ptr_factory_.GetWeakPtr(),
286 base::Passed(std::move(callback)), name, icon));
287 }
288
289 void PaymentAppDatabase::DidFindRegistrationToWritePaymentAppInfo(
290 FetchAndWritePaymentAppInfoCallback callback,
291 const std::string& name,
292 const std::string& icon,
293 ServiceWorkerStatusCode status,
294 scoped_refptr<ServiceWorkerRegistration> registration) {
295 DCHECK_CURRENTLY_ON(BrowserThread::IO);
296 if (status != SERVICE_WORKER_OK) {
297 std::move(callback).Run(PaymentHandlerStatus::NO_ACTIVE_WORKER);
298 return;
299 }
300
301 StoredPaymentAppProto payment_app_proto;
302 payment_app_proto.set_registration_id(registration->id());
303 payment_app_proto.set_origin(registration->pattern().GetOrigin().spec());
304 payment_app_proto.set_name(name.empty() ? payment_app_proto.origin() : name);
305 payment_app_proto.set_icon(icon);
306
307 std::string serialized_payment_app;
308 bool success = payment_app_proto.SerializeToString(&serialized_payment_app);
309 DCHECK(success);
310
311 service_worker_context_->StoreRegistrationUserData(
312 registration->id(), registration->pattern().GetOrigin(),
313 {{CreatePaymentAppKey(registration->pattern().GetOrigin().spec()),
314 serialized_payment_app}},
315 base::Bind(&PaymentAppDatabase::DidWritePaymentApp,
316 weak_ptr_factory_.GetWeakPtr(),
317 base::Passed(std::move(callback)),
318 name.empty() | icon.empty()));
319 }
320
321 void PaymentAppDatabase::DidWritePaymentApp(
322 FetchAndWritePaymentAppInfoCallback callback,
323 bool fetch_app_info_failed,
324 ServiceWorkerStatusCode status) {
325 DCHECK_CURRENTLY_ON(BrowserThread::IO);
326
327 PaymentHandlerStatus handler_status =
328 fetch_app_info_failed
329 ? PaymentHandlerStatus::FETCH_PAYMENT_APP_INFO_FAILED
330 : PaymentHandlerStatus::SUCCESS;
331 handler_status = status == SERVICE_WORKER_OK
332 ? handler_status
333 : PaymentHandlerStatus::STORAGE_OPERATION_FAILED;
334 return std::move(callback).Run(handler_status);
335 }
336
231 void PaymentAppDatabase::ClearPaymentInstruments( 337 void PaymentAppDatabase::ClearPaymentInstruments(
232 const GURL& scope, 338 const GURL& scope,
233 ClearPaymentInstrumentsCallback callback) { 339 ClearPaymentInstrumentsCallback callback) {
234 DCHECK_CURRENTLY_ON(BrowserThread::IO); 340 DCHECK_CURRENTLY_ON(BrowserThread::IO);
235 341
236 service_worker_context_->FindReadyRegistrationForPattern( 342 service_worker_context_->FindReadyRegistrationForPattern(
237 scope, 343 scope,
238 base::Bind( 344 base::Bind(
239 &PaymentAppDatabase::DidFindRegistrationToClearPaymentInstruments, 345 &PaymentAppDatabase::DidFindRegistrationToClearPaymentInstruments,
240 weak_ptr_factory_.GetWeakPtr(), scope, 346 weak_ptr_factory_.GetWeakPtr(), scope,
241 base::Passed(std::move(callback)))); 347 base::Passed(std::move(callback))));
242 } 348 }
243 349
244 void PaymentAppDatabase::DidReadAllPaymentApps( 350 void PaymentAppDatabase::DidReadAllPaymentApps(
245 ReadAllPaymentAppsCallback callback, 351 ReadAllPaymentAppsCallback callback,
246 const std::vector<std::pair<int64_t, std::string>>& raw_data, 352 const std::vector<std::pair<int64_t, std::string>>& raw_data,
247 ServiceWorkerStatusCode status) { 353 ServiceWorkerStatusCode status) {
248 DCHECK_CURRENTLY_ON(BrowserThread::IO); 354 DCHECK_CURRENTLY_ON(BrowserThread::IO);
249 if (status != SERVICE_WORKER_OK) { 355 if (status != SERVICE_WORKER_OK) {
250 std::move(callback).Run(PaymentApps()); 356 std::move(callback).Run(PaymentApps());
251 return; 357 return;
252 } 358 }
253 359
254 PaymentApps apps; 360 PaymentApps apps;
255 for (const auto& item_of_raw_data : raw_data) { 361 for (const auto& item_of_raw_data : raw_data) {
362 std::unique_ptr<StoredPaymentApp> app =
363 ToStoredPaymentApp(item_of_raw_data.second);
364 if (app)
365 apps[app->origin] = std::move(app);
366 }
367
368 if (apps.size() == 0U) {
369 std::move(callback).Run(PaymentApps());
370 return;
371 }
372
373 service_worker_context_->GetUserDataForAllRegistrationsByKeyPrefix(
374 kPaymentInstrumentPrefix,
375 base::Bind(&PaymentAppDatabase::DidReadAllPaymentInstruments,
376 weak_ptr_factory_.GetWeakPtr(), base::Passed(std::move(apps)),
377 base::Passed(std::move(callback))));
378 }
379
380 void PaymentAppDatabase::DidReadAllPaymentInstruments(
381 PaymentApps apps,
382 ReadAllPaymentAppsCallback callback,
383 const std::vector<std::pair<int64_t, std::string>>& raw_data,
384 ServiceWorkerStatusCode status) {
385 DCHECK_CURRENTLY_ON(BrowserThread::IO);
386 if (status != SERVICE_WORKER_OK) {
387 std::move(callback).Run(std::move(apps));
388 return;
389 }
390
391 for (const auto& item_of_raw_data : raw_data) {
256 std::unique_ptr<StoredPaymentInstrument> instrument = 392 std::unique_ptr<StoredPaymentInstrument> instrument =
257 ToStoredPaymentInstrument(item_of_raw_data.second); 393 ToStoredPaymentInstrument(item_of_raw_data.second);
258 if (!instrument) 394 if (!instrument || !base::ContainsKey(apps, instrument->origin))
259 continue; 395 continue;
260 if (!base::ContainsKey(apps, instrument->origin)) 396 apps[instrument->origin]->instruments.push_back(std::move(instrument));
261 apps.insert(std::make_pair(instrument->origin, Instruments()));
262 apps[instrument->origin].push_back(std::move(instrument));
263 } 397 }
264 398
265 std::move(callback).Run(std::move(apps)); 399 std::move(callback).Run(std::move(apps));
266 } 400 }
267 401
268 void PaymentAppDatabase::DidFindRegistrationToDeletePaymentInstrument( 402 void PaymentAppDatabase::DidFindRegistrationToDeletePaymentInstrument(
269 const std::string& instrument_key, 403 const std::string& instrument_key,
270 DeletePaymentInstrumentCallback callback, 404 DeletePaymentInstrumentCallback callback,
271 ServiceWorkerStatusCode status, 405 ServiceWorkerStatusCode status,
272 scoped_refptr<ServiceWorkerRegistration> registration) { 406 scoped_refptr<ServiceWorkerRegistration> registration) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 ServiceWorkerStatusCode status, 563 ServiceWorkerStatusCode status,
430 scoped_refptr<ServiceWorkerRegistration> registration) { 564 scoped_refptr<ServiceWorkerRegistration> registration) {
431 DCHECK_CURRENTLY_ON(BrowserThread::IO); 565 DCHECK_CURRENTLY_ON(BrowserThread::IO);
432 if (status != SERVICE_WORKER_OK) { 566 if (status != SERVICE_WORKER_OK) {
433 std::move(callback).Run(PaymentHandlerStatus::NO_ACTIVE_WORKER); 567 std::move(callback).Run(PaymentHandlerStatus::NO_ACTIVE_WORKER);
434 return; 568 return;
435 } 569 }
436 570
437 StoredPaymentInstrumentProto instrument_proto; 571 StoredPaymentInstrumentProto instrument_proto;
438 instrument_proto.set_decoded_instrument_icon(decoded_instrument_icon); 572 instrument_proto.set_decoded_instrument_icon(decoded_instrument_icon);
439 instrument_proto.set_registration_id(registration->id());
440 instrument_proto.set_instrument_key(instrument_key); 573 instrument_proto.set_instrument_key(instrument_key);
441 instrument_proto.set_origin(registration->pattern().GetOrigin().spec()); 574 instrument_proto.set_origin(registration->pattern().GetOrigin().spec());
442 instrument_proto.set_name(instrument->name); 575 instrument_proto.set_name(instrument->name);
443 for (const auto& method : instrument->enabled_methods) { 576 for (const auto& method : instrument->enabled_methods) {
444 instrument_proto.add_enabled_methods(method); 577 instrument_proto.add_enabled_methods(method);
445 } 578 }
446 for (const auto& image_object : instrument->icons) { 579 for (const auto& image_object : instrument->icons) {
447 StoredPaymentInstrumentImageObject* image_object_proto = 580 StoredPaymentInstrumentImageObject* image_object_proto =
448 instrument_proto.add_icons(); 581 instrument_proto.add_icons();
449 image_object_proto->set_src(image_object->src.spec()); 582 image_object_proto->set_src(image_object->src.spec());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 DCHECK_CURRENTLY_ON(BrowserThread::IO); 624 DCHECK_CURRENTLY_ON(BrowserThread::IO);
492 625
493 if (status != SERVICE_WORKER_OK) { 626 if (status != SERVICE_WORKER_OK) {
494 std::move(callback).Run(PaymentHandlerStatus::NO_ACTIVE_WORKER); 627 std::move(callback).Run(PaymentHandlerStatus::NO_ACTIVE_WORKER);
495 return; 628 return;
496 } 629 }
497 630
498 KeysOfPaymentInstruments( 631 KeysOfPaymentInstruments(
499 scope, 632 scope,
500 base::BindOnce(&PaymentAppDatabase::DidGetKeysToClearPaymentInstruments, 633 base::BindOnce(&PaymentAppDatabase::DidGetKeysToClearPaymentInstruments,
501 weak_ptr_factory_.GetWeakPtr(), registration->id(), 634 weak_ptr_factory_.GetWeakPtr(), std::move(registration),
502 std::move(callback))); 635 std::move(callback)));
503 } 636 }
504 637
505 void PaymentAppDatabase::DidGetKeysToClearPaymentInstruments( 638 void PaymentAppDatabase::DidGetKeysToClearPaymentInstruments(
506 int64_t registration_id, 639 scoped_refptr<ServiceWorkerRegistration> registration,
507 ClearPaymentInstrumentsCallback callback, 640 ClearPaymentInstrumentsCallback callback,
508 const std::vector<std::string>& keys, 641 const std::vector<std::string>& keys,
509 PaymentHandlerStatus status) { 642 PaymentHandlerStatus status) {
510 DCHECK_CURRENTLY_ON(BrowserThread::IO); 643 DCHECK_CURRENTLY_ON(BrowserThread::IO);
511 644
512 if (status != PaymentHandlerStatus::SUCCESS) { 645 if (status != PaymentHandlerStatus::SUCCESS) {
513 std::move(callback).Run(PaymentHandlerStatus::NOT_FOUND); 646 std::move(callback).Run(PaymentHandlerStatus::NOT_FOUND);
514 return; 647 return;
515 } 648 }
516 649
517 std::vector<std::string> keys_with_prefix; 650 std::vector<std::string> keys_with_prefix;
518 for (const auto& key : keys) { 651 for (const auto& key : keys) {
519 keys_with_prefix.push_back(CreatePaymentInstrumentKey(key)); 652 keys_with_prefix.push_back(CreatePaymentInstrumentKey(key));
520 keys_with_prefix.push_back(CreatePaymentInstrumentKeyInfoKey(key)); 653 keys_with_prefix.push_back(CreatePaymentInstrumentKeyInfoKey(key));
521 } 654 }
522 655
656 // Clear payment app info after clearing all payment instruments.
657 keys_with_prefix.push_back(
658 CreatePaymentAppKey(registration->pattern().GetOrigin().spec()));
659
523 service_worker_context_->ClearRegistrationUserData( 660 service_worker_context_->ClearRegistrationUserData(
524 registration_id, keys_with_prefix, 661 registration->id(), keys_with_prefix,
525 base::Bind(&PaymentAppDatabase::DidClearPaymentInstruments, 662 base::Bind(&PaymentAppDatabase::DidClearPaymentInstruments,
526 weak_ptr_factory_.GetWeakPtr(), 663 weak_ptr_factory_.GetWeakPtr(),
527 base::Passed(std::move(callback)))); 664 base::Passed(std::move(callback))));
528 } 665 }
529 666
530 void PaymentAppDatabase::DidClearPaymentInstruments( 667 void PaymentAppDatabase::DidClearPaymentInstruments(
531 ClearPaymentInstrumentsCallback callback, 668 ClearPaymentInstrumentsCallback callback,
532 ServiceWorkerStatusCode status) { 669 ServiceWorkerStatusCode status) {
533 DCHECK_CURRENTLY_ON(BrowserThread::IO); 670 DCHECK_CURRENTLY_ON(BrowserThread::IO);
534 return std::move(callback).Run(status == SERVICE_WORKER_OK 671 return std::move(callback).Run(status == SERVICE_WORKER_OK
535 ? PaymentHandlerStatus::SUCCESS 672 ? PaymentHandlerStatus::SUCCESS
536 : PaymentHandlerStatus::NOT_FOUND); 673 : PaymentHandlerStatus::NOT_FOUND);
537 } 674 }
538 675
539 } // namespace content 676 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698