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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ |
7 | 7 |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 | 9 |
10 namespace base { | 10 namespace base { |
11 class Time; | 11 class Time; |
12 } // namespace base | 12 } // namespace base |
13 | 13 |
14 namespace autofill { | 14 namespace autofill { |
15 | 15 |
16 // Returns true if |year| and |month| describe a date later than |now|. | 16 // Returns true if |year| and |month| describe a date later than |now|. |
17 // |year| must have 4 digits. | 17 // |year| must have 4 digits. |
18 bool IsValidCreditCardExpirationDate(const base::string16& year, | |
19 const base::string16& month, | |
20 const base::Time& now); | |
21 bool IsValidCreditCardExpirationDate(int year, | 18 bool IsValidCreditCardExpirationDate(int year, |
22 int month, | 19 int month, |
23 const base::Time& now); | 20 const base::Time& now); |
24 | 21 |
25 // Returns true if |text| looks like a valid credit card number. | 22 // Returns true if |text| looks like a valid credit card number. |
26 // Uses the Luhn formula to validate the number. | 23 // Uses the Luhn formula to validate the number. |
27 bool IsValidCreditCardNumber(const base::string16& text); | 24 bool IsValidCreditCardNumber(const base::string16& text); |
28 | 25 |
29 // Returns true if |text| looks like a valid credit card security code. | 26 // Returns true if |text| looks like a valid credit card security code. |
30 bool IsValidCreditCardSecurityCode(const base::string16& text); | 27 bool IsValidCreditCardSecurityCode(const base::string16& text); |
(...skipping 13 matching lines...) Expand all Loading... |
44 // Returns true if |text| looks like a valid zip code. | 41 // Returns true if |text| looks like a valid zip code. |
45 // Valid for US zip codes only. | 42 // Valid for US zip codes only. |
46 bool IsValidZip(const base::string16& text); | 43 bool IsValidZip(const base::string16& text); |
47 | 44 |
48 // Returns true if |text| looks like an SSN, with or without separators. | 45 // Returns true if |text| looks like an SSN, with or without separators. |
49 bool IsSSN(const base::string16& text); | 46 bool IsSSN(const base::string16& text); |
50 | 47 |
51 } // namespace autofill | 48 } // namespace autofill |
52 | 49 |
53 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ | 50 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ |
OLD | NEW |