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

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

Issue 2773383002: [Payments] In shipping address editor, enable required + phone validation. (Closed)
Patch Set: addressed comment Created 3 years, 8 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 #include "components/autofill/core/browser/field_types.h"
(...skipping 27 matching lines...) Expand all
38 const std::set<std::string>& supported_basic_card_networks, 38 const std::set<std::string>& supported_basic_card_networks,
39 base::string16* error_message); 39 base::string16* error_message);
40 40
41 // Returns true if |text| looks like a valid e-mail address. 41 // Returns true if |text| looks like a valid e-mail address.
42 bool IsValidEmailAddress(const base::string16& text); 42 bool IsValidEmailAddress(const base::string16& text);
43 43
44 // Returns true if |text| is a valid US state name or abbreviation. It is case 44 // Returns true if |text| is a valid US state name or abbreviation. It is case
45 // insensitive. Valid for US states only. 45 // insensitive. Valid for US states only.
46 bool IsValidState(const base::string16& text); 46 bool IsValidState(const base::string16& text);
47 47
48 // Returns whether the number contained in |text| is valid for the specified
49 // |country_code|. Callers should cache the result as the parsing is expensive.
50 bool IsValidPhoneNumber(const base::string16& text,
51 const std::string& country_code);
52
48 // Returns true if |text| looks like a valid zip code. 53 // Returns true if |text| looks like a valid zip code.
49 // Valid for US zip codes only. 54 // Valid for US zip codes only.
50 bool IsValidZip(const base::string16& text); 55 bool IsValidZip(const base::string16& text);
51 56
52 // Returns true if |text| looks like an SSN, with or without separators. 57 // Returns true if |text| looks like an SSN, with or without separators.
53 bool IsSSN(const base::string16& text); 58 bool IsSSN(const base::string16& text);
54 59
55 // Returns whether |value| is valid for the given |type|. If not null, 60 // Returns whether |value| is valid for the given |type|. If not null,
56 // |error_message| is populated when the function returns false. 61 // |error_message| is populated when the function returns false.
57 bool IsValidForType(const base::string16& value, 62 bool IsValidForType(const base::string16& value,
58 ServerFieldType type, 63 ServerFieldType type,
59 base::string16* error_message); 64 base::string16* error_message);
60 65
61 } // namespace autofill 66 } // namespace autofill
62 67
63 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_ 68 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_VALIDATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698