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

Unified Diff: chrome/browser/autofill/autofill_ie_toolbar_import_win.cc

Issue 6877130: These changes *are* for review :) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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: chrome/browser/autofill/autofill_ie_toolbar_import_win.cc
===================================================================
--- chrome/browser/autofill/autofill_ie_toolbar_import_win.cc (revision 84722)
+++ chrome/browser/autofill/autofill_ie_toolbar_import_win.cc (working copy)
@@ -19,6 +19,7 @@
#include "chrome/browser/autofill/field_types.h"
#include "chrome/browser/autofill/form_group.h"
#include "chrome/browser/autofill/personal_data_manager.h"
+#include "chrome/browser/autofill/phone_number_i18n.h"
#include "chrome/browser/sync/util/data_encryption.h"
using base::win::RegKey;
@@ -131,6 +132,10 @@
bool has_non_empty_fields = false;
+ // Phones need to be rebuild.
dhollowa 2011/05/13 18:55:35 nit: s/rebuild/rebuilt/
GeorgeY 2011/05/18 17:41:45 Done.
+ string16 home, home_city, home_country;
+ string16 fax, fax_city, fax_country;
+
for (uint32 value_index = 0; value_index < key->ValueCount(); ++value_index) {
std::wstring value_name;
if (key->ReadName(value_index, &value_name) != ERROR_SUCCESS)
@@ -144,9 +149,49 @@
if (it->second == CREDIT_CARD_NUMBER) {
field_value = DecryptCCNumber(field_value);
}
- profile->SetInfo(it->second, field_value);
+ switch (it->second) {
dhollowa 2011/05/13 18:55:35 This is getting pretty hard to read with |SetInfo|
GeorgeY 2011/05/18 17:41:45 Simplified it
+ case PHONE_HOME_CITY_CODE:
+ home_city = field_value;
+ break;
+ case PHONE_HOME_COUNTRY_CODE:
+ home_country = field_value;
+ break;
+ case PHONE_HOME_CITY_AND_NUMBER:
+ case PHONE_HOME_NUMBER:
+ home = field_value;
+ break;
+ case PHONE_FAX_CITY_CODE:
+ fax_city = field_value;
+ break;
+ case PHONE_FAX_COUNTRY_CODE:
+ fax_country = field_value;
+ break;
+ case PHONE_FAX_NUMBER:
+ case PHONE_FAX_CITY_AND_NUMBER:
+ fax = field_value;
+ break;
+ default:
+ profile->SetInfo(it->second, field_value);
+ break;
+ }
}
}
+ string16 constructed_number;
+ if (!home.empty() && autofill_i18n::ConstructPhoneNumber(
+ home_country, home_city, home, std::string("US"),
+ (home_country.empty() ?
+ autofill_i18n::NATIONAL : autofill_i18n::INTERNATIONAL),
+ &constructed_number)) {
+ profile->SetInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number);
+ }
+ if (!fax.empty() && autofill_i18n::ConstructPhoneNumber(
+ fax_country, fax_city, fax, std::string("US"),
+ (fax_country.empty() ?
+ autofill_i18n::NATIONAL : autofill_i18n::INTERNATIONAL),
+ &constructed_number)) {
+ profile->SetInfo(PHONE_FAX_WHOLE_NUMBER, constructed_number);
+ }
+
return has_non_empty_fields;
}
@@ -215,15 +260,6 @@
AutofillProfile profile;
if (ImportSingleProfile(&profile, &key, reg_to_field)) {
// Combine phones into whole phone #.
- string16 phone;
- phone = profile.GetInfo(PHONE_HOME_COUNTRY_CODE);
- phone.append(profile.GetInfo(PHONE_HOME_CITY_CODE));
- phone.append(profile.GetInfo(PHONE_HOME_NUMBER));
- profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, phone);
- phone = profile.GetInfo(PHONE_FAX_COUNTRY_CODE);
- phone.append(profile.GetInfo(PHONE_FAX_CITY_CODE));
- phone.append(profile.GetInfo(PHONE_FAX_NUMBER));
- profile.SetInfo(PHONE_FAX_WHOLE_NUMBER, phone);
profiles->push_back(profile);
}
}

Powered by Google App Engine
This is Rietveld 408576698