[WebPayments] Adding Shipping Address and Contact Info display to order summary
BUG=679449
Review-Url: https://codereview.chromium.org/2625183002
Cr-Commit-Position: refs/heads/master@{#444778}
diff --git a/components/payments/payment_request.cc b/components/payments/payment_request.cc
index 06ec2b4..282b3fa 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 @@
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.