| 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 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "components/autofill/core/browser/field_types.h" |
| 10 | 11 |
| 11 namespace base { | 12 namespace base { |
| 12 class Time; | 13 class Time; |
| 13 } // namespace base | 14 } // namespace base |
| 14 | 15 |
| 15 namespace autofill { | 16 namespace autofill { |
| 16 | 17 |
| 17 // Returns true if |year| and |month| describe a date later than |now|. | 18 // Returns true if |year| and |month| describe a date later than |now|. |
| 18 // |year| must have 4 digits. | 19 // |year| must have 4 digits. |
| 19 bool IsValidCreditCardExpirationDate(int year, | 20 bool IsValidCreditCardExpirationDate(int year, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 36 // case insensitive. Valid for US states only. | 37 // case insensitive. Valid for US states only. |
| 37 bool IsValidState(const base::string16& text); | 38 bool IsValidState(const base::string16& text); |
| 38 | 39 |
| 39 // Returns true if |text| looks like a valid zip code. | 40 // Returns true if |text| looks like a valid zip code. |
| 40 // Valid for US zip codes only. | 41 // Valid for US zip codes only. |
| 41 bool IsValidZip(const base::string16& text); | 42 bool IsValidZip(const base::string16& text); |
| 42 | 43 |
| 43 // Returns true if |text| looks like an SSN, with or without separators. | 44 // Returns true if |text| looks like an SSN, with or without separators. |
| 44 bool IsSSN(const base::string16& text); | 45 bool IsSSN(const base::string16& text); |
| 45 | 46 |
| 47 // Returns whether |value| is valid for the given |type|. If not null, |
| 48 // |error_message| is populated when the function returns false. |
| 49 bool IsValidForType(const base::string16& value, |
| 50 ServerFieldType type, |
| 51 base::string16* error_message); |
| 52 |
| 46 } // namespace autofill | 53 } // namespace autofill |
| 47 | 54 |
| 48 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ | 55 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ |
| OLD | NEW |