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

Unified Diff: components/autofill/core/browser/credit_card_field.cc

Issue 1048363002: Autofill: Recognize more credit card date fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill_exp
Patch Set: Created 5 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
« no previous file with comments | « no previous file | components/autofill/core/browser/credit_card_field_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/credit_card_field.cc
diff --git a/components/autofill/core/browser/credit_card_field.cc b/components/autofill/core/browser/credit_card_field.cc
index d0b0e28e549ef87aec4462efc2802734a41b21fd..c11545222c31d81680471694329c67fb068719fc 100644
--- a/components/autofill/core/browser/credit_card_field.cc
+++ b/components/autofill/core/browser/credit_card_field.cc
@@ -374,6 +374,10 @@ bool CreditCardField::ParseExpirationDate(AutofillScanner* scanner) {
if (ParseFieldSpecifics(scanner,
base::UTF8ToUTF16(kExpirationDate2DigitYearRe),
kMatchTelAndSelect,
+ &expiration_date_) ||
+ ParseFieldSpecifics(scanner,
+ base::ASCIIToUTF16("^mm\\s*[-/]\\syy$"),
Evan Stade 2015/04/01 23:11:29 can you add comment explaining why this isn't just
Lei Zhang 2015/04/03 02:02:01 Sure.
+ kMatchTelAndSelect,
&expiration_date_)) {
exp_year_type_ = CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR;
expiration_month_ = nullptr;
@@ -393,6 +397,20 @@ bool CreditCardField::ParseExpirationDate(AutofillScanner* scanner) {
return true;
}
+ if (current_field_max_length > 0 &&
+ current_field_max_length < kMinimum4YearCcExpLength) {
+ return false;
+ }
+
+
+ if (ParseFieldSpecifics(scanner,
+ base::ASCIIToUTF16("^mm\\s*[-/]\\syyyy$"),
Evan Stade 2015/04/01 23:11:30 ditto. Why isn't this part of the other regex, and
Lei Zhang 2015/04/03 02:02:01 I reworked the code a little and added more commen
+ kMatchTelAndSelect,
+ &expiration_date_)) {
+ expiration_month_ = nullptr;
+ return true;
+ }
+
return false;
}
« no previous file with comments | « no previous file | components/autofill/core/browser/credit_card_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698