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

Unified Diff: chrome/browser/ui/webui/options/autofill_options_handler.cc

Issue 6673079: Reduce boxing and unboxing of AutofillFieldType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 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: chrome/browser/ui/webui/options/autofill_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc
index e02eb25178520b65df62ff8b0a42905f454fa4d6..d5962ede1fa73502fdb0928d47d64a327cf72e1e 100644
--- a/chrome/browser/ui/webui/options/autofill_options_handler.cc
+++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc
@@ -266,30 +266,17 @@ void AutoFillOptionsHandler::LoadAddressEditor(const ListValue* args) {
DictionaryValue address;
address.SetString("guid", profile->guid());
- address.SetString("fullName",
- profile->GetFieldText(AutofillType(NAME_FULL)));
- address.SetString("companyName",
- profile->GetFieldText(AutofillType(COMPANY_NAME)));
- address.SetString("addrLine1",
- profile->GetFieldText(AutofillType(ADDRESS_HOME_LINE1)));
- address.SetString("addrLine2",
- profile->GetFieldText(AutofillType(ADDRESS_HOME_LINE2)));
- address.SetString("city",
- profile->GetFieldText(AutofillType(ADDRESS_HOME_CITY)));
- address.SetString("state",
- profile->GetFieldText(AutofillType(ADDRESS_HOME_STATE)));
- address.SetString("postalCode",
- profile->GetFieldText(AutofillType(ADDRESS_HOME_ZIP)));
- address.SetString("country",
- profile->CountryCode());
- address.SetString(
- "phone",
- profile->GetFieldText(AutofillType(PHONE_HOME_WHOLE_NUMBER)));
- address.SetString(
- "fax",
- profile->GetFieldText(AutofillType(PHONE_FAX_WHOLE_NUMBER)));
- address.SetString("email",
- profile->GetFieldText(AutofillType(EMAIL_ADDRESS)));
+ address.SetString("fullName", profile->GetFieldText(NAME_FULL));
+ address.SetString("companyName", profile->GetFieldText(COMPANY_NAME));
+ address.SetString("addrLine1", profile->GetFieldText(ADDRESS_HOME_LINE1));
+ address.SetString("addrLine2", profile->GetFieldText(ADDRESS_HOME_LINE2));
+ address.SetString("city", profile->GetFieldText(ADDRESS_HOME_CITY));
+ address.SetString("state", profile->GetFieldText(ADDRESS_HOME_STATE));
+ address.SetString("postalCode", profile->GetFieldText(ADDRESS_HOME_ZIP));
+ address.SetString("country", profile->CountryCode());
+ address.SetString("phone", profile->GetFieldText(PHONE_HOME_WHOLE_NUMBER));
+ address.SetString("fax", profile->GetFieldText(PHONE_FAX_WHOLE_NUMBER));
+ address.SetString("email", profile->GetFieldText(EMAIL_ADDRESS));
web_ui_->CallJavascriptFunction("AutoFillOptions.editAddress", address);
}
@@ -315,18 +302,15 @@ void AutoFillOptionsHandler::LoadCreditCardEditor(const ListValue* args) {
DictionaryValue credit_card_data;
credit_card_data.SetString("guid", credit_card->guid());
- credit_card_data.SetString(
- "nameOnCard",
- credit_card->GetFieldText(AutofillType(CREDIT_CARD_NAME)));
- credit_card_data.SetString(
- "creditCardNumber",
- credit_card->GetFieldText(AutofillType(CREDIT_CARD_NUMBER)));
- credit_card_data.SetString(
- "expirationMonth",
- credit_card->GetFieldText(AutofillType(CREDIT_CARD_EXP_MONTH)));
+ credit_card_data.SetString("nameOnCard",
+ credit_card->GetFieldText(CREDIT_CARD_NAME));
+ credit_card_data.SetString("creditCardNumber",
+ credit_card->GetFieldText(CREDIT_CARD_NUMBER));
+ credit_card_data.SetString("expirationMonth",
+ credit_card->GetFieldText(CREDIT_CARD_EXP_MONTH));
credit_card_data.SetString(
"expirationYear",
- credit_card->GetFieldText(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)));
+ credit_card->GetFieldText(CREDIT_CARD_EXP_4_DIGIT_YEAR));
web_ui_->CallJavascriptFunction("AutoFillOptions.editCreditCard",
credit_card_data);
@@ -347,27 +331,27 @@ void AutoFillOptionsHandler::SetAddress(const ListValue* args) {
std::string country_code;
string16 value;
if (args->GetString(1, &value))
- profile.SetInfo(AutofillType(NAME_FULL), value);
+ profile.SetInfo(NAME_FULL, value);
if (args->GetString(2, &value))
- profile.SetInfo(AutofillType(COMPANY_NAME), value);
+ profile.SetInfo(COMPANY_NAME, value);
if (args->GetString(3, &value))
- profile.SetInfo(AutofillType(ADDRESS_HOME_LINE1), value);
+ profile.SetInfo(ADDRESS_HOME_LINE1, value);
if (args->GetString(4, &value))
- profile.SetInfo(AutofillType(ADDRESS_HOME_LINE2), value);
+ profile.SetInfo(ADDRESS_HOME_LINE2, value);
if (args->GetString(5, &value))
- profile.SetInfo(AutofillType(ADDRESS_HOME_CITY), value);
+ profile.SetInfo(ADDRESS_HOME_CITY, value);
if (args->GetString(6, &value))
- profile.SetInfo(AutofillType(ADDRESS_HOME_STATE), value);
+ profile.SetInfo(ADDRESS_HOME_STATE, value);
if (args->GetString(7, &value))
- profile.SetInfo(AutofillType(ADDRESS_HOME_ZIP), value);
+ profile.SetInfo(ADDRESS_HOME_ZIP, value);
if (args->GetString(8, &country_code))
profile.SetCountryCode(country_code);
if (args->GetString(9, &value))
- profile.SetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER), value);
+ profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, value);
if (args->GetString(10, &value))
- profile.SetInfo(AutofillType(PHONE_FAX_WHOLE_NUMBER), value);
+ profile.SetInfo(PHONE_FAX_WHOLE_NUMBER, value);
if (args->GetString(11, &value))
- profile.SetInfo(AutofillType(EMAIL_ADDRESS), value);
+ profile.SetInfo(EMAIL_ADDRESS, value);
if (!guid::IsValidGUID(profile.guid())) {
profile.set_guid(guid::GenerateGUID());
@@ -391,13 +375,13 @@ void AutoFillOptionsHandler::SetCreditCard(const ListValue* args) {
string16 value;
if (args->GetString(1, &value))
- credit_card.SetInfo(AutofillType(CREDIT_CARD_NAME), value);
+ credit_card.SetInfo(CREDIT_CARD_NAME, value);
if (args->GetString(2, &value))
- credit_card.SetInfo(AutofillType(CREDIT_CARD_NUMBER), value);
+ credit_card.SetInfo(CREDIT_CARD_NUMBER, value);
if (args->GetString(3, &value))
- credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), value);
+ credit_card.SetInfo(CREDIT_CARD_EXP_MONTH, value);
if (args->GetString(4, &value))
- credit_card.SetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), value);
+ credit_card.SetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, value);
if (!guid::IsValidGUID(credit_card.guid())) {
credit_card.set_guid(guid::GenerateGUID());

Powered by Google App Engine
This is Rietveld 408576698