| 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 3fd13c913d0a4478dc9c9fa2e944fcb741c6a757..87ad961f5d57c5756bde48c6e400df0cd649228e 100644
|
| --- a/components/payments/core/payment_request_data_util.cc
|
| +++ b/components/payments/core/payment_request_data_util.cc
|
| @@ -7,6 +7,8 @@
|
| #include "base/strings/string16.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| +#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"
|
| @@ -162,5 +164,14 @@ std::string FormatPhoneForResponse(const std::string& phone_number,
|
| PhoneNumberUtil::PhoneNumberFormat::E164);
|
| }
|
|
|
| +std::string GetCountryCodeWithFallback(const autofill::AutofillProfile* profile,
|
| + const std::string& app_locale) {
|
| + std::string country_code =
|
| + base::UTF16ToUTF8(profile->GetRawInfo(autofill::ADDRESS_HOME_COUNTRY));
|
| + if (!autofill::data_util::IsValidCountryCode(country_code))
|
| + country_code = autofill::AutofillCountry::CountryCodeForLocale(app_locale);
|
| + return country_code;
|
| +}
|
| +
|
| } // namespace data_util
|
| } // namespace payments
|
|
|