Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Unified Diff: components/payments/payment_request.cc

Issue 2625183002: [WebPayments] Adding Shipping Address and Contact Info display to order summary (Closed)
Patch Set: sky comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/payments/payment_request.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « components/payments/payment_request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698