| OLD | NEW |
| 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 scoped_refptr<ServiceWorkerRegistration> registration) { | 344 scoped_refptr<ServiceWorkerRegistration> registration) { |
| 345 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 345 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 346 if (status != SERVICE_WORKER_OK) { | 346 if (status != SERVICE_WORKER_OK) { |
| 347 std::move(callback).Run(PaymentHandlerStatus::NO_ACTIVE_WORKER); | 347 std::move(callback).Run(PaymentHandlerStatus::NO_ACTIVE_WORKER); |
| 348 return; | 348 return; |
| 349 } | 349 } |
| 350 | 350 |
| 351 service_worker_context_->GetRegistrationUserData( | 351 service_worker_context_->GetRegistrationUserData( |
| 352 registration->id(), {CreatePaymentInstrumentKey(instrument_key)}, | 352 registration->id(), {CreatePaymentInstrumentKey(instrument_key)}, |
| 353 base::Bind(&PaymentAppDatabase::DidHasPaymentInstrument, | 353 base::Bind(&PaymentAppDatabase::DidHasPaymentInstrument, |
| 354 weak_ptr_factory_.GetWeakPtr(), registration->id(), | 354 weak_ptr_factory_.GetWeakPtr(), |
| 355 instrument_key, base::Passed(std::move(callback)))); | 355 base::Passed(std::move(callback)))); |
| 356 } | 356 } |
| 357 | 357 |
| 358 void PaymentAppDatabase::DidHasPaymentInstrument( | 358 void PaymentAppDatabase::DidHasPaymentInstrument( |
| 359 int64_t registration_id, | |
| 360 const std::string& instrument_key, | |
| 361 DeletePaymentInstrumentCallback callback, | 359 DeletePaymentInstrumentCallback callback, |
| 362 const std::vector<std::string>& data, | 360 const std::vector<std::string>& data, |
| 363 ServiceWorkerStatusCode status) { | 361 ServiceWorkerStatusCode status) { |
| 364 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 362 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 365 if (status != SERVICE_WORKER_OK || data.size() != 1) { | 363 if (status != SERVICE_WORKER_OK || data.size() != 1) { |
| 366 std::move(callback).Run(PaymentHandlerStatus::NOT_FOUND); | 364 std::move(callback).Run(PaymentHandlerStatus::NOT_FOUND); |
| 367 return; | 365 return; |
| 368 } | 366 } |
| 369 | 367 |
| 370 std::move(callback).Run(PaymentHandlerStatus::SUCCESS); | 368 std::move(callback).Run(PaymentHandlerStatus::SUCCESS); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 void PaymentAppDatabase::DidClearPaymentInstruments( | 470 void PaymentAppDatabase::DidClearPaymentInstruments( |
| 473 ClearPaymentInstrumentsCallback callback, | 471 ClearPaymentInstrumentsCallback callback, |
| 474 ServiceWorkerStatusCode status) { | 472 ServiceWorkerStatusCode status) { |
| 475 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 473 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 476 return std::move(callback).Run(status == SERVICE_WORKER_OK | 474 return std::move(callback).Run(status == SERVICE_WORKER_OK |
| 477 ? PaymentHandlerStatus::SUCCESS | 475 ? PaymentHandlerStatus::SUCCESS |
| 478 : PaymentHandlerStatus::NOT_FOUND); | 476 : PaymentHandlerStatus::NOT_FOUND); |
| 479 } | 477 } |
| 480 | 478 |
| 481 } // namespace content | 479 } // namespace content |
| OLD | NEW |