| 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_manager.h" | 5 #include "content/browser/payments/payment_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 binding_.set_connection_error_handler( | 33 binding_.set_connection_error_handler( |
| 34 base::Bind(&PaymentManager::OnConnectionError, base::Unretained(this))); | 34 base::Bind(&PaymentManager::OnConnectionError, base::Unretained(this))); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void PaymentManager::Init(const std::string& scope) { | 37 void PaymentManager::Init(const std::string& scope) { |
| 38 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 38 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 39 scope_ = GURL(scope); | 39 scope_ = GURL(scope); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void PaymentManager::SetManifest( | |
| 43 payments::mojom::PaymentAppManifestPtr manifest, | |
| 44 SetManifestCallback callback) { | |
| 45 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 46 | |
| 47 // TODO(zino): Should implement requesting a permission for users to allow | |
| 48 // the payment app to be registered. Please see http://crbug.com/665949. | |
| 49 | |
| 50 payment_app_context_->payment_app_database()->WriteManifest( | |
| 51 scope_, std::move(manifest), std::move(callback)); | |
| 52 } | |
| 53 | |
| 54 void PaymentManager::GetManifest(GetManifestCallback callback) { | |
| 55 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 56 | |
| 57 payment_app_context_->payment_app_database()->ReadManifest( | |
| 58 scope_, std::move(callback)); | |
| 59 } | |
| 60 | |
| 61 void PaymentManager::DeletePaymentInstrument( | 42 void PaymentManager::DeletePaymentInstrument( |
| 62 const std::string& instrument_key, | 43 const std::string& instrument_key, |
| 63 PaymentManager::DeletePaymentInstrumentCallback callback) { | 44 PaymentManager::DeletePaymentInstrumentCallback callback) { |
| 64 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 45 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 65 | 46 |
| 66 payment_app_context_->payment_app_database()->DeletePaymentInstrument( | 47 payment_app_context_->payment_app_database()->DeletePaymentInstrument( |
| 67 scope_, instrument_key, std::move(callback)); | 48 scope_, instrument_key, std::move(callback)); |
| 68 } | 49 } |
| 69 | 50 |
| 70 void PaymentManager::GetPaymentInstrument( | 51 void PaymentManager::GetPaymentInstrument( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 payment_app_context_->payment_app_database()->ClearPaymentInstruments( | 91 payment_app_context_->payment_app_database()->ClearPaymentInstruments( |
| 111 scope_, std::move(callback)); | 92 scope_, std::move(callback)); |
| 112 } | 93 } |
| 113 | 94 |
| 114 void PaymentManager::OnConnectionError() { | 95 void PaymentManager::OnConnectionError() { |
| 115 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 96 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 116 payment_app_context_->PaymentManagerHadConnectionError(this); | 97 payment_app_context_->PaymentManagerHadConnectionError(this); |
| 117 } | 98 } |
| 118 | 99 |
| 119 } // namespace content | 100 } // namespace content |
| OLD | NEW |