[email protected] | 1a04c12 | 2013-01-19 03:44:47 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | e4b2fa3 | 2013-03-09 22:56:56 | [diff] [blame] | 5 | #ifndef COMPONENTS_AUTOFILL_BROWSER_VALIDATION_H_ |
6 | #define COMPONENTS_AUTOFILL_BROWSER_VALIDATION_H_ | ||||
[email protected] | 1a04c12 | 2013-01-19 03:44:47 | [diff] [blame] | 7 | |
8 | #include "base/string16.h" | ||||
9 | |||||
[email protected] | dad621b | 2013-03-19 01:57:11 | [diff] [blame] | 10 | namespace base { |
11 | class Time; | ||||
12 | } // namespace base; | ||||
13 | |||||
[email protected] | 1a04c12 | 2013-01-19 03:44:47 | [diff] [blame] | 14 | namespace autofill { |
15 | |||||
[email protected] | dad621b | 2013-03-19 01:57:11 | [diff] [blame] | 16 | // Returns true if |year| and |month| describe a date later than |now|. |
17 | // |year| must have 4 digits. | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 18 | bool IsValidCreditCardExpirationDate(const base::string16& year, |
19 | const base::string16& month, | ||||
[email protected] | dad621b | 2013-03-19 01:57:11 | [diff] [blame] | 20 | const base::Time& now); |
21 | |||||
[email protected] | 1a04c12 | 2013-01-19 03:44:47 | [diff] [blame] | 22 | // Returns true if |text| looks like a valid credit card number. |
23 | // Uses the Luhn formula to validate the number. | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 24 | bool IsValidCreditCardNumber(const base::string16& text); |
[email protected] | 1a04c12 | 2013-01-19 03:44:47 | [diff] [blame] | 25 | |
[email protected] | 852c1e1f | 2013-02-12 05:06:30 | [diff] [blame] | 26 | // Returns true if |text| looks like a valid credit card security code. |
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 27 | bool IsValidCreditCardSecurityCode(const base::string16& text); |
[email protected] | 852c1e1f | 2013-02-12 05:06:30 | [diff] [blame] | 28 | |
[email protected] | e570ec1d | 2013-03-20 01:41:46 | [diff] [blame] | 29 | // Returns true if |code| looks like a valid credit card security code |
30 | // for the type of credit card designated by |number|. | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 31 | bool IsValidCreditCardSecurityCode(const base::string16& code, |
32 | const base::string16& number); | ||||
[email protected] | e570ec1d | 2013-03-20 01:41:46 | [diff] [blame] | 33 | |
[email protected] | e2e37f5 | 2013-02-22 23:16:16 | [diff] [blame] | 34 | // Returns true if |text| looks like a valid e-mail address. |
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 35 | bool IsValidEmailAddress(const base::string16& text); |
[email protected] | e2e37f5 | 2013-02-22 23:16:16 | [diff] [blame] | 36 | |
[email protected] | b4c9c41e | 2013-02-26 01:51:47 | [diff] [blame] | 37 | // Returns true if |text| looks like a valid zip code. |
38 | // Valid for US zip codes only. | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 39 | bool IsValidZip(const base::string16& text); |
[email protected] | b4c9c41e | 2013-02-26 01:51:47 | [diff] [blame] | 40 | |
[email protected] | 1a04c12 | 2013-01-19 03:44:47 | [diff] [blame] | 41 | } // namespace autofill |
42 | |||||
[email protected] | e4b2fa3 | 2013-03-09 22:56:56 | [diff] [blame] | 43 | #endif // COMPONENTS_AUTOFILL_BROWSER_VALIDATION_H_ |