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

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

Issue 969103003: Don't save duplicates of wallet addresses to local Autofill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make test work Created 5 years, 10 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_table.cc
diff --git a/components/autofill/core/browser/webdata/autofill_table.cc b/components/autofill/core/browser/webdata/autofill_table.cc
index ea0475858041823285da2b5dd26d18ff64a40168..f05a739e7c905e15bfed9dc2c66a0fa74ca64604 100644
--- a/components/autofill/core/browser/webdata/autofill_table.cc
+++ b/components/autofill/core/browser/webdata/autofill_table.cc
@@ -895,8 +895,7 @@ bool AutofillTable::GetAutofillProfiles(
return s.Succeeded();
}
-bool AutofillTable::GetAutofillServerProfiles(
- std::vector<AutofillProfile*>* profiles) {
+bool AutofillTable::GetServerProfiles(std::vector<AutofillProfile*>* profiles) {
profiles->clear();
sql::Statement s(db_->GetUniqueStatement(
@@ -920,7 +919,7 @@ bool AutofillTable::GetAutofillServerProfiles(
scoped_ptr<AutofillProfile> profile(new AutofillProfile(
AutofillProfile::SERVER_PROFILE, s.ColumnString(index++)));
- profile->SetRawInfo(NAME_FULL, s.ColumnString16(index++));
+ base::string16 recipient_name = s.ColumnString16(index++);
profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(index++));
profile->SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, s.ColumnString16(index++));
profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(index++));
@@ -933,13 +932,18 @@ bool AutofillTable::GetAutofillServerProfiles(
profile->SetRawInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(index++));
profile->set_language_code(s.ColumnString(index++));
+ // SetInfo instead of SetRawInfo on the name so the constituent pieces will
+ // be parsed.
+ profile->SetInfo(AutofillType(NAME_FULL), recipient_name,
+ profile->language_code());
+
profiles->push_back(profile.release());
}
return s.Succeeded();
}
-void AutofillTable::SetAutofillServerProfiles(
+void AutofillTable::SetServerProfiles(
const std::vector<AutofillProfile>& profiles) {
// Delete all old ones first.
sql::Statement delete_old(db_->GetUniqueStatement(

Powered by Google App Engine
This is Rietveld 408576698