| Index: components/autofill/browser/autofill_ie_toolbar_import_win.cc
|
| ===================================================================
|
| --- components/autofill/browser/autofill_ie_toolbar_import_win.cc (revision 192613)
|
| +++ components/autofill/browser/autofill_ie_toolbar_import_win.cc (working copy)
|
| @@ -30,7 +30,8 @@
|
|
|
| // Forward declaration. This function is not in unnamed namespace as it
|
| // is referenced in the unittest.
|
| -bool ImportCurrentUserProfiles(std::vector<AutofillProfile>* profiles,
|
| +bool ImportCurrentUserProfiles(const std::string& app_locale,
|
| + std::vector<AutofillProfile>* profiles,
|
| std::vector<CreditCard>* credit_cards);
|
| namespace {
|
|
|
| @@ -130,6 +131,7 @@
|
| // Returns true if any fields were set, false otherwise.
|
| bool ImportSingleFormGroup(const RegKey& key,
|
| const RegToFieldMap& reg_to_field,
|
| + const std::string& app_locale,
|
| FormGroup* form_group,
|
| PhoneNumber::PhoneCombineHelper* phone) {
|
| if (!key.Valid())
|
| @@ -137,7 +139,6 @@
|
|
|
| bool has_non_empty_fields = false;
|
|
|
| - const std::string app_locale = AutofillCountry::ApplicationLocale();
|
| for (uint32 i = 0; i < key.GetValueCount(); ++i) {
|
| std::wstring value_name;
|
| if (key.GetValueNameAt(i, &value_name) != ERROR_SUCCESS)
|
| @@ -167,16 +168,16 @@
|
| // Imports address data from the given registry |key| into the given |profile|,
|
| // with the help of |reg_to_field|. Returns true if any fields were set, false
|
| // otherwise.
|
| -bool ImportSingleProfile(const RegKey& key,
|
| +bool ImportSingleProfile(const std::string& app_locale,
|
| + const RegKey& key,
|
| const RegToFieldMap& reg_to_field,
|
| AutofillProfile* profile) {
|
| PhoneNumber::PhoneCombineHelper phone;
|
| bool has_non_empty_fields =
|
| - ImportSingleFormGroup(key, reg_to_field, profile, &phone);
|
| + ImportSingleFormGroup(key, reg_to_field, app_locale, profile, &phone);
|
|
|
| // Now re-construct the phones if needed.
|
| string16 constructed_number;
|
| - const std::string app_locale = AutofillCountry::ApplicationLocale();
|
| if (phone.ParseNumber(*profile, app_locale, &constructed_number)) {
|
| has_non_empty_fields = true;
|
| profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number);
|
| @@ -195,7 +196,9 @@
|
| }
|
|
|
| bool ImportProfiles() {
|
| - if (!ImportCurrentUserProfiles(&profiles_, &credit_cards_)) {
|
| + if (!ImportCurrentUserProfiles(personal_data_manager_->app_locale(),
|
| + &profiles_,
|
| + &credit_cards_)) {
|
| delete this;
|
| return false;
|
| }
|
| @@ -232,7 +235,8 @@
|
| // Imports Autofill profiles and credit cards from IE Toolbar if present and not
|
| // password protected. Returns true if data is successfully retrieved. False if
|
| // there is no data, data is password protected or error occurred.
|
| -bool ImportCurrentUserProfiles(std::vector<AutofillProfile>* profiles,
|
| +bool ImportCurrentUserProfiles(const std::string& app_locale,
|
| + std::vector<AutofillProfile>* profiles,
|
| std::vector<CreditCard>* credit_cards) {
|
| DCHECK(profiles);
|
| DCHECK(credit_cards);
|
| @@ -252,7 +256,7 @@
|
| key_name.append(iterator_profiles.Name());
|
| RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ);
|
| AutofillProfile profile;
|
| - if (ImportSingleProfile(key, reg_to_field, &profile)) {
|
| + if (ImportSingleProfile(app_locale, key, reg_to_field, &profile)) {
|
| // Combine phones into whole phone #.
|
| profiles->push_back(profile);
|
| }
|
| @@ -275,7 +279,8 @@
|
| key_name.append(iterator_cc.Name());
|
| RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ);
|
| CreditCard credit_card;
|
| - if (ImportSingleFormGroup(key, reg_to_field, &credit_card, NULL)) {
|
| + if (ImportSingleFormGroup(
|
| + key, reg_to_field, app_locale, &credit_card, NULL)) {
|
| string16 cc_number = credit_card.GetRawInfo(CREDIT_CARD_NUMBER);
|
| if (!cc_number.empty())
|
| credit_cards->push_back(credit_card);
|
|
|