Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 AutofillField* current_number_field; | 139 AutofillField* current_number_field; |
| 140 if (ParseFieldSpecifics(scanner, | 140 if (ParseFieldSpecifics(scanner, base::UTF8ToUTF16(kCardNumberRe), |
|
Mathieu
2016/03/02 19:24:04
Let's put a TODO with a crbug to revisit this in t
sebsg
2016/03/03 22:34:01
Done.
| |
| 141 base::UTF8ToUTF16(kCardNumberRe), | 141 kMatchNumAndTel | MATCH_PASSWORD, |
| 142 kMatchNumAndTel, | |
| 143 ¤t_number_field)) { | 142 ¤t_number_field)) { |
| 144 // Avoid autofilling any credit card number field having very low or high | 143 // Avoid autofilling any credit card number field having very low or high |
| 145 // |start_index| on the HTML form. | 144 // |start_index| on the HTML form. |
| 146 size_t start_index = 0; | 145 size_t start_index = 0; |
| 147 if (!credit_card_field->numbers_.empty()) { | 146 if (!credit_card_field->numbers_.empty()) { |
| 148 size_t last_number_field_size = | 147 size_t last_number_field_size = |
| 149 credit_card_field->numbers_.back()->credit_card_number_offset() + | 148 credit_card_field->numbers_.back()->credit_card_number_offset() + |
| 150 credit_card_field->numbers_.back()->max_length; | 149 credit_card_field->numbers_.back()->max_length; |
| 151 | 150 |
| 152 // Distinguish between | 151 // Distinguish between |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 | 454 |
| 456 ServerFieldType CreditCardField::GetExpirationYearType() const { | 455 ServerFieldType CreditCardField::GetExpirationYearType() const { |
| 457 return (expiration_date_ | 456 return (expiration_date_ |
| 458 ? exp_year_type_ | 457 ? exp_year_type_ |
| 459 : ((expiration_year_ && expiration_year_->max_length == 2) | 458 : ((expiration_year_ && expiration_year_->max_length == 2) |
| 460 ? CREDIT_CARD_EXP_2_DIGIT_YEAR | 459 ? CREDIT_CARD_EXP_2_DIGIT_YEAR |
| 461 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); | 460 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); |
| 462 } | 461 } |
| 463 | 462 |
| 464 } // namespace autofill | 463 } // namespace autofill |
| OLD | NEW |