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

Unified Diff: components/payments/content/payment_request_spec.cc

Issue 2779453002: [Payments] Return the preferred payment method name to the merchant (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: components/payments/content/payment_request_spec.cc
diff --git a/components/payments/content/payment_request_spec.cc b/components/payments/content/payment_request_spec.cc
index 5a92e86c71cc40d7986e3e1b941299e3bf3bb8fa..aa1dd2f651c75ccf5a18448778cd8c71eb9f5872 100644
--- a/components/payments/content/payment_request_spec.cc
+++ b/components/payments/content/payment_request_spec.cc
@@ -39,6 +39,11 @@ void PaymentRequestSpec::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
+bool PaymentRequestSpec::IsMethodSupportedThroughBasicCard(
+ const std::string& method_name) {
+ return basic_card_specified_networks_.count(method_name);
+}
+
base::string16 PaymentRequestSpec::GetFormattedCurrencyAmount(
const std::string& amount) {
CurrencyFormatter* formatter = GetOrCreateCurrencyFormatter(
@@ -94,6 +99,8 @@ void PaymentRequestSpec::PopulateValidatedMethodData(
supported_card_networks_.insert(supported_card_networks_.end(),
card_networks.begin(),
card_networks.end());
+ basic_card_specified_networks_.insert(card_networks.begin(),
+ card_networks.end());
// Clear the set so that no further networks are added to
// |supported_card_networks_|.
card_networks.clear();
@@ -117,6 +124,8 @@ void PaymentRequestSpec::PopulateValidatedMethodData(
auto card_it = card_networks.find(networks[supported_network]);
if (card_it != card_networks.end()) {
supported_card_networks_.push_back(networks[supported_network]);
+ basic_card_specified_networks_.insert(
+ networks[supported_network]);
card_networks.erase(card_it);
}
}

Powered by Google App Engine
This is Rietveld 408576698