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

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

Issue 1143253012: More work on removing variants from Autofill (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: work around iOS lameness Created 5 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/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 80512eede9e7fb5ee23172383b36a2e8253de7dd..b438e6532fc8260f7e0d8e67c6ba7e127deb51ae 100644
--- a/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc
+++ b/components/autofill/core/browser/webdata/autofill_profile_syncable_service.cc
@@ -423,27 +423,15 @@ void AutofillProfileSyncableService::WriteAutofillProfile(
specifics->set_use_count(profile.use_count());
specifics->set_use_date(profile.use_date().ToTimeT());
- std::vector<base::string16> values;
- profile.GetRawMultiInfo(NAME_FIRST, &values);
- for (size_t i = 0; i < values.size(); ++i) {
- specifics->add_name_first(LimitData(UTF16ToUTF8(values[i])));
- }
-
- profile.GetRawMultiInfo(NAME_MIDDLE, &values);
- for (size_t i = 0; i < values.size(); ++i) {
- specifics->add_name_middle(LimitData(UTF16ToUTF8(values[i])));
- }
-
- profile.GetRawMultiInfo(NAME_LAST, &values);
- for (size_t i = 0; i < values.size(); ++i) {
- specifics->add_name_last(LimitData(UTF16ToUTF8(values[i])));
- }
-
- profile.GetRawMultiInfo(NAME_FULL, &values);
- for (size_t i = 0; i < values.size(); ++i) {
- specifics->add_name_full(LimitData(UTF16ToUTF8(values[i])));
- }
-
+ // TODO(estade): this should be set_name_first.
+ specifics->add_name_first(
+ LimitData(UTF16ToUTF8(profile.GetRawInfo(NAME_FIRST))));
+ specifics->add_name_middle(
+ LimitData(UTF16ToUTF8(profile.GetRawInfo(NAME_MIDDLE))));
+ specifics->add_name_last(
+ LimitData(UTF16ToUTF8(profile.GetRawInfo(NAME_LAST))));
+ specifics->add_name_full(
+ LimitData(UTF16ToUTF8(profile.GetRawInfo(NAME_FULL))));
specifics->set_address_home_line1(
LimitData(UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_LINE1))));
specifics->set_address_home_line2(
@@ -465,6 +453,7 @@ void AutofillProfileSyncableService::WriteAutofillProfile(
UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY))));
specifics->set_address_home_language_code(LimitData(profile.language_code()));
+ std::vector<base::string16> values;
profile.GetRawMultiInfo(EMAIL_ADDRESS, &values);
for (size_t i = 0; i < values.size(); ++i) {
specifics->add_email_address(LimitData(UTF16ToUTF8(values[i])));
@@ -659,9 +648,8 @@ bool AutofillProfileSyncableService::MergeProfile(
const AutofillProfile& merge_from,
AutofillProfile* merge_into,
const std::string& app_locale) {
- // Overwrites all single values and adds to multi-values. Does not overwrite
- // GUID.
- merge_into->OverwriteWithOrAddTo(merge_from, app_locale);
+ // Overwrites all values. Does not overwrite GUID.
+ merge_into->OverwriteWith(merge_from, app_locale);
return !merge_into->EqualsForSyncPurposes(merge_from);
}

Powered by Google App Engine
This is Rietveld 408576698