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

Side by Side Diff: components/autofill/core/browser/credit_card_field.cc

Issue 1754793003: [Autofill] Fix heuristics to detect cc-number on united.com. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO Created 4 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/autofill/heuristics/output/27_checkout_cc_keurig.com.out ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/credit_card_field.h" 5 #include "components/autofill/core/browser/credit_card_field.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // Note: Some sites use type="tel" or type="number" for numerical inputs. 139 // Note: Some sites use type="tel" or type="number" for numerical inputs.
140 const int kMatchNumAndTel = MATCH_DEFAULT | MATCH_NUMBER | MATCH_TELEPHONE; 140 const int kMatchNumAndTel = MATCH_DEFAULT | MATCH_NUMBER | MATCH_TELEPHONE;
141 if (!credit_card_field->verification_ && 141 if (!credit_card_field->verification_ &&
142 ParseFieldSpecifics(scanner, 142 ParseFieldSpecifics(scanner,
143 base::UTF8ToUTF16(kCardCvcRe), 143 base::UTF8ToUTF16(kCardCvcRe),
144 kMatchNumAndTel | MATCH_PASSWORD, 144 kMatchNumAndTel | MATCH_PASSWORD,
145 &credit_card_field->verification_)) { 145 &credit_card_field->verification_)) {
146 continue; 146 continue;
147 } 147 }
148 148
149 // TODO(crbug.com/591816): Make sure parsing cc-numbers of type password
150 // doesn't have bad side effects.
149 AutofillField* current_number_field; 151 AutofillField* current_number_field;
150 if (ParseFieldSpecifics(scanner, 152 if (ParseFieldSpecifics(scanner, base::UTF8ToUTF16(kCardNumberRe),
151 base::UTF8ToUTF16(kCardNumberRe), 153 kMatchNumAndTel | MATCH_PASSWORD,
152 kMatchNumAndTel,
153 &current_number_field)) { 154 &current_number_field)) {
154 // Avoid autofilling any credit card number field having very low or high 155 // Avoid autofilling any credit card number field having very low or high
155 // |start_index| on the HTML form. 156 // |start_index| on the HTML form.
156 size_t start_index = 0; 157 size_t start_index = 0;
157 if (!credit_card_field->numbers_.empty()) { 158 if (!credit_card_field->numbers_.empty()) {
158 size_t last_number_field_size = 159 size_t last_number_field_size =
159 credit_card_field->numbers_.back()->credit_card_number_offset() + 160 credit_card_field->numbers_.back()->credit_card_number_offset() +
160 credit_card_field->numbers_.back()->max_length; 161 credit_card_field->numbers_.back()->max_length;
161 162
162 // Distinguish between 163 // Distinguish between
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 476
476 ServerFieldType CreditCardField::GetExpirationYearType() const { 477 ServerFieldType CreditCardField::GetExpirationYearType() const {
477 return (expiration_date_ 478 return (expiration_date_
478 ? exp_year_type_ 479 ? exp_year_type_
479 : ((expiration_year_ && expiration_year_->max_length == 2) 480 : ((expiration_year_ && expiration_year_->max_length == 2)
480 ? CREDIT_CARD_EXP_2_DIGIT_YEAR 481 ? CREDIT_CARD_EXP_2_DIGIT_YEAR
481 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); 482 : CREDIT_CARD_EXP_4_DIGIT_YEAR));
482 } 483 }
483 484
484 } // namespace autofill 485 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/test/data/autofill/heuristics/output/27_checkout_cc_keurig.com.out ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698