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

Side by Side Diff: components/autofill/browser/validation.cc

Issue 12434004: Move remaining Autofill code to //components/autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix long lines Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/autofill/validation.h" 5 #include "components/autofill/browser/validation.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/autofill/autofill_regexes.h" 9 #include "components/autofill/browser/autofill_regexes.h"
10 #include "chrome/browser/autofill/credit_card.h" 10 #include "components/autofill/browser/credit_card.h"
11 11
12 namespace autofill { 12 namespace autofill {
13 13
14 bool IsValidCreditCardNumber(const string16& text) { 14 bool IsValidCreditCardNumber(const string16& text) {
15 string16 number = CreditCard::StripSeparators(text); 15 string16 number = CreditCard::StripSeparators(text);
16 16
17 // Credit card numbers are at most 19 digits in length [1]. 12 digits seems to 17 // Credit card numbers are at most 19 digits in length [1]. 12 digits seems to
18 // be a fairly safe lower-bound [2]. 18 // be a fairly safe lower-bound [2].
19 // [1] http://www.merriampark.com/anatomycc.htm 19 // [1] http://www.merriampark.com/anatomycc.htm
20 // [2] http://en.wikipedia.org/wiki/Bank_card_number 20 // [2] http://en.wikipedia.org/wiki/Bank_card_number
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 "[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$"); 67 "[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$");
68 return MatchesPattern(text, kEmailPattern); 68 return MatchesPattern(text, kEmailPattern);
69 } 69 }
70 70
71 bool IsValidZip(const string16& value) { 71 bool IsValidZip(const string16& value) {
72 const string16 kZipPattern = ASCIIToUTF16("^\\d{5}(-\\d{4})?$"); 72 const string16 kZipPattern = ASCIIToUTF16("^\\d{5}(-\\d{4})?$");
73 return MatchesPattern(value, kZipPattern); 73 return MatchesPattern(value, kZipPattern);
74 } 74 }
75 75
76 } // namespace autofill 76 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/browser/validation.h ('k') | components/autofill/browser/validation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698