OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_AUTOFILL_VALIDATION_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_VALIDATION_H_ |
6 #define CHROME_BROWSER_AUTOFILL_VALIDATION_H_ | 6 #define CHROME_BROWSER_AUTOFILL_VALIDATION_H_ |
7 | 7 |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 | 9 |
| 10 namespace base { |
| 11 |
| 12 class Time; |
| 13 |
| 14 } // namespace base; |
| 15 |
10 namespace autofill { | 16 namespace autofill { |
11 | 17 |
12 // Returns true if |text| looks like a valid credit card number. | 18 // Returns true if |text| looks like a valid credit card number. |
13 // Uses the Luhn formula to validate the number. | 19 // Uses the Luhn formula to validate the number. |
14 bool IsValidCreditCardNumber(const string16& text); | 20 bool IsValidCreditCardNumber(const string16& text); |
15 | 21 |
| 22 // Returns true if |text| is a valid expiration year. Must have |num_digits| |
| 23 // digits, and must be |now|'s year or later. |
| 24 bool IsValidCreditCardExpirationYear(const string16& text, |
| 25 size_t num_digits, |
| 26 const base::Time& now); |
| 27 |
| 28 // Returns true if |text| is a valid expiration date of the form YYYY-MM, |
| 29 // MM/YYYY. Number of year digits is determined by |num_digits|. Must be |
| 30 // |now|'s month or later. |
| 31 bool IsValidCreditCardExpirationDate(const string16& text, |
| 32 size_t num_digits, |
| 33 const base::Time& now); |
| 34 |
| 35 // Returns true if |text| looks like a valid CSC. |
| 36 bool IsValidCreditCardCSC(const string16& text); |
| 37 |
16 } // namespace autofill | 38 } // namespace autofill |
17 | 39 |
18 #endif // CHROME_BROWSER_AUTOFILL_VALIDATION_H_ | 40 #endif // CHROME_BROWSER_AUTOFILL_VALIDATION_H_ |
OLD | NEW |