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

Unified Diff: components/webdata/autofill/autofill_table.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
« no previous file with comments | « components/autofill/browser/wallet/wallet_address.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webdata/autofill/autofill_table.cc
===================================================================
--- components/webdata/autofill/autofill_table.cc (revision 192389)
+++ components/webdata/autofill/autofill_table.cc (working copy)
@@ -51,7 +51,8 @@
}
void BindAutofillProfileToStatement(const AutofillProfile& profile,
- sql::Statement* s) {
+ sql::Statement* s,
+ const std::string& app_locale) {
DCHECK(base::IsValidGUID(profile.guid()));
s->BindString(0, profile.guid());
@@ -67,14 +68,15 @@
s->BindString16(5, LimitDataSize(text));
text = profile.GetRawInfo(ADDRESS_HOME_ZIP);
s->BindString16(6, LimitDataSize(text));
+ text = profile.GetInfo(ADDRESS_HOME_COUNTRY, app_locale);
+ s->BindString16(7, LimitDataSize(text));
text = profile.GetRawInfo(ADDRESS_HOME_COUNTRY);
- s->BindString16(7, LimitDataSize(text));
- std::string country_code = profile.CountryCode();
- s->BindString(8, country_code);
+ s->BindString16(8, LimitDataSize(text));
s->BindInt64(9, Time::Now().ToTimeT());
}
-AutofillProfile* AutofillProfileFromStatement(const sql::Statement& s) {
+AutofillProfile* AutofillProfileFromStatement(const sql::Statement& s,
+ const std::string& app_locale) {
AutofillProfile* profile = new AutofillProfile;
profile->set_guid(s.ColumnString(0));
DCHECK(base::IsValidGUID(profile->guid()));
@@ -86,7 +88,7 @@
profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(5));
profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(6));
// Intentionally skip column 7, which stores the localized country name.
- profile->SetCountryCode(s.ColumnString(8));
+ profile->SetRawInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(8));
// Intentionally skip column 9, which stores the profile's modification date.
return profile;
@@ -933,7 +935,7 @@
"(guid, company_name, address_line_1, address_line_2, city, state,"
" zipcode, country, country_code, date_modified)"
"VALUES (?,?,?,?,?,?,?,?,?,?)"));
- BindAutofillProfileToStatement(profile, &s);
+ BindAutofillProfileToStatement(profile, &s, app_locale_);
if (!s.Run())
return false;
@@ -955,7 +957,7 @@
if (!s.Step())
return false;
- scoped_ptr<AutofillProfile> p(AutofillProfileFromStatement(s));
+ scoped_ptr<AutofillProfile> p(AutofillProfileFromStatement(s, app_locale_));
// Get associated name info.
AddAutofillProfileNamesToProfile(db_, p.get());
@@ -1048,7 +1050,7 @@
" city=?, state=?, zipcode=?, country=?, country_code=?, "
" date_modified=? "
"WHERE guid=?"));
- BindAutofillProfileToStatement(profile, &s);
+ BindAutofillProfileToStatement(profile, &s, app_locale_);
s.BindString(10, profile.guid());
bool result = s.Run();
@@ -1855,7 +1857,7 @@
profile.SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(8));
profile.SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(9));
profile.SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(10));
- profile.SetRawInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(11));
+ profile.SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(11), app_locale_);
profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(12));
int64 date_modified = s.ColumnInt64(13);
« no previous file with comments | « components/autofill/browser/wallet/wallet_address.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698