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

Unified Diff: components/autofill/browser/personal_data_manager.cc

Issue 13697002: Make autofill's Address store country using the country code so that app locale isn't needed for th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix remaining tests Created 7 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/autofill/browser/personal_data_manager.cc
===================================================================
--- components/autofill/browser/personal_data_manager.cc (revision 192389)
+++ components/autofill/browser/personal_data_manager.cc (working copy)
@@ -87,7 +87,8 @@
if (profile.GetRawInfo(ADDRESS_HOME_LINE1).empty())
return false;
std::string app_locale = AutofillCountry::ApplicationLocale();
- std::string country_code = profile.CountryCode();
+ std::string country_code =
+ UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY));
if (country_code.empty())
country_code = AutofillCountry::CountryCodeForLocale(app_locale);
@@ -278,7 +279,8 @@
// Reject profiles with invalid country information.
if (field_type == ADDRESS_HOME_COUNTRY &&
- !value.empty() && imported_profile->CountryCode().empty()) {
+ !value.empty() &&
+ imported_profile->GetRawInfo(ADDRESS_HOME_COUNTRY).empty()) {
imported_profile.reset();
break;
}
@@ -667,15 +669,15 @@
// Reject profiles with invalid US state information.
string16 state = profile.GetRawInfo(ADDRESS_HOME_STATE);
- if (profile.CountryCode() == "US" &&
+ if (profile.GetRawInfo(ADDRESS_HOME_COUNTRY) == ASCIIToUTF16("US") &&
!state.empty() && !FormGroup::IsValidState(state)) {
return false;
}
// Reject profiles with invalid US zip information.
string16 zip = profile.GetRawInfo(ADDRESS_HOME_ZIP);
- if (profile.CountryCode() == "US" && !zip.empty() &&
- !autofill::IsValidZip(zip))
+ if (profile.GetRawInfo(ADDRESS_HOME_COUNTRY) == ASCIIToUTF16("US") &&
+ !zip.empty() && !autofill::IsValidZip(zip))
return false;
return true;
« no previous file with comments | « components/autofill/browser/autofill_profile_unittest.cc ('k') | components/autofill/browser/phone_number.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698