| Index: components/payments/payment_request.cc
|
| diff --git a/components/payments/payment_request.cc b/components/payments/payment_request.cc
|
| index 06ec2b4f46562699b0baa795d00e07d512754bd2..282b3fa38afad3d8ef83f6db57f9f05c532ca0ad 100644
|
| --- a/components/payments/payment_request.cc
|
| +++ b/components/payments/payment_request.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "components/payments/payment_request.h"
|
|
|
| +#include "base/memory/ptr_util.h"
|
| #include "components/autofill/core/browser/personal_data_manager.h"
|
| #include "components/payments/payment_details_validation.h"
|
| #include "components/payments/payment_request_delegate.h"
|
| @@ -74,6 +75,19 @@ CurrencyFormatter* PaymentRequest::GetOrCreateCurrencyFormatter(
|
| return currency_formatter_.get();
|
| }
|
|
|
| +autofill::AutofillProfile* PaymentRequest::GetCurrentlySelectedProfile() {
|
| + // TODO(tmartino): Implement more sophisticated algorithm for populating
|
| + // this when it starts empty.
|
| + if (!profile_) {
|
| + autofill::PersonalDataManager* data_manager =
|
| + delegate_->GetPersonalDataManager();
|
| + auto profiles = data_manager->GetProfiles();
|
| + if (!profiles.empty())
|
| + profile_ = base::MakeUnique<autofill::AutofillProfile>(*profiles[0]);
|
| + }
|
| + return profile_ ? profile_.get() : nullptr;
|
| +}
|
| +
|
| autofill::CreditCard* PaymentRequest::GetCurrentlySelectedCreditCard() {
|
| // TODO(anthonyvd): Change this code to prioritize server cards and implement
|
| // a way to modify this function's return value.
|
|
|