Make autofill's Address store country using the country code so that app locale isn't needed for the raw methods.
This is in preparation for removing content::GetContentClient calls outside of content.
BUG=227047
Review URL: https://codereview.chromium.org/13697002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192588 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/autofill/android/personal_data_manager_android.cc b/chrome/browser/autofill/android/personal_data_manager_android.cc
index d907c7c33..c5c0a5b 100644
--- a/chrome/browser/autofill/android/personal_data_manager_android.cc
+++ b/chrome/browser/autofill/android/personal_data_manager_android.cc
@@ -51,7 +51,8 @@
profile.GetRawInfo(ADDRESS_HOME_ZIP)).obj(),
ConvertUTF16ToJavaString(
env,
- profile.GetRawInfo(ADDRESS_HOME_COUNTRY)).obj(),
+ profile.GetInfo(ADDRESS_HOME_COUNTRY,
+ g_browser_process->GetApplicationLocale())).obj(),
ConvertUTF16ToJavaString(
env,
profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)).obj(),
@@ -90,10 +91,11 @@
ADDRESS_HOME_ZIP,
ConvertJavaStringToUTF16(
Java_AutofillProfile_getZip(env, jprofile)));
- profile->SetRawInfo(
+ profile->SetInfo(
ADDRESS_HOME_COUNTRY,
ConvertJavaStringToUTF16(
- Java_AutofillProfile_getCountry(env, jprofile)));
+ Java_AutofillProfile_getCountry(env, jprofile)),
+ g_browser_process->GetApplicationLocale());
profile->SetRawInfo(
PHONE_HOME_WHOLE_NUMBER,
ConvertJavaStringToUTF16(
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc
index c827a2a..af63f86 100644
--- a/chrome/browser/autofill/autofill_browsertest.cc
+++ b/chrome/browser/autofill/autofill_browsertest.cc
@@ -260,7 +260,7 @@
autofill_test::SetProfileInfo(
&profile, "Milton", "C.", "Waddams",
"[email protected]", "Initech", "4120 Freidrich Lane",
- "Basement", "Austin", "Texas", "78744", "United States", "5125551234");
+ "Basement", "Austin", "Texas", "78744", "US", "5125551234");
WindowedPersonalDataManagerObserver observer(browser());
personal_data_manager()->AddProfile(profile);
diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
index fed11bb..e6215d1 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -257,7 +257,7 @@
ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
// These services are deleted in DestroySyncableService().
AutocompleteSyncableService::CreateForWebDataService(this);
- AutofillProfileSyncableService::CreateForWebDataService(this);
+ AutofillProfileSyncableService::CreateForWebDataService(this, "en-US");
autocomplete_syncable_service_ =
AutocompleteSyncableService::FromWebDataService(this);
@@ -633,7 +633,7 @@
AutofillProfile p;
p.set_guid(autofill.profile().guid());
AutofillProfileSyncableService::OverwriteProfileWithServerData(
- autofill.profile(), &p);
+ autofill.profile(), &p, "en-US");
profiles->push_back(p);
}
child_id = child_node.GetSuccessorId();
@@ -661,7 +661,7 @@
AutofillProfile p;
p.set_guid(autofill.guid());
AutofillProfileSyncableService::OverwriteProfileWithServerData(
- autofill, &p);
+ autofill, &p, "en-US");
profiles->push_back(p);
child_id = child_node.GetSuccessorId();
}
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index d2a5d8e..a2b66da 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -153,8 +153,16 @@
FormGroup* form_group) {
for (DetailOutputMap::const_iterator iter = detail_outputs.begin();
iter != detail_outputs.end(); ++iter) {
- if (!iter->second.empty())
- form_group->SetRawInfo(iter->first->type, iter->second);
+ if (!iter->second.empty()) {
+ if (iter->first->type == ADDRESS_HOME_COUNTRY ||
+ iter->first->type == ADDRESS_BILLING_COUNTRY) {
+ form_group->SetInfo(iter->first->type,
+ iter->second,
+ g_browser_process->GetApplicationLocale());
+ } else {
+ form_group->SetRawInfo(iter->first->type, iter->second);
+ }
+ }
}
}
@@ -174,6 +182,11 @@
if (it->first->type == CREDIT_CARD_VERIFICATION_CODE) {
if (cvc)
cvc->assign(trimmed);
+ } else if (it->first->type == ADDRESS_HOME_COUNTRY ||
+ it->first->type == ADDRESS_BILLING_COUNTRY) {
+ profile->SetInfo(it->first->type,
+ trimmed,
+ g_browser_process->GetApplicationLocale());
} else {
// Copy the credit card name to |profile| in addition to |card| as
// wallet::Instrument requires a recipient name for its billing address.
diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc
index bcc33eb..96c30b0 100644
--- a/chrome/browser/ui/webui/options/autofill_options_handler.cc
+++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc
@@ -443,7 +443,7 @@
address.SetString("city", profile->GetRawInfo(ADDRESS_HOME_CITY));
address.SetString("state", profile->GetRawInfo(ADDRESS_HOME_STATE));
address.SetString("postalCode", profile->GetRawInfo(ADDRESS_HOME_ZIP));
- address.SetString("country", profile->CountryCode());
+ address.SetString("country", profile->GetRawInfo(ADDRESS_HOME_COUNTRY));
GetValueList(*profile, PHONE_HOME_WHOLE_NUMBER, &list);
address.Set("phone", list.release());
GetValueList(*profile, EMAIL_ADDRESS, &list);
@@ -524,7 +524,7 @@
profile.SetRawInfo(ADDRESS_HOME_ZIP, value);
if (args->GetString(8, &country_code))
- profile.SetCountryCode(country_code);
+ profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16(country_code));
if (args->GetList(9, &list_value))
SetValueList(list_value, PHONE_HOME_WHOLE_NUMBER, &profile);
diff --git a/chrome/browser/webdata/autofill_profile_syncable_service.cc b/chrome/browser/webdata/autofill_profile_syncable_service.cc
index 7b68c32..348a8490 100644
--- a/chrome/browser/webdata/autofill_profile_syncable_service.cc
+++ b/chrome/browser/webdata/autofill_profile_syncable_service.cc
@@ -8,6 +8,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
+#include "components/autofill/browser/autofill_country.h"
#include "components/autofill/browser/autofill_profile.h"
#include "components/autofill/browser/form_group.h"
#include "components/webdata/autofill/autofill_table.h"
@@ -41,8 +42,10 @@
const char kAutofillProfileTag[] = "google_chrome_autofill_profiles";
AutofillProfileSyncableService::AutofillProfileSyncableService(
- AutofillWebDataService* web_data_service)
+ AutofillWebDataService* web_data_service,
+ const std::string& app_locale)
: web_data_service_(web_data_service),
+ app_locale_(app_locale),
ALLOW_THIS_IN_INITIALIZER_LIST(scoped_observer_(this)) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
DCHECK(web_data_service_);
@@ -56,9 +59,11 @@
// static
void AutofillProfileSyncableService::CreateForWebDataService(
- AutofillWebDataService* web_data_service) {
+ AutofillWebDataService* web_data_service,
+ const std::string& app_locale) {
web_data_service->GetDBUserData()->SetUserData(
- UserDataKey(), new AutofillProfileSyncableService(web_data_service));
+ UserDataKey(),
+ new AutofillProfileSyncableService(web_data_service, app_locale));
}
// static
@@ -299,7 +304,8 @@
// static
bool AutofillProfileSyncableService::OverwriteProfileWithServerData(
const sync_pb::AutofillProfileSpecifics& specifics,
- AutofillProfile* profile) {
+ AutofillProfile* profile,
+ const std::string& app_locale) {
bool diff = false;
diff = UpdateMultivaluedField(NAME_FIRST,
specifics.name_first(), profile) || diff;
@@ -315,8 +321,11 @@
specifics.address_home_city(), profile) || diff;
diff = UpdateField(ADDRESS_HOME_STATE,
specifics.address_home_state(), profile) || diff;
- diff = UpdateField(ADDRESS_HOME_COUNTRY,
- specifics.address_home_country(), profile) || diff;
+ string16 country_name_or_code =
+ ASCIIToUTF16(specifics.address_home_country());
+ std::string country_code = AutofillCountry::GetCountryCode(
+ country_name_or_code, app_locale);
+ diff = UpdateField(ADDRESS_HOME_COUNTRY, country_code, profile) || diff;
diff = UpdateField(ADDRESS_HOME_ZIP,
specifics.address_home_zip(), profile) || diff;
diff = UpdateMultivaluedField(EMAIL_ADDRESS,
@@ -415,13 +424,16 @@
autofill_specifics.guid());
if (it != profile_map->end()) {
// Some profile that already present is synced.
- if (OverwriteProfileWithServerData(autofill_specifics, it->second))
+ if (OverwriteProfileWithServerData(
+ autofill_specifics, it->second, app_locale_)) {
bundle->profiles_to_update.push_back(it->second);
+ }
} else {
// New profile synced.
AutofillProfile* new_profile(
new AutofillProfile(autofill_specifics.guid()));
- OverwriteProfileWithServerData(autofill_specifics, new_profile);
+ OverwriteProfileWithServerData(
+ autofill_specifics, new_profile, app_locale_);
// Check if profile appears under a different guid.
for (GUIDToProfileMap::iterator i = profile_map->begin();
diff --git a/chrome/browser/webdata/autofill_profile_syncable_service.h b/chrome/browser/webdata/autofill_profile_syncable_service.h
index 0c8abff..997b6b7 100644
--- a/chrome/browser/webdata/autofill_profile_syncable_service.h
+++ b/chrome/browser/webdata/autofill_profile_syncable_service.h
@@ -47,7 +47,8 @@
// Creates a new AutofillProfileSyncableService and hangs it off of
// |web_data_service|, which takes ownership.
- static void CreateForWebDataService(AutofillWebDataService* web_data_service);
+ static void CreateForWebDataService(AutofillWebDataService* web_data_service,
+ const std::string& app_locale);
// Retrieves the AutofillProfileSyncableService stored on |web_data_service|.
static AutofillProfileSyncableService* FromWebDataService(
AutofillWebDataService* web_data_service);
@@ -73,7 +74,8 @@
protected:
explicit AutofillProfileSyncableService(
- AutofillWebDataService* web_data_service);
+ AutofillWebDataService* web_data_service,
+ const std::string& app_locale);
// A convenience wrapper of a bunch of state we pass around while
// associating models, and send to the WebDatabase for persistence.
@@ -115,7 +117,8 @@
// |specifics|.
static bool OverwriteProfileWithServerData(
const sync_pb::AutofillProfileSpecifics& specifics,
- AutofillProfile* profile);
+ AutofillProfile* profile,
+ const std::string& app_locale);
// Writes |profile| data into supplied |profile_specifics|.
static void WriteAutofillProfile(const AutofillProfile& profile,
@@ -168,6 +171,7 @@
}
AutofillWebDataService* web_data_service_; // WEAK
+ std::string app_locale_;
ScopedObserver<AutofillWebDataService, AutofillProfileSyncableService>
scoped_observer_;
diff --git a/chrome/browser/webdata/web_data_service_factory.cc b/chrome/browser/webdata/web_data_service_factory.cc
index 44e3375..e72329f 100644
--- a/chrome/browser/webdata/web_data_service_factory.cc
+++ b/chrome/browser/webdata/web_data_service_factory.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/files/file_path.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
#include "chrome/browser/ui/profile_error_dialog.h"
#include "chrome/browser/webdata/autocomplete_syncable_service.h"
@@ -36,13 +37,15 @@
}
void InitSyncableServicesOnDBThread(
- scoped_refptr<AutofillWebDataService> autofill_web_data) {
+ scoped_refptr<AutofillWebDataService> autofill_web_data,
+ const std::string& app_locale) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
// Currently only Autocomplete and Autofill profiles use the new Sync API, but
// all the database data should migrate to this API over time.
AutocompleteSyncableService::CreateForWebDataService(autofill_web_data);
- AutofillProfileSyncableService::CreateForWebDataService(autofill_web_data);
+ AutofillProfileSyncableService::CreateForWebDataService(
+ autofill_web_data, app_locale);
}
} // namespace
@@ -87,9 +90,11 @@
web_database_, base::Bind(&ProfileErrorCallback));
web_data_->Init();
- BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
- base::Bind(&InitSyncableServicesOnDBThread,
- autofill_web_data_));
+ BrowserThread::PostTask(
+ BrowserThread::DB, FROM_HERE,
+ base::Bind(&InitSyncableServicesOnDBThread,
+ autofill_web_data_,
+ g_browser_process->GetApplicationLocale()));
}
WebDataServiceWrapper::~WebDataServiceWrapper() {
diff --git a/chrome/browser/webdata/web_database_migration_unittest.cc b/chrome/browser/webdata/web_database_migration_unittest.cc
index 92c1707..8a715a5 100644
--- a/chrome/browser/webdata/web_database_migration_unittest.cc
+++ b/chrome/browser/webdata/web_database_migration_unittest.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/webdata/web_apps_table.h"
#include "chrome/browser/webdata/web_intents_table.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "components/autofill/browser/autofill_country.h"
#include "components/autofill/browser/autofill_profile.h"
#include "components/autofill/browser/autofill_type.h"
#include "components/autofill/browser/credit_card.h"
@@ -57,7 +58,7 @@
profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(9));
profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(10));
profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(11));
- profile->SetRawInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(12));
+ profile->SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(12), "en-US");
profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(13));
*date_modified = s.ColumnInt64(15);
profile->set_guid(s.ColumnString(16));
@@ -77,7 +78,7 @@
profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(4));
profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(5));
profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(6));
- profile->SetRawInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(7));
+ profile->SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(7), "en-US");
*date_modified = s.ColumnInt64(8);
}
diff --git a/chrome/test/data/autofill/merge/output/case.out b/chrome/test/data/autofill/merge/output/case.out
index 14f0af5e..5b28e19 100644
--- a/chrome/test/data/autofill/merge/output/case.out
+++ b/chrome/test/data/autofill/merge/output/case.out
@@ -9,5 +9,5 @@
ADDRESS_HOME_CITY: Mountain View
ADDRESS_HOME_STATE: CA
ADDRESS_HOME_ZIP: 94043
-ADDRESS_HOME_COUNTRY: United States
+ADDRESS_HOME_COUNTRY: US
PHONE_HOME_WHOLE_NUMBER: (650) 555-8888
diff --git a/chrome/test/data/autofill/merge/output/identical.out b/chrome/test/data/autofill/merge/output/identical.out
index 14f0af5e..5b28e19 100644
--- a/chrome/test/data/autofill/merge/output/identical.out
+++ b/chrome/test/data/autofill/merge/output/identical.out
@@ -9,5 +9,5 @@
ADDRESS_HOME_CITY: Mountain View
ADDRESS_HOME_STATE: CA
ADDRESS_HOME_ZIP: 94043
-ADDRESS_HOME_COUNTRY: United States
+ADDRESS_HOME_COUNTRY: US
PHONE_HOME_WHOLE_NUMBER: (650) 555-8888
diff --git a/chrome/test/data/autofill/merge/output/multimerge.out b/chrome/test/data/autofill/merge/output/multimerge.out
index 266b8de..ecefee1 100644
--- a/chrome/test/data/autofill/merge/output/multimerge.out
+++ b/chrome/test/data/autofill/merge/output/multimerge.out
@@ -13,6 +13,6 @@
ADDRESS_HOME_CITY: San Francisco
ADDRESS_HOME_STATE: CA
ADDRESS_HOME_ZIP: 94102
-ADDRESS_HOME_COUNTRY: United States
+ADDRESS_HOME_COUNTRY: US
PHONE_HOME_WHOLE_NUMBER: +1 650-210-1111
PHONE_HOME_WHOLE_NUMBER: (650) 234-3333
diff --git a/chrome/test/data/autofill/merge/output/primarycase.out b/chrome/test/data/autofill/merge/output/primarycase.out
index 266b8de..ecefee1 100644
--- a/chrome/test/data/autofill/merge/output/primarycase.out
+++ b/chrome/test/data/autofill/merge/output/primarycase.out
@@ -13,6 +13,6 @@
ADDRESS_HOME_CITY: San Francisco
ADDRESS_HOME_STATE: CA
ADDRESS_HOME_ZIP: 94102
-ADDRESS_HOME_COUNTRY: United States
+ADDRESS_HOME_COUNTRY: US
PHONE_HOME_WHOLE_NUMBER: +1 650-210-1111
PHONE_HOME_WHOLE_NUMBER: (650) 234-3333
diff --git a/chrome/test/data/autofill/merge/output/singlemerge.out b/chrome/test/data/autofill/merge/output/singlemerge.out
index d9d68ae..76e4e25 100644
--- a/chrome/test/data/autofill/merge/output/singlemerge.out
+++ b/chrome/test/data/autofill/merge/output/singlemerge.out
@@ -9,5 +9,5 @@
ADDRESS_HOME_CITY: San Francisco
ADDRESS_HOME_STATE: NY
ADDRESS_HOME_ZIP: 11001
-ADDRESS_HOME_COUNTRY: Canada
+ADDRESS_HOME_COUNTRY: CA
PHONE_HOME_WHOLE_NUMBER: +1 650-210-1111
diff --git a/chrome/test/data/autofill/merge/output/validation.out b/chrome/test/data/autofill/merge/output/validation.out
index d4527a9..8f2df39 100644
--- a/chrome/test/data/autofill/merge/output/validation.out
+++ b/chrome/test/data/autofill/merge/output/validation.out
@@ -9,5 +9,5 @@
ADDRESS_HOME_CITY: Mountain View
ADDRESS_HOME_STATE: CA
ADDRESS_HOME_ZIP: 94043
-ADDRESS_HOME_COUNTRY: United States
+ADDRESS_HOME_COUNTRY: US
PHONE_HOME_WHOLE_NUMBER: (650) 555-8888
diff --git a/components/autofill/browser/address.cc b/components/autofill/browser/address.cc
index 7e430f8..6dda502 100644
--- a/components/autofill/browser/address.cc
+++ b/components/autofill/browser/address.cc
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "components/autofill/browser/autofill_country.h"
#include "components/autofill/browser/autofill_type.h"
#include "components/autofill/browser/field_types.h"
@@ -66,32 +67,50 @@
return zip_code_;
if (type == ADDRESS_HOME_COUNTRY)
- return Country();
+ return country_code_;
return string16();
}
void Address::SetRawInfo(AutofillFieldType type, const string16& value) {
type = AutofillType::GetEquivalentFieldType(type);
- if (type == ADDRESS_HOME_LINE1)
+ if (type == ADDRESS_HOME_LINE1) {
line1_ = value;
- else if (type == ADDRESS_HOME_LINE2)
+ } else if (type == ADDRESS_HOME_LINE2) {
line2_ = value;
- else if (type == ADDRESS_HOME_CITY)
+ } else if (type == ADDRESS_HOME_CITY) {
city_ = value;
- else if (type == ADDRESS_HOME_STATE)
+ } else if (type == ADDRESS_HOME_STATE) {
state_ = value;
- else if (type == ADDRESS_HOME_COUNTRY)
- // TODO(isherman): When setting the country, it should only be possible to
- // call this with a country code, which means we should be able to drop the
- // call to GetCountryCode() below.
- country_code_ =
- AutofillCountry::GetCountryCode(value,
- AutofillCountry::ApplicationLocale());
- else if (type == ADDRESS_HOME_ZIP)
+ } else if (type == ADDRESS_HOME_COUNTRY) {
+ DCHECK(value.empty() || value.length() == 2u);
+ country_code_ = value;
+ } else if (type == ADDRESS_HOME_ZIP) {
zip_code_ = value;
- else
+ } else {
NOTREACHED();
+ }
+}
+
+string16 Address::GetInfo(AutofillFieldType type,
+ const std::string& app_locale) const {
+ if (type == ADDRESS_HOME_COUNTRY && !country_code_.empty())
+ return AutofillCountry(UTF16ToASCII(country_code_), app_locale).name();
+
+ return GetRawInfo(type);
+}
+
+bool Address::SetInfo(AutofillFieldType type,
+ const string16& value,
+ const std::string& app_locale) {
+ if (type == ADDRESS_HOME_COUNTRY && !value.empty()) {
+ country_code_ =
+ ASCIIToUTF16(AutofillCountry::GetCountryCode(value, app_locale));
+ return !country_code_.empty();
+ }
+
+ SetRawInfo(type, value);
+ return true;
}
void Address::GetMatchingTypes(const string16& text,
@@ -101,14 +120,6 @@
// Check to see if the |text| canonicalized as a country name is a match.
std::string country_code = AutofillCountry::GetCountryCode(text, app_locale);
- if (!country_code.empty() && country_code_ == country_code)
+ if (!country_code.empty() && country_code_ == ASCIIToUTF16(country_code))
matching_types->insert(ADDRESS_HOME_COUNTRY);
}
-
-string16 Address::Country() const {
- if (country_code().empty())
- return string16();
-
- std::string app_locale = AutofillCountry::ApplicationLocale();
- return AutofillCountry(country_code(), app_locale).name();
-}
diff --git a/components/autofill/browser/address.h b/components/autofill/browser/address.h
index 5a3127d..40896ab0 100644
--- a/components/autofill/browser/address.h
+++ b/components/autofill/browser/address.h
@@ -26,28 +26,25 @@
virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE;
virtual void SetRawInfo(AutofillFieldType type,
const string16& value) OVERRIDE;
+ virtual string16 GetInfo(AutofillFieldType type,
+ const std::string& app_locale) const OVERRIDE;
+ virtual bool SetInfo(AutofillFieldType type,
+ const string16& value,
+ const std::string& app_locale) OVERRIDE;
virtual void GetMatchingTypes(const string16& text,
const std::string& app_locale,
FieldTypeSet* matching_types) const OVERRIDE;
- const std::string& country_code() const { return country_code_; }
- void set_country_code(const std::string& country_code) {
- country_code_ = country_code;
- }
-
private:
// FormGroup:
virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE;
- // Returns the localized country name corresponding to |country_code_|.
- string16 Country() const;
-
// The address.
string16 line1_;
string16 line2_;
string16 city_;
string16 state_;
- std::string country_code_;
+ string16 country_code_;
string16 zip_code_;
};
diff --git a/components/autofill/browser/address_unittest.cc b/components/autofill/browser/address_unittest.cc
index 0925146..d4446ce7f 100644
--- a/components/autofill/browser/address_unittest.cc
+++ b/components/autofill/browser/address_unittest.cc
@@ -27,32 +27,20 @@
DISALLOW_COPY_AND_ASSIGN(AddressTest);
};
-// Test that the getters and setters for country code are working.
-TEST_F(AddressTest, CountryCode) {
- Address address;
- EXPECT_EQ(std::string(), address.country_code());
-
- address.set_country_code("US");
- EXPECT_EQ("US", address.country_code());
-
- address.set_country_code("CA");
- EXPECT_EQ("CA", address.country_code());
-}
-
// Test that country codes are properly decoded as country names.
TEST_F(AddressTest, GetCountry) {
Address address;
- EXPECT_EQ(std::string(), address.country_code());
+ EXPECT_EQ(string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY));
// Make sure that nothing breaks when the country code is missing.
string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ(string16(), country);
- address.set_country_code("US");
+ address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"), "en-US");
country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ(ASCIIToUTF16("United States"), country);
- address.set_country_code("CA");
+ address.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("CA"));
country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ(ASCIIToUTF16("Canada"), country);
}
@@ -60,43 +48,43 @@
// Test that we properly detect country codes appropriate for each country.
TEST_F(AddressTest, SetCountry) {
Address address;
- EXPECT_EQ(std::string(), address.country_code());
+ EXPECT_EQ(string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY));
// Test basic conversion.
address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States"), "en-US");
string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
- EXPECT_EQ("US", address.country_code());
+ EXPECT_EQ(ASCIIToUTF16("US"), address.GetRawInfo(ADDRESS_HOME_COUNTRY));
EXPECT_EQ(ASCIIToUTF16("United States"), country);
// Test basic synonym detection.
address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("USA"), "en-US");
country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
- EXPECT_EQ("US", address.country_code());
+ EXPECT_EQ(ASCIIToUTF16("US"), address.GetRawInfo(ADDRESS_HOME_COUNTRY));
EXPECT_EQ(ASCIIToUTF16("United States"), country);
// Test case-insensitivity.
address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("canADA"), "en-US");
country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
- EXPECT_EQ("CA", address.country_code());
+ EXPECT_EQ(ASCIIToUTF16("CA"), address.GetRawInfo(ADDRESS_HOME_COUNTRY));
EXPECT_EQ(ASCIIToUTF16("Canada"), country);
// Test country code detection.
address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("JP"), "en-US");
country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
- EXPECT_EQ("JP", address.country_code());
+ EXPECT_EQ(ASCIIToUTF16("JP"), address.GetRawInfo(ADDRESS_HOME_COUNTRY));
EXPECT_EQ(ASCIIToUTF16("Japan"), country);
// Test that we ignore unknown countries.
address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Unknown"), "en-US");
country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
- EXPECT_EQ(std::string(), address.country_code());
+ EXPECT_EQ(string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY));
EXPECT_EQ(string16(), country);
}
// Test that we properly match typed values to stored country data.
TEST_F(AddressTest, IsCountry) {
Address address;
- address.set_country_code("US");
+ address.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"));
const char* const kValidMatches[] = {
"United States",
@@ -126,8 +114,8 @@
}
// Make sure that garbage values don't match when the country code is empty.
- address.set_country_code("");
- EXPECT_EQ(std::string(), address.country_code());
+ address.SetRawInfo(ADDRESS_HOME_COUNTRY, string16());
+ EXPECT_EQ(string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY));
FieldTypeSet matching_types;
address.GetMatchingTypes(ASCIIToUTF16("Garbage"), "US", &matching_types);
EXPECT_EQ(0U, matching_types.size());
diff --git a/components/autofill/browser/android/auxiliary_profile_unittest_android.cc b/components/autofill/browser/android/auxiliary_profile_unittest_android.cc
index 2bf26b9e..ca96eb2b 100644
--- a/components/autofill/browser/android/auxiliary_profile_unittest_android.cc
+++ b/components/autofill/browser/android/auxiliary_profile_unittest_android.cc
@@ -16,7 +16,7 @@
AuxiliaryProfileAndroidTest() {}
AutofillProfile* GetAndLoadProfile() {
- autofill::AuxiliaryProfilesAndroid impl(profile_loader_);
+ autofill::AuxiliaryProfilesAndroid impl(profile_loader_, "en-US");
profile_ = impl.LoadContactsProfile();
return profile_.get();
}
diff --git a/components/autofill/browser/android/auxiliary_profiles_android.cc b/components/autofill/browser/android/auxiliary_profiles_android.cc
index 52c5fe3..4ee7682f 100644
--- a/components/autofill/browser/android/auxiliary_profiles_android.cc
+++ b/components/autofill/browser/android/auxiliary_profiles_android.cc
@@ -49,8 +49,10 @@
namespace autofill {
AuxiliaryProfilesAndroid::AuxiliaryProfilesAndroid(
- const AuxiliaryProfileLoaderAndroid& profileLoader)
- : profile_loader_(profileLoader) {}
+ const AuxiliaryProfileLoaderAndroid& profileLoader,
+ const std::string& app_locale)
+ : profile_loader_(profileLoader),
+ app_locale_(app_locale) {}
AuxiliaryProfilesAndroid::~AuxiliaryProfilesAndroid() {
}
@@ -87,7 +89,7 @@
profile->SetRawInfo(ADDRESS_HOME_CITY, city);
profile->SetRawInfo(ADDRESS_HOME_STATE, region);
profile->SetRawInfo(ADDRESS_HOME_ZIP, postal_code);
- profile->SetRawInfo(ADDRESS_HOME_COUNTRY, country);
+ profile->SetInfo(ADDRESS_HOME_COUNTRY, country, app_locale_);
}
void AuxiliaryProfilesAndroid::LoadName(AutofillProfile* profile) {
diff --git a/components/autofill/browser/android/auxiliary_profiles_android.h b/components/autofill/browser/android/auxiliary_profiles_android.h
index ec0ee9c..c624af1 100644
--- a/components/autofill/browser/android/auxiliary_profiles_android.h
+++ b/components/autofill/browser/android/auxiliary_profiles_android.h
@@ -25,8 +25,9 @@
public:
// Takes in an AuxiliaryProfileLoader object which provides contact
// information methods.
- explicit AuxiliaryProfilesAndroid(
- const autofill::AuxiliaryProfileLoaderAndroid& profile_loader);
+ AuxiliaryProfilesAndroid(
+ const autofill::AuxiliaryProfileLoaderAndroid& profile_loader,
+ const std::string& app_locale);
~AuxiliaryProfilesAndroid();
// Returns autofill profile constructed from profile_loader_.
@@ -43,6 +44,7 @@
void LoadPhoneNumbers(AutofillProfile* profile);
const AuxiliaryProfileLoaderAndroid& profile_loader_;
+ std::string app_locale_;
DISALLOW_COPY_AND_ASSIGN(AuxiliaryProfilesAndroid);
};
diff --git a/components/autofill/browser/android/personal_data_manager_android.cc b/components/autofill/browser/android/personal_data_manager_android.cc
index 0d47e5d..8d7a6d1 100644
--- a/components/autofill/browser/android/personal_data_manager_android.cc
+++ b/components/autofill/browser/android/personal_data_manager_android.cc
@@ -8,6 +8,10 @@
#include "components/autofill/browser/android/auxiliary_profiles_android.h"
#include "components/autofill/browser/personal_data_manager.h"
+// TODO(jam) remove once https://codereview.chromium.org/13488009/ lands, since
+// that brings localle to PDM.
+#include "content/public/browser/content_browser_client.h"
+
void PersonalDataManager::LoadAuxiliaryProfiles() {
auxiliary_profiles_.clear();
autofill::AuxiliaryProfileLoaderAndroid profile_loader;
@@ -15,7 +19,11 @@
base::android::AttachCurrentThread(),
base::android::GetApplicationContext());
if (profile_loader.GetHasPermissions()) {
- autofill::AuxiliaryProfilesAndroid impl(profile_loader);
+ autofill::AuxiliaryProfilesAndroid impl(
+ profile_loader,
+ // TODO(jam) remove once https://codereview.chromium.org/13488009/
+ // lands, since that brings localle to PDM.
+ content::GetContentClient()->browser()->GetApplicationLocale());
auxiliary_profiles_.push_back(impl.LoadContactsProfile().release());
}
}
diff --git a/components/autofill/browser/autocheckout_manager.cc b/components/autofill/browser/autocheckout_manager.cc
index 0c8181b..46fcb95 100644
--- a/components/autofill/browser/autocheckout_manager.cc
+++ b/components/autofill/browser/autocheckout_manager.cc
@@ -20,6 +20,9 @@
#include "components/autofill/common/form_data.h"
#include "components/autofill/common/form_field_data.h"
#include "components/autofill/common/web_element_descriptor.h"
+// TODO(jam) remove once https://codereview.chromium.org/13488009/ lands, since
+// that brings localle to AutofillManager.
+#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/ssl_status.h"
@@ -287,6 +290,15 @@
if (AutofillType(type).group() == AutofillType::CREDIT_CARD) {
credit_card_->SetRawInfo(result->field(i)->type(),
result->field(i)->value);
+ } else if (result->field(i)->type() == ADDRESS_HOME_COUNTRY ||
+ result->field(i)->type() == ADDRESS_BILLING_COUNTRY) {
+ profile_->SetInfo(result->field(i)->type(),
+ result->field(i)->value,
+ // TODO(jam) remove once
+ // https://codereview.chromium.org/13488009/
+ // lands, since that brings localle to AutofillManager.
+ content::GetContentClient()->browser()->
+ GetApplicationLocale());
} else {
profile_->SetRawInfo(result->field(i)->type(), result->field(i)->value);
}
diff --git a/components/autofill/browser/autofill_profile.cc b/components/autofill/browser/autofill_profile.cc
index f793fa4..b1a0da0 100644
--- a/components/autofill/browser/autofill_profile.cc
+++ b/components/autofill/browser/autofill_profile.cc
@@ -400,14 +400,6 @@
return label_;
}
-const std::string AutofillProfile::CountryCode() const {
- return address_.country_code();
-}
-
-void AutofillProfile::SetCountryCode(const std::string& country_code) {
- address_.set_country_code(country_code);
-}
-
bool AutofillProfile::IsEmpty() const {
FieldTypeSet types;
GetNonEmptyTypes(AutofillCountry::ApplicationLocale(), &types);
@@ -483,9 +475,10 @@
// Phone numbers should be canonicalized prior to being compared.
if (*iter != PHONE_HOME_WHOLE_NUMBER) {
continue;
- } else if (!autofill_i18n::PhoneNumbersMatch(GetRawInfo(*iter),
- profile.GetRawInfo(*iter),
- CountryCode())) {
+ } else if (!autofill_i18n::PhoneNumbersMatch(
+ GetRawInfo(*iter),
+ profile.GetRawInfo(*iter),
+ UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)))) {
return false;
}
} else if (StringToLowerASCII(GetRawInfo(*iter)) !=
@@ -622,7 +615,7 @@
bool AutofillProfile::FillCountrySelectControl(FormFieldData* field_data)
const {
- std::string country_code = CountryCode();
+ std::string country_code = UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY));
std::string app_locale = AutofillCountry::ApplicationLocale();
DCHECK_EQ(field_data->option_values.size(),
@@ -666,8 +659,9 @@
DCHECK(existing_phones);
// Phones allow "fuzzy" matching, so "1-800-FLOWERS", "18003569377",
// "(800)356-9377" and "356-9377" are considered the same.
- if (std::find_if(existing_phones->begin(), existing_phones->end(),
- FindByPhone(phone, CountryCode())) ==
+ if (std::find_if(
+ existing_phones->begin(), existing_phones->end(),
+ FindByPhone(phone, UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)))) ==
existing_phones->end()) {
existing_phones->push_back(phone);
}
diff --git a/components/autofill/browser/autofill_profile.h b/components/autofill/browser/autofill_profile.h
index 8dbf63a5..d5a0561 100644
--- a/components/autofill/browser/autofill_profile.h
+++ b/components/autofill/browser/autofill_profile.h
@@ -82,10 +82,6 @@
const std::string guid() const { return guid_; }
void set_guid(const std::string& guid) { guid_ = guid; }
- // Accessors for the stored address's country code.
- const std::string CountryCode() const;
- void SetCountryCode(const std::string& country_code);
-
// Returns true if there are no values (field types) set.
bool IsEmpty() const;
diff --git a/components/autofill/browser/autofill_profile_unittest.cc b/components/autofill/browser/autofill_profile_unittest.cc
index bccb6e6..c93547f 100644
--- a/components/autofill/browser/autofill_profile_unittest.cc
+++ b/components/autofill/browser/autofill_profile_unittest.cc
@@ -589,14 +589,6 @@
EXPECT_LT(0, b.Compare(a));
}
-TEST(AutofillProfileTest, CountryCode) {
- AutofillProfile profile;
- EXPECT_EQ(std::string(), profile.CountryCode());
-
- profile.SetCountryCode("US");
- EXPECT_EQ("US", profile.CountryCode());
-}
-
TEST(AutofillProfileTest, MultiValueNames) {
AutofillProfile p;
const string16 kJohnDoe(ASCIIToUTF16("John Doe"));
@@ -758,7 +750,7 @@
field.option_contents = options;
AutofillProfile profile;
- profile.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Canada"), "en-US");
+ profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("CA"));
profile.FillSelectControl(ADDRESS_HOME_COUNTRY, &field);
EXPECT_EQ(ASCIIToUTF16("CA"), field.value);
}
diff --git a/components/autofill/browser/personal_data_manager.cc b/components/autofill/browser/personal_data_manager.cc
index 4c3ff50..fd6456b 100644
--- a/components/autofill/browser/personal_data_manager.cc
+++ b/components/autofill/browser/personal_data_manager.cc
@@ -87,7 +87,8 @@
if (profile.GetRawInfo(ADDRESS_HOME_LINE1).empty())
return false;
std::string app_locale = AutofillCountry::ApplicationLocale();
- std::string country_code = profile.CountryCode();
+ std::string country_code =
+ UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY));
if (country_code.empty())
country_code = AutofillCountry::CountryCodeForLocale(app_locale);
@@ -278,7 +279,8 @@
// Reject profiles with invalid country information.
if (field_type == ADDRESS_HOME_COUNTRY &&
- !value.empty() && imported_profile->CountryCode().empty()) {
+ !value.empty() &&
+ imported_profile->GetRawInfo(ADDRESS_HOME_COUNTRY).empty()) {
imported_profile.reset();
break;
}
@@ -667,15 +669,15 @@
// Reject profiles with invalid US state information.
string16 state = profile.GetRawInfo(ADDRESS_HOME_STATE);
- if (profile.CountryCode() == "US" &&
+ if (profile.GetRawInfo(ADDRESS_HOME_COUNTRY) == ASCIIToUTF16("US") &&
!state.empty() && !FormGroup::IsValidState(state)) {
return false;
}
// Reject profiles with invalid US zip information.
string16 zip = profile.GetRawInfo(ADDRESS_HOME_ZIP);
- if (profile.CountryCode() == "US" && !zip.empty() &&
- !autofill::IsValidZip(zip))
+ if (profile.GetRawInfo(ADDRESS_HOME_COUNTRY) == ASCIIToUTF16("US") &&
+ !zip.empty() && !autofill::IsValidZip(zip))
return false;
return true;
diff --git a/components/autofill/browser/phone_number.cc b/components/autofill/browser/phone_number.cc
index 0a785e5..703e63e 100644
--- a/components/autofill/browser/phone_number.cc
+++ b/components/autofill/browser/phone_number.cc
@@ -34,9 +34,9 @@
// code corresponding to the |app_locale|.
std::string GetRegion(const AutofillProfile& profile,
const std::string& app_locale) {
- std::string country_code = profile.CountryCode();
+ string16 country_code = profile.GetRawInfo(ADDRESS_HOME_COUNTRY);
if (!country_code.empty())
- return country_code;
+ return UTF16ToASCII(country_code);
return AutofillCountry::CountryCodeForLocale(app_locale);
}
diff --git a/components/autofill/browser/phone_number_unittest.cc b/components/autofill/browser/phone_number_unittest.cc
index 6772e75..2fabb0b 100644
--- a/components/autofill/browser/phone_number_unittest.cc
+++ b/components/autofill/browser/phone_number_unittest.cc
@@ -12,7 +12,7 @@
TEST(PhoneNumberTest, Matcher) {
AutofillProfile profile;
- profile.SetCountryCode("US");
+ profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"));
// Set phone number so country_code == 1, city_code = 650, number = 2345678.
string16 phone(ASCIIToUTF16("1 [650] 234-5678"));
PhoneNumber phone_number(&profile);
@@ -83,7 +83,7 @@
// Verify that PhoneNumber::SetInfo() correctly formats the incoming number.
TEST(PhoneNumberTest, SetInfo) {
AutofillProfile profile;
- profile.SetCountryCode("US");
+ profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"));
PhoneNumber phone(&profile);
EXPECT_EQ(string16(), phone.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
@@ -116,7 +116,7 @@
// Test that cached phone numbers are correctly invalidated and updated.
TEST(PhoneNumberTest, UpdateCachedPhoneNumber) {
AutofillProfile profile;
- profile.SetCountryCode("US");
+ profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"));
PhoneNumber phone(&profile);
phone.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("6502345678"));
@@ -133,14 +133,14 @@
// Now try parsing using the correct locale. Note that the profile's country
// code should override the app locale, which is still set to "US".
- profile.SetCountryCode("GB");
+ profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("GB"));
phone.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("07023456789"));
EXPECT_EQ(ASCIIToUTF16("70"), phone.GetInfo(PHONE_HOME_CITY_CODE, "US"));
}
TEST(PhoneNumberTest, PhoneCombineHelper) {
AutofillProfile profile;
- profile.SetCountryCode("US");
+ profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"));
PhoneNumber::PhoneCombineHelper number1;
EXPECT_FALSE(number1.SetInfo(ADDRESS_BILLING_CITY,
diff --git a/components/autofill/browser/wallet/wallet_address.cc b/components/autofill/browser/wallet/wallet_address.cc
index 8f7a0b84..9e5f5d4da 100644
--- a/components/autofill/browser/wallet/wallet_address.cc
+++ b/components/autofill/browser/wallet/wallet_address.cc
@@ -82,7 +82,8 @@
Address::Address() {}
Address::Address(const AutofillProfile& profile)
- : country_name_code_(profile.CountryCode()),
+ : country_name_code_(
+ UTF16ToASCII(profile.GetRawInfo(ADDRESS_HOME_COUNTRY))),
recipient_name_(profile.GetRawInfo(NAME_FULL)),
address_line_1_(profile.GetRawInfo(ADDRESS_HOME_LINE1)),
address_line_2_(profile.GetRawInfo(ADDRESS_HOME_LINE2)),
diff --git a/components/webdata/autofill/autofill_table.cc b/components/webdata/autofill/autofill_table.cc
index 8892e82..8218d143 100644
--- a/components/webdata/autofill/autofill_table.cc
+++ b/components/webdata/autofill/autofill_table.cc
@@ -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.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ text = profile.GetInfo(ADDRESS_HOME_COUNTRY, app_locale);
s->BindString16(7, LimitDataSize(text));
- std::string country_code = profile.CountryCode();
- s->BindString(8, country_code);
+ text = profile.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ 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);