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/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "components/autofill/core/browser/autofill_field.h" | 16 #include "components/autofill/core/browser/autofill_field.h" |
17 #include "components/autofill/core/browser/autofill_regex_constants.h" | 17 #include "components/autofill/core/browser/autofill_regex_constants.h" |
| 18 #include "components/autofill/core/browser/autofill_regexes.h" |
18 #include "components/autofill/core/browser/autofill_scanner.h" | 19 #include "components/autofill/core/browser/autofill_scanner.h" |
19 #include "components/autofill/core/browser/field_types.h" | 20 #include "components/autofill/core/browser/field_types.h" |
20 #include "components/autofill/core/common/autofill_regexes.h" | |
21 #include "grit/components_strings.h" | 21 #include "grit/components_strings.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 | 23 |
24 namespace autofill { | 24 namespace autofill { |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Credit card numbers are at most 19 digits in length. | 28 // Credit card numbers are at most 19 digits in length. |
29 // [Ref: http://en.wikipedia.org/wiki/Bank_card_number] | 29 // [Ref: http://en.wikipedia.org/wiki/Bank_card_number] |
30 const size_t kMaxValidCardNumberSize = 19; | 30 const size_t kMaxValidCardNumberSize = 19; |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 451 |
452 ServerFieldType CreditCardField::GetExpirationYearType() const { | 452 ServerFieldType CreditCardField::GetExpirationYearType() const { |
453 return (expiration_date_ | 453 return (expiration_date_ |
454 ? exp_year_type_ | 454 ? exp_year_type_ |
455 : ((expiration_year_ && expiration_year_->max_length == 2) | 455 : ((expiration_year_ && expiration_year_->max_length == 2) |
456 ? CREDIT_CARD_EXP_2_DIGIT_YEAR | 456 ? CREDIT_CARD_EXP_2_DIGIT_YEAR |
457 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); | 457 : CREDIT_CARD_EXP_4_DIGIT_YEAR)); |
458 } | 458 } |
459 | 459 |
460 } // namespace autofill | 460 } // namespace autofill |
OLD | NEW |