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

Unified Diff: chrome/browser/ui/autofill/data_model_wrapper.cc

Issue 22040002: [Autofill] Add a separate enumeration for HTML field type hints. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add docs Created 7 years, 4 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/autofill/data_model_wrapper.cc
diff --git a/chrome/browser/ui/autofill/data_model_wrapper.cc b/chrome/browser/ui/autofill/data_model_wrapper.cc
index 21760e1b1be427539257710ae4ef60e480028917..1e1f04763678dc6657b8cf46d3c68e61db70ccc6 100644
--- a/chrome/browser/ui/autofill/data_model_wrapper.cc
+++ b/chrome/browser/ui/autofill/data_model_wrapper.cc
@@ -123,18 +123,19 @@ void AutofillProfileWrapper::FillInputs(DetailInputs* inputs) {
}
void AutofillProfileWrapper::FillFormField(AutofillField* field) const {
- AutofillType field_type = field->Type();
+ HtmlFieldType html_type = field->html_type();
Evan Stade 2013/08/05 18:47:24 nit: declare as late as possible, not at top of fu
Ilya Sherman 2013/08/06 05:05:39 Hmm, I'm not sure where you'd prefer to see this d
Evan Stade 2013/08/06 18:39:59 I see, I missed that. Can you give the variable a
Ilya Sherman 2013/08/06 23:04:56 Done.
+ HtmlFieldMode html_mode = field->html_mode();
- if (field_type.native_type() == CREDIT_CARD_NAME) {
+ if (field->Type().GetEquivalentNativeType() == CREDIT_CARD_NAME) {
// Requests for the user's credit card are filled from the billing address,
// but the AutofillProfile class doesn't know how to fill credit card
// fields. So, temporarily set the type to the corresponding profile type.
- field->set_heuristic_type(NAME_FULL);
+ field->SetHtmlType(HTML_TYPE_NAME, html_mode);
}
AutofillDataModelWrapper::FillFormField(field);
- field->set_heuristic_type(field_type.native_type());
+ field->SetHtmlType(html_type, html_mode);
}
// AutofillCreditCardWrapper
@@ -146,7 +147,7 @@ AutofillCreditCardWrapper::AutofillCreditCardWrapper(const CreditCard* card)
AutofillCreditCardWrapper::~AutofillCreditCardWrapper() {}
string16 AutofillCreditCardWrapper::GetInfo(const AutofillType& type) const {
- if (type.native_type() == CREDIT_CARD_EXP_MONTH)
+ if (type.GetEquivalentNativeType() == CREDIT_CARD_EXP_MONTH)
return MonthComboboxModel::FormatMonth(card_->expiration_month());
return AutofillDataModelWrapper::GetInfo(type);
@@ -193,7 +194,7 @@ WalletInstrumentWrapper::WalletInstrumentWrapper(
WalletInstrumentWrapper::~WalletInstrumentWrapper() {}
string16 WalletInstrumentWrapper::GetInfo(const AutofillType& type) const {
- if (type.native_type() == CREDIT_CARD_EXP_MONTH)
+ if (type.GetEquivalentNativeType() == CREDIT_CARD_EXP_MONTH)
return MonthComboboxModel::FormatMonth(instrument_->expiration_month());
return instrument_->GetInfo(type, g_browser_process->GetApplicationLocale());
@@ -228,7 +229,7 @@ FullWalletBillingWrapper::FullWalletBillingWrapper(
FullWalletBillingWrapper::~FullWalletBillingWrapper() {}
string16 FullWalletBillingWrapper::GetInfo(const AutofillType& type) const {
- if (type.native_type() == CREDIT_CARD_EXP_MONTH)
+ if (type.GetEquivalentNativeType() == CREDIT_CARD_EXP_MONTH)
return MonthComboboxModel::FormatMonth(full_wallet_->expiration_month());
if (type.group() == CREDIT_CARD)
@@ -267,9 +268,10 @@ DetailOutputWrapper::DetailOutputWrapper(const DetailOutputMap& outputs)
DetailOutputWrapper::~DetailOutputWrapper() {}
base::string16 DetailOutputWrapper::GetInfo(const AutofillType& type) const {
+ NativeFieldType native_type = type.GetEquivalentNativeType();
for (DetailOutputMap::const_iterator it = outputs_.begin();
it != outputs_.end(); ++it) {
- if (type.native_type() == it->first->type)
+ if (native_type == AutofillType(it->first->type).GetEquivalentNativeType())
return it->second;
}
return base::string16();

Powered by Google App Engine
This is Rietveld 408576698