Chromium Code Reviews| Index: components/payments/core/payment_request_data_util.cc |
| diff --git a/components/payments/core/payment_request_data_util.cc b/components/payments/core/payment_request_data_util.cc |
| index 8a9585f7c2fc03d1e1870814ed9f7e3019150c9b..8c17d20299dece1630ea1e5bc822f0f311ca8266 100644 |
| --- a/components/payments/core/payment_request_data_util.cc |
| +++ b/components/payments/core/payment_request_data_util.cc |
| @@ -11,7 +11,6 @@ |
| #include "components/autofill/core/browser/autofill_country.h" |
| #include "components/autofill/core/browser/autofill_data_util.h" |
| #include "components/autofill/core/browser/autofill_profile.h" |
| -#include "components/autofill/core/browser/credit_card.h" |
| #include "components/autofill/core/browser/field_types.h" |
| #include "components/autofill/core/browser/personal_data_manager.h" |
| #include "components/autofill/core/browser/validation.h" |
| @@ -154,6 +153,33 @@ void ParseBasicCardSupportedNetworks( |
| } |
| } |
| +void ParseSupportedCardTypes( |
| + const std::vector<PaymentMethodData>& method_data, |
| + std::set<autofill::CreditCard::CardType>* out_supported_card_types_set) { |
| + DCHECK(out_supported_card_types_set->empty()); |
| + |
| + for (const PaymentMethodData& method_data_entry : method_data) { |
|
please use gerrit instead
2017/06/29 19:31:49
You should ignore all |method_data_entry| items wh
Moe
2017/06/30 15:44:57
Done.
|
| + for (const autofill::CreditCard::CardType& card_type : |
| + method_data_entry.supported_types) { |
| + out_supported_card_types_set->insert(card_type); |
| + } |
| + |
|
please use gerrit instead
2017/06/29 19:31:49
The outer for loop should stop here.
Moe
2017/06/30 15:44:57
My bad. Done.
|
| + // Omitting the card types means all 3 card types are supported. |
| + if (out_supported_card_types_set->empty()) { |
| + out_supported_card_types_set->insert( |
| + autofill::CreditCard::CARD_TYPE_CREDIT); |
| + out_supported_card_types_set->insert( |
| + autofill::CreditCard::CARD_TYPE_DEBIT); |
| + out_supported_card_types_set->insert( |
| + autofill::CreditCard::CARD_TYPE_PREPAID); |
| + } |
| + |
| + // Let the user decide whether an unknown card type should be used. |
| + out_supported_card_types_set->insert( |
| + autofill::CreditCard::CARD_TYPE_UNKNOWN); |
| + } |
| +} |
| + |
| base::string16 GetFormattedPhoneNumberForDisplay( |
| const autofill::AutofillProfile& profile, |
| const std::string& locale) { |