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

Unified Diff: components/autofill/content/browser/autocheckout_manager.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: components/autofill/content/browser/autocheckout_manager.cc
diff --git a/components/autofill/content/browser/autocheckout_manager.cc b/components/autofill/content/browser/autocheckout_manager.cc
index 4d888c98ec6f486dcd1cf04fff3cb8e51d2fff17..161913bd5fe6acabf9c36ff7a8bec53282df8cac 100644
--- a/components/autofill/content/browser/autocheckout_manager.cc
+++ b/components/autofill/content/browser/autocheckout_manager.cc
@@ -351,25 +351,27 @@ void AutocheckoutManager::ReturnAutocheckoutData(
for (size_t i = 0; i < result->field_count(); ++i) {
const AutofillType& type = result->field(i)->Type();
const base::string16& value = result->field(i)->value;
- if (type.native_type() == CREDIT_CARD_VERIFICATION_CODE) {
+ NativeFieldType native_type = type.GetEquivalentNativeType();
+ if (native_type == CREDIT_CARD_VERIFICATION_CODE) {
cvv_ = result->field(i)->value;
continue;
}
FieldTypeGroup group = type.group();
if (group == CREDIT_CARD) {
- credit_card_->SetRawInfo(type.native_type(), value);
+ credit_card_->SetRawInfo(native_type, value);
// TODO(dgwallinga): Find a way of cleanly deprecating CREDIT_CARD_NAME.
// code.google.com/p/chromium/issues/detail?id=263498
- if (type.native_type() == CREDIT_CARD_NAME)
+ if (native_type == CREDIT_CARD_NAME)
billing_address_->SetRawInfo(NAME_BILLING_FULL, value);
- } else if (type.native_type() == ADDRESS_HOME_COUNTRY) {
- profile_->SetInfo(type, value, autofill_manager_->app_locale());
- } else if (type.native_type() == ADDRESS_BILLING_COUNTRY) {
- billing_address_->SetInfo(type, value, autofill_manager_->app_locale());
+ } else if (native_type == ADDRESS_HOME_COUNTRY) {
+ if (IsBillingGroup(group))
+ billing_address_->SetInfo(type, value, autofill_manager_->app_locale());
+ else
+ profile_->SetInfo(type, value, autofill_manager_->app_locale());
} else if (IsBillingGroup(group)) {
- billing_address_->SetRawInfo(type.native_type(), value);
+ billing_address_->SetRawInfo(native_type, value);
} else {
- profile_->SetRawInfo(type.native_type(), value);
+ profile_->SetRawInfo(native_type, value);
}
}
@@ -449,7 +451,8 @@ void AutocheckoutManager::SetValue(const AutofillField& field,
const AutofillType& type = field.Type();
- if (type.native_type() == FIELD_WITH_DEFAULT_VALUE) {
+ NativeFieldType native_type = type.GetEquivalentNativeType();
+ if (native_type == FIELD_WITH_DEFAULT_VALUE) {
// For a form with radio buttons, like:
// <form>
// <input type="radio" name="sex" value="male">Male<br>
@@ -483,7 +486,7 @@ void AutocheckoutManager::SetValue(const AutofillField& field,
}
// Handle verification code directly.
- if (type.native_type() == CREDIT_CARD_VERIFICATION_CODE) {
+ if (native_type == CREDIT_CARD_VERIFICATION_CODE) {
field_to_fill->value = cvv_;
return;
}

Powered by Google App Engine
This is Rietveld 408576698