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

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

Issue 7545003: Add ignore matching text for name field. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 5 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
« no previous file with comments | « no previous file | chrome/test/data/autofill/heuristics/input/20_register_alaskaair.com.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/credit_card_field.cc
diff --git a/chrome/browser/autofill/credit_card_field.cc b/chrome/browser/autofill/credit_card_field.cc
index 8d504f4bf667f52ddc7c0492ef6f48519ef6ca32..908c2424123e6a909482c568fb8e84e338d794f4 100644
--- a/chrome/browser/autofill/credit_card_field.cc
+++ b/chrome/browser/autofill/credit_card_field.cc
@@ -157,11 +157,21 @@ FormField* CreditCardField::Parse(AutofillScanner* scanner,
break;
}
+ bool has_expiration_year_month = credit_card_field->expiration_month_ &&
+ (credit_card_field->expiration_year_ ||
+ LowerCaseEqualsASCII(
+ credit_card_field->expiration_month_->form_control_type, "month"));
+
// Some pages have a billing address field after the cardholder name field.
// For that case, allow only just the cardholder name field. The remaining
// CC fields will be picked up in a following CreditCardField.
- if (credit_card_field->cardholder_)
+ // But credit card number is strongly tied with expiration year/month, so
+ // we should eliminate the case when we found only card number without
+ // expiration year/month.
+ if (credit_card_field->cardholder_ &&
+ !(credit_card_field->number_ && !has_expiration_year_month)) {
return credit_card_field.release();
+ }
// On some pages, the user selects a card type using radio buttons
// (e.g. test page Apple Store Billing.html). We can't handle that yet,
@@ -171,11 +181,7 @@ FormField* CreditCardField::Parse(AutofillScanner* scanner,
// the number and name were parsed in a separate part of the form. So if
// the cvc and date were found independently they are returned.
if ((credit_card_field->number_ || credit_card_field->verification_) &&
- credit_card_field->expiration_month_ &&
- (credit_card_field->expiration_year_ ||
- (LowerCaseEqualsASCII(
- credit_card_field->expiration_month_->form_control_type,
- "month")))) {
+ has_expiration_year_month) {
return credit_card_field.release();
}
« no previous file with comments | « no previous file | chrome/test/data/autofill/heuristics/input/20_register_alaskaair.com.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698