blob: 618dcc139c5f785ca216122ad06447041f59a48b [file] [log] [blame]
[email protected]1a04c122013-01-19 03:44:471// 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]e4b2fa32013-03-09 22:56:565#ifndef COMPONENTS_AUTOFILL_BROWSER_VALIDATION_H_
6#define COMPONENTS_AUTOFILL_BROWSER_VALIDATION_H_
[email protected]1a04c122013-01-19 03:44:477
8#include "base/string16.h"
9
[email protected]dad621b2013-03-19 01:57:1110namespace base {
11class Time;
12} // namespace base;
13
[email protected]1a04c122013-01-19 03:44:4714namespace autofill {
15
[email protected]dad621b2013-03-19 01:57:1116// Returns true if |year| and |month| describe a date later than |now|.
17// |year| must have 4 digits.
[email protected]d5ca8fb2013-04-11 17:54:3118bool IsValidCreditCardExpirationDate(const base::string16& year,
19 const base::string16& month,
[email protected]dad621b2013-03-19 01:57:1120 const base::Time& now);
21
[email protected]1a04c122013-01-19 03:44:4722// Returns true if |text| looks like a valid credit card number.
23// Uses the Luhn formula to validate the number.
[email protected]d5ca8fb2013-04-11 17:54:3124bool IsValidCreditCardNumber(const base::string16& text);
[email protected]1a04c122013-01-19 03:44:4725
[email protected]852c1e1f2013-02-12 05:06:3026// Returns true if |text| looks like a valid credit card security code.
[email protected]d5ca8fb2013-04-11 17:54:3127bool IsValidCreditCardSecurityCode(const base::string16& text);
[email protected]852c1e1f2013-02-12 05:06:3028
[email protected]e570ec1d2013-03-20 01:41:4629// Returns true if |code| looks like a valid credit card security code
30// for the type of credit card designated by |number|.
[email protected]d5ca8fb2013-04-11 17:54:3131bool IsValidCreditCardSecurityCode(const base::string16& code,
32 const base::string16& number);
[email protected]e570ec1d2013-03-20 01:41:4633
[email protected]e2e37f52013-02-22 23:16:1634// Returns true if |text| looks like a valid e-mail address.
[email protected]d5ca8fb2013-04-11 17:54:3135bool IsValidEmailAddress(const base::string16& text);
[email protected]e2e37f52013-02-22 23:16:1636
[email protected]b4c9c41e2013-02-26 01:51:4737// Returns true if |text| looks like a valid zip code.
38// Valid for US zip codes only.
[email protected]d5ca8fb2013-04-11 17:54:3139bool IsValidZip(const base::string16& text);
[email protected]b4c9c41e2013-02-26 01:51:4740
[email protected]1a04c122013-01-19 03:44:4741} // namespace autofill
42
[email protected]e4b2fa32013-03-09 22:56:5643#endif // COMPONENTS_AUTOFILL_BROWSER_VALIDATION_H_