Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: components/autofill/core/browser/validation.h

Issue 2673753005: [Payments] Basic validation in the credit card editor. (Closed)
Patch Set: more tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 |error_message| is
48 // not null and the function returns false, it is populated with the error
please use gerrit instead 2017/02/07 21:55:22 s/it/|error_message|/ (to disambiguate)
Mathieu 2017/02/08 02:03:25 reworded
49 // message.
50 bool IsValidForType(const base::string16& value,
51 ServerFieldType type,
52 base::string16* error_message);
53
46 } // namespace autofill 54 } // namespace autofill
47 55
48 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ 56 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698