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

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

Issue 1859633002: [Autofill] Fix heuristics to detect cc-number on united.com. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 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/138_cc_checkout_united.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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // Note: Some sites use type="tel" or type="number" for numerical inputs. 129 // Note: Some sites use type="tel" or type="number" for numerical inputs.
130 const int kMatchNumAndTel = MATCH_DEFAULT | MATCH_NUMBER | MATCH_TELEPHONE; 130 const int kMatchNumAndTel = MATCH_DEFAULT | MATCH_NUMBER | MATCH_TELEPHONE;
131 if (!credit_card_field->verification_ && 131 if (!credit_card_field->verification_ &&
132 ParseFieldSpecifics(scanner, 132 ParseFieldSpecifics(scanner,
133 base::UTF8ToUTF16(kCardCvcRe), 133 base::UTF8ToUTF16(kCardCvcRe),
134 kMatchNumAndTel | MATCH_PASSWORD, 134 kMatchNumAndTel | MATCH_PASSWORD,
135 &credit_card_field->verification_)) { 135 &credit_card_field->verification_)) {
136 continue; 136 continue;
137 } 137 }
138 138
139 // TODO(crbug.com/591816): Make sure parsing cc-numbers of type password
140 // doesn't have bad side effects.
139 AutofillField* current_number_field; 141 AutofillField* current_number_field;
140 if (ParseFieldSpecifics(scanner, 142 if (ParseFieldSpecifics(scanner, base::UTF8ToUTF16(kCardNumberRe),
141 base::UTF8ToUTF16(kCardNumberRe), 143 kMatchNumAndTel | MATCH_PASSWORD,
142 kMatchNumAndTel,
143 &current_number_field)) { 144 &current_number_field)) {
144 // Avoid autofilling any credit card number field having very low or high 145 // Avoid autofilling any credit card number field having very low or high
145 // |start_index| on the HTML form. 146 // |start_index| on the HTML form.
146 size_t start_index = 0; 147 size_t start_index = 0;
147 if (!credit_card_field->numbers_.empty()) { 148 if (!credit_card_field->numbers_.empty()) {
148 size_t last_number_field_size = 149 size_t last_number_field_size =
149 credit_card_field->numbers_.back()->credit_card_number_offset() + 150 credit_card_field->numbers_.back()->credit_card_number_offset() +
150 credit_card_field->numbers_.back()->max_length; 151 credit_card_field->numbers_.back()->max_length;
151 152
152 // Distinguish between 153 // Distinguish between
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 456
456 ServerFieldType CreditCardField::GetExpirationYearType() const { 457 ServerFieldType CreditCardField::GetExpirationYearType() const {
457 return (expiration_date_ 458 return (expiration_date_
458 ? exp_year_type_ 459 ? exp_year_type_
459 : ((expiration_year_ && expiration_year_->max_length == 2) 460 : ((expiration_year_ && expiration_year_->max_length == 2)
460 ? CREDIT_CARD_EXP_2_DIGIT_YEAR 461 ? CREDIT_CARD_EXP_2_DIGIT_YEAR
461 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); 462 : CREDIT_CARD_EXP_4_DIGIT_YEAR));
462 } 463 }
463 464
464 } // namespace autofill 465 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/test/data/autofill/heuristics/output/138_cc_checkout_united.com.out ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698