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

Unified Diff: components/payments/core/payment_request_data_util.cc

Issue 2847503002: [WebPayments] Show labels on incomplete profiles (Closed)
Patch Set: test fix Created 3 years, 8 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/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
« no previous file with comments | « components/payments/core/payment_request_data_util.h ('k') | components/payments/core/payments_profile_comparator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698