| 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 "components/payments/payment_request.h" | 5 #include "components/payments/payment_request.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "components/autofill/core/browser/personal_data_manager.h" | 8 #include "components/autofill/core/browser/personal_data_manager.h" |
| 9 #include "components/payments/payment_details_validation.h" | 9 #include "components/payments/payment_details_validation.h" |
| 10 #include "components/payments/payment_request_delegate.h" | 10 #include "components/payments/payment_request_delegate.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); | 58 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void PaymentRequest::OnError() { | 61 void PaymentRequest::OnError() { |
| 62 binding_.Close(); | 62 binding_.Close(); |
| 63 manager_->DestroyRequest(this); | 63 manager_->DestroyRequest(this); |
| 64 } | 64 } |
| 65 | 65 |
| 66 CurrencyFormatter* PaymentRequest::GetOrCreateCurrencyFormatter( | 66 CurrencyFormatter* PaymentRequest::GetOrCreateCurrencyFormatter( |
| 67 const std::string& currency_code, | 67 const std::string& currency_code, |
| 68 const base::Optional<std::string> currency_system, | 68 const std::string& currency_system, |
| 69 const std::string& locale_name) { | 69 const std::string& locale_name) { |
| 70 if (!currency_formatter_) { | 70 if (!currency_formatter_) { |
| 71 currency_formatter_.reset( | 71 currency_formatter_.reset( |
| 72 new CurrencyFormatter(currency_code, currency_system, locale_name)); | 72 new CurrencyFormatter(currency_code, currency_system, locale_name)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 return currency_formatter_.get(); | 75 return currency_formatter_.get(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 autofill::AutofillProfile* PaymentRequest::GetCurrentlySelectedProfile() { | 78 autofill::AutofillProfile* PaymentRequest::GetCurrentlySelectedProfile() { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 101 cards.begin(), | 101 cards.begin(), |
| 102 cards.end(), | 102 cards.end(), |
| 103 [] (autofill::CreditCard* card) { | 103 [] (autofill::CreditCard* card) { |
| 104 return card->IsValid(); | 104 return card->IsValid(); |
| 105 }); | 105 }); |
| 106 | 106 |
| 107 return first_complete_card == cards.end() ? nullptr : *first_complete_card; | 107 return first_complete_card == cards.end() ? nullptr : *first_complete_card; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace payments | 110 } // namespace payments |
| OLD | NEW |