| 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 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // We look for a card security code before we look for a credit card number | 69 // We look for a card security code before we look for a credit card number |
| 70 // and match the general term "number". The security code has a plethora of | 70 // and match the general term "number". The security code has a plethora of |
| 71 // names; we've seen "verification #", "verification number", "card | 71 // names; we've seen "verification #", "verification number", "card |
| 72 // identification number", and others listed in the regex pattern used | 72 // identification number", and others listed in the regex pattern used |
| 73 // below. | 73 // below. |
| 74 // Note: Some sites use type="tel" for numerical inputs. | 74 // Note: Some sites use type="tel" for numerical inputs. |
| 75 if (!credit_card_field->verification_ && | 75 if (!credit_card_field->verification_ && |
| 76 ParseFieldSpecifics(scanner, | 76 ParseFieldSpecifics(scanner, |
| 77 base::UTF8ToUTF16(autofill::kCardCvcRe), | 77 base::UTF8ToUTF16(autofill::kCardCvcRe), |
| 78 MATCH_DEFAULT | MATCH_TELEPHONE, | 78 MATCH_DEFAULT | MATCH_TELEPHONE | MATCH_PASSWORD, |
| 79 &credit_card_field->verification_)) { | 79 &credit_card_field->verification_)) { |
| 80 continue; | 80 continue; |
| 81 } | 81 } |
| 82 | 82 |
| 83 AutofillField* current_number_field; | 83 AutofillField* current_number_field; |
| 84 if (ParseFieldSpecifics(scanner, | 84 if (ParseFieldSpecifics(scanner, |
| 85 base::UTF8ToUTF16(autofill::kCardNumberRe), | 85 base::UTF8ToUTF16(autofill::kCardNumberRe), |
| 86 MATCH_DEFAULT | MATCH_TELEPHONE, | 86 MATCH_DEFAULT | MATCH_TELEPHONE, |
| 87 ¤t_number_field)) { | 87 ¤t_number_field)) { |
| 88 // Avoid autofilling any credit card number field having very low or high | 88 // Avoid autofilling any credit card number field having very low or high |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 ServerFieldType CreditCardField::GetExpirationYearType() const { | 247 ServerFieldType CreditCardField::GetExpirationYearType() const { |
| 248 return (expiration_date_ | 248 return (expiration_date_ |
| 249 ? exp_year_type_ | 249 ? exp_year_type_ |
| 250 : ((expiration_year_ && expiration_year_->max_length == 2) | 250 : ((expiration_year_ && expiration_year_->max_length == 2) |
| 251 ? CREDIT_CARD_EXP_2_DIGIT_YEAR | 251 ? CREDIT_CARD_EXP_2_DIGIT_YEAR |
| 252 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); | 252 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace autofill | 255 } // namespace autofill |
| OLD | NEW |