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

Unified Diff: chrome/browser/ui/views/autofill_profiles_view_win.cc

Issue 6673079: Reduce boxing and unboxing of AutofillFieldType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile on Windows. 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/views/autofill_profiles_view_win.cc
diff --git a/chrome/browser/ui/views/autofill_profiles_view_win.cc b/chrome/browser/ui/views/autofill_profiles_view_win.cc
index d3a9bfee939e25b9bc992999b966a4f1f200b8ee..03e01924b11adc314048e189f9f7558a37cc10f2 100644
--- a/chrome/browser/ui/views/autofill_profiles_view_win.cc
+++ b/chrome/browser/ui/views/autofill_profiles_view_win.cc
@@ -851,8 +851,8 @@ void AutofillProfilesView::EditableSetViewContents::ContentsChanged(
if (text_fields_[address_fields_[field].text_field] == sender) {
if (!UpdateContentsPhoneViews(address_fields_[field].text_field,
sender, new_contents)) {
- temporary_info_.address.SetInfo(
- AutofillType(address_fields_[field].type), new_contents);
+ temporary_info_.address.SetInfo(address_fields_[field].type,
+ new_contents);
}
UpdateButtons();
return;
@@ -864,8 +864,8 @@ void AutofillProfilesView::EditableSetViewContents::ContentsChanged(
if (text_fields_[credit_card_fields_[field].text_field] == sender) {
UpdateContentsPhoneViews(address_fields_[field].text_field,
sender, new_contents);
- temporary_info_.credit_card.SetInfo(
- AutofillType(credit_card_fields_[field].type), new_contents);
+ temporary_info_.credit_card.SetInfo(credit_card_fields_[field].type,
+ new_contents);
UpdateButtons();
return;
}
@@ -894,7 +894,7 @@ void AutofillProfilesView::EditableSetViewContents::ItemChanged(
NOTREACHED();
} else {
temporary_info_.credit_card.SetInfo(
- AutofillType(CREDIT_CARD_EXP_MONTH),
+ CREDIT_CARD_EXP_MONTH,
UTF16ToWideHack(combo_box_model_month_->GetItemAt(new_index)));
}
} else if (combo_box == combo_box_year_) {
@@ -902,7 +902,7 @@ void AutofillProfilesView::EditableSetViewContents::ItemChanged(
NOTREACHED();
} else {
temporary_info_.credit_card.SetInfo(
- AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR),
+ CREDIT_CARD_EXP_4_DIGIT_YEAR,
UTF16ToWideHack(combo_box_model_year_->GetItemAt(new_index)));
}
} else {
@@ -922,8 +922,7 @@ void AutofillProfilesView::EditableSetViewContents::InitAddressFields(
new views::Textfield(views::Textfield::STYLE_DEFAULT);
text_fields_[address_fields_[field].text_field]->SetController(this);
text_fields_[address_fields_[field].text_field]->SetText(
- temporary_info_.address.GetFieldText(
- AutofillType(address_fields_[field].type)));
+ temporary_info_.address.GetFieldText(address_fields_[field].type));
}
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
@@ -1037,12 +1036,12 @@ void AutofillProfilesView::EditableSetViewContents::InitCreditCardFields(
string16 field_text;
if (credit_card_fields_[field].text_field == TEXT_CC_NUMBER) {
field_text = temporary_info_.credit_card.GetFieldText(
- AutofillType(credit_card_fields_[field].type));
+ credit_card_fields_[field].type);
if (!field_text.empty())
field_text = temporary_info_.credit_card.ObfuscatedNumber();
} else {
field_text = temporary_info_.credit_card.GetFieldText(
- AutofillType(credit_card_fields_[field].type));
+ credit_card_fields_[field].type);
}
text_fields_[credit_card_fields_[field].text_field]->SetText(field_text);
}
@@ -1071,15 +1070,14 @@ void AutofillProfilesView::EditableSetViewContents::InitCreditCardFields(
combo_box_month_ = new views::Combobox(combo_box_model_month_.get());
combo_box_month_->set_listener(this);
string16 field_text;
- field_text = temporary_info_.credit_card.GetFieldText(
- AutofillType(CREDIT_CARD_EXP_MONTH));
+ field_text = temporary_info_.credit_card.GetFieldText(CREDIT_CARD_EXP_MONTH);
combo_box_month_->SetSelectedItem(
combo_box_model_month_->GetIndex(field_text));
combo_box_year_ = new views::Combobox(combo_box_model_year_.get());
combo_box_year_->set_listener(this);
field_text = temporary_info_.credit_card.GetFieldText(
- AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR));
+ CREDIT_CARD_EXP_4_DIGIT_YEAR);
combo_box_year_->SetSelectedItem(combo_box_model_year_->GetIndex(field_text));
layout->StartRow(0, double_column_ccexpiration_);
@@ -1194,14 +1192,17 @@ bool AutofillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews(
string16 number, city, country;
PhoneNumber::ParsePhoneNumber(new_contents, &number, &city, &country);
temporary_info_.address.SetInfo(
- AutofillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_COUNTRY_CODE :
- PHONE_FAX_COUNTRY_CODE), country);
+ (field == TEXT_PHONE_PHONE ? PHONE_HOME_COUNTRY_CODE :
dhollowa 2011/03/16 17:07:11 nit: Should be able to pull some of these ternarie
Ilya Sherman 2011/03/17 03:42:29 Just one of them
+ PHONE_FAX_COUNTRY_CODE),
+ country);
temporary_info_.address.SetInfo(
- AutofillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_CITY_CODE :
- PHONE_FAX_CITY_CODE), city);
+ (field == TEXT_PHONE_PHONE ? PHONE_HOME_CITY_CODE :
+ PHONE_FAX_CITY_CODE),
+ city);
temporary_info_.address.SetInfo(
- AutofillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_NUMBER :
- PHONE_FAX_NUMBER), number);
+ (field == TEXT_PHONE_PHONE ? PHONE_HOME_NUMBER :
+ PHONE_FAX_NUMBER),
+ number);
return true;
}
}

Powered by Google App Engine
This is Rietveld 408576698