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

Unified Diff: components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc

Issue 212873003: Store the language code for the address in autofill profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 6 years, 9 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/webdata/autofill_profile_syncable_service.cc
diff --git a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc
index 5baf5566b77c4b6ba794d4d7632f8b526076fdbf..16260f1326449e34520c165ac025b51eba90984e 100644
--- a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc
+++ b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc
@@ -374,6 +374,15 @@ bool AutofillProfileSyncableService::OverwriteProfileWithServerData(
diff = UpdateField(ADDRESS_HOME_LINE2,
specifics.address_home_line2(), profile) || diff;
}
+
+ // Update the BCP 47 language code that can be used to format the address for
+ // display.
+ if (specifics.has_address_home_language_code() &&
+ specifics.address_home_language_code() != profile->language_code()) {
+ profile->set_language_code(specifics.address_home_language_code());
+ diff = true;
+ }
+
return diff;
}
@@ -416,21 +425,22 @@ void AutofillProfileSyncableService::WriteAutofillProfile(
LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_LINE1))));
specifics->set_address_home_line2(
LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_LINE2))));
+ specifics->set_address_home_street_address(
+ LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS))));
+ specifics->set_address_home_dependent_locality(
+ LimitData(
+ UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY))));
specifics->set_address_home_city(
LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY))));
specifics->set_address_home_state(
LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE))));
specifics->set_address_home_zip(
LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP))));
- specifics->set_address_home_country(
- LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY))));
- specifics->set_address_home_street_address(
- LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS))));
specifics->set_address_home_sorting_code(
LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE))));
- specifics->set_address_home_dependent_locality(
- LimitData(
- UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY))));
+ specifics->set_address_home_country(
+ LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY))));
+ specifics->set_address_home_language_code(LimitData(profile.language_code()));
profile.GetRawMultiInfo(EMAIL_ADDRESS, &values);
for (size_t i = 0; i < values.size(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698