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

Unified Diff: components/autofill/browser/android/auxiliary_profiles_android.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: Created 7 years, 9 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/browser/android/auxiliary_profiles_android.cc
===================================================================
--- components/autofill/browser/android/auxiliary_profiles_android.cc (revision 192389)
+++ components/autofill/browser/android/auxiliary_profiles_android.cc (working copy)
@@ -15,6 +15,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "components/autofill/browser/android/auxiliary_profile_loader_android.h"
+#include "components/autofill/browser/autofill_country.h"
#include "components/autofill/browser/autofill_profile.h"
#include "components/autofill/browser/phone_number.h"
@@ -49,8 +50,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() {
}
@@ -78,7 +81,9 @@
string16 city = profile_loader_.GetCity();
string16 postal_code = profile_loader_.GetPostalCode();
string16 region = profile_loader_.GetRegion();
- string16 country = profile_loader_.GetCountry();
+ string16 country_name_or_code = profile_loader_.GetCountry();
+ std::string country_code = AutofillCountry::GetCountryCode(
+ country_name_or_code, app_locale_);
string16 street2 = CollapseAddress(post_office_box, neighborhood);
@@ -87,7 +92,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->SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16(country_code));
Ilya Sherman 2013/04/05 05:18:01 Please call SetInfo with the app_locale rather tha
jam 2013/04/05 06:45:54 Done.
}
void AuxiliaryProfilesAndroid::LoadName(AutofillProfile* profile) {

Powered by Google App Engine
This is Rietveld 408576698