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

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: review comments 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/webdata/autofill/autofill_table.cc
===================================================================
--- components/webdata/autofill/autofill_table.cc (revision 192389)
+++ components/webdata/autofill/autofill_table.cc (working copy)
@@ -17,6 +17,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/time.h"
#include "base/tuple.h"
+#include "base/utf_string_conversions.h"
Ilya Sherman 2013/04/05 07:18:41 nit: Not needed now?
jam 2013/04/05 07:35:35 Done.
jam 2013/04/05 07:35:35 Done.
#include "components/autofill/browser/autofill_country.h"
#include "components/autofill/browser/autofill_profile.h"
#include "components/autofill/browser/autofill_type.h"
@@ -51,7 +52,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 +69,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 +89,8 @@
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));
+ string16 country_code = s.ColumnString16(8);
Ilya Sherman 2013/04/05 07:18:41 nit: Probably no need for this expression to have
jam 2013/04/05 07:35:35 Done.
+ profile->SetRawInfo(ADDRESS_HOME_COUNTRY, country_code);
// Intentionally skip column 9, which stores the profile's modification date.
return profile;
@@ -933,7 +937,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 +959,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 +1052,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 +1859,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);

Powered by Google App Engine
This is Rietveld 408576698