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

Unified Diff: components/autofill/core/browser/autofill_country.cc

Issue 298863012: Use upstream libaddressinput in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review. Created 6 years, 6 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/autofill/core/browser/autofill_country.cc
diff --git a/components/autofill/core/browser/autofill_country.cc b/components/autofill/core/browser/autofill_country.cc
index 52428d6440bfb70ba7a9f7f4cf81680fba2cdd8e..ff52e321bbb549574f0e28962d934c15af050d70 100644
--- a/components/autofill/core/browser/autofill_country.cc
+++ b/components/autofill/core/browser/autofill_country.cc
@@ -66,9 +66,6 @@ const StaticCountryData kCountryData[] = {
{ "AM", { IDS_AUTOFILL_FIELD_LABEL_POSTAL_CODE,
IDS_AUTOFILL_FIELD_LABEL_PROVINCE,
ADDRESS_REQUIREMENTS_UNKNOWN } },
- { "AN", { IDS_AUTOFILL_FIELD_LABEL_POSTAL_CODE,
- IDS_AUTOFILL_FIELD_LABEL_PROVINCE,
- ADDRESS_REQUIREMENTS_UNKNOWN } },
{ "AO", { IDS_AUTOFILL_FIELD_LABEL_POSTAL_CODE,
IDS_AUTOFILL_FIELD_LABEL_PROVINCE,
ADDRESS_REQUIREMENTS_UNKNOWN } },
@@ -756,6 +753,9 @@ const StaticCountryData kCountryData[] = {
{ "WS", { IDS_AUTOFILL_FIELD_LABEL_POSTAL_CODE,
IDS_AUTOFILL_FIELD_LABEL_PROVINCE,
ADDRESS_REQUIREMENTS_UNKNOWN } },
+ { "XK", { IDS_AUTOFILL_FIELD_LABEL_POSTAL_CODE,
+ IDS_AUTOFILL_FIELD_LABEL_PROVINCE,
+ ADDRESS_REQUIREMENTS_UNKNOWN } },
{ "YE", { IDS_AUTOFILL_FIELD_LABEL_POSTAL_CODE,
IDS_AUTOFILL_FIELD_LABEL_PROVINCE,
ADDRESS_REQUIRES_CITY } },
@@ -1044,15 +1044,18 @@ const std::string CountryNames::GetSortKey(const icu::Collator& collator,
AutofillCountry::AutofillCountry(const std::string& country_code,
const std::string& locale) {
- const CountryDataMap::Iterator result = CountryDataMap::Find(country_code);
- DCHECK(result != CountryDataMap::End());
- const CountryData& data = result->second;
-
country_code_ = country_code;
name_ = l10n_util::GetDisplayNameForCountry(country_code, locale);
- postal_code_label_ = l10n_util::GetStringUTF16(data.postal_code_label_id);
- state_label_ = l10n_util::GetStringUTF16(data.state_label_id);
- address_required_fields_ = data.address_required_fields;
+
+ const CountryDataMap::Iterator result = CountryDataMap::Find(country_code);
+ if (result != CountryDataMap::End()) {
+ const CountryData& data = result->second;
+ postal_code_label_ = l10n_util::GetStringUTF16(data.postal_code_label_id);
+ state_label_ = l10n_util::GetStringUTF16(data.state_label_id);
+ address_required_fields_ = data.address_required_fields;
+ } else {
+ postal_code_label_ = state_label_ = base::ASCIIToUTF16("[UNKNOWN]");
+ }
please use gerrit instead 2014/06/05 22:22:48 Investigate: This change be unnecessary after the
please use gerrit instead 2014/06/09 23:28:16 Done.
}
AutofillCountry::~AutofillCountry() {

Powered by Google App Engine
This is Rietveld 408576698