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

Unified Diff: ios/chrome/browser/payments/payment_request.mm

Issue 2744823003: [Payment Request] Generic edit form (Closed)
Patch Set: Created 3 years, 9 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
Index: ios/chrome/browser/payments/payment_request.mm
diff --git a/ios/chrome/browser/payments/payment_request.mm b/ios/chrome/browser/payments/payment_request.mm
index 68e0830fcad0470fe87cee6bf7359fdf1c2263a3..a4c80b5aa6d30e2ee3cd477d8651b6a7ff5e6c7e 100644
--- a/ios/chrome/browser/payments/payment_request.mm
+++ b/ios/chrome/browser/payments/payment_request.mm
@@ -4,8 +4,6 @@
#include "ios/chrome/browser/payments/payment_request.h"
-#include <unordered_set>
-
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill_data_util.h"
#include "components/autofill/core/browser/autofill_profile.h"
@@ -53,6 +51,12 @@ payments::CurrencyFormatter* PaymentRequest::GetOrCreateCurrencyFormatter() {
return currency_formatter_.get();
}
+void PaymentRequest::AddCreditCard(
+ std::unique_ptr<autofill::CreditCard> credit_card) {
+ credit_card_cache_.insert(credit_card_cache_.begin(), std::move(credit_card));
+ credit_cards_.insert(credit_cards_.begin(), credit_card_cache_.front().get());
+}
+
void PaymentRequest::PopulateProfileCache() {
for (const auto* profile : personal_data_manager_->GetProfilesToSuggest()) {
profile_cache_.push_back(
@@ -73,10 +77,9 @@ void PaymentRequest::PopulateProfileCache() {
void PaymentRequest::PopulateCreditCardCache() {
DCHECK(web_payment_request_);
- std::unordered_set<base::string16> supported_method_types;
for (const auto& method_data : web_payment_request_->method_data) {
for (const auto& supported_method : method_data.supported_methods)
- supported_method_types.insert(supported_method);
+ supported_card_networks_.insert(base::UTF16ToASCII(supported_method));
}
std::vector<autofill::CreditCard*> credit_cards =
@@ -91,8 +94,8 @@ void PaymentRequest::PopulateCreditCardCache() {
std::string spec_card_type =
autofill::data_util::GetPaymentRequestData(credit_card->type())
.basic_card_payment_type;
- if (supported_method_types.find(base::ASCIIToUTF16(spec_card_type)) !=
- supported_method_types.end()) {
+ if (supported_card_networks_.find(spec_card_type) !=
+ supported_card_networks_.end()) {
credit_card_cache_.push_back(
base::MakeUnique<autofill::CreditCard>(*credit_card));
credit_cards_.push_back(credit_card_cache_.back().get());

Powered by Google App Engine
This is Rietveld 408576698