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

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

Issue 12213077: [Autofill] Credit Card validation for rAc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded includes Created 7 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
« no previous file with comments | « chrome/browser/autofill/validation.h ('k') | chrome/browser/autofill/validation_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/autofill/validation.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/autofill/credit_card.h" 8 #include "chrome/browser/autofill/credit_card.h"
9 9
10 namespace autofill { 10 namespace autofill {
(...skipping 27 matching lines...) Expand all
38 sum += digit / 10 + digit % 10; 38 sum += digit / 10 + digit % 10;
39 } else { 39 } else {
40 sum += digit; 40 sum += digit;
41 } 41 }
42 odd = !odd; 42 odd = !odd;
43 } 43 }
44 44
45 return (sum % 10) == 0; 45 return (sum % 10) == 0;
46 } 46 }
47 47
48 bool IsValidCreditCardSecurityCode(const string16& text) {
49 if (text.size() < 3U || text.size() > 4U)
50 return false;
51
52 for (string16::const_iterator iter = text.begin();
53 iter != text.end();
54 ++iter) {
55 if (!IsAsciiDigit(*iter))
56 return false;
57 }
58 return true;
59 }
60
48 } // namespace autofill 61 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/autofill/validation.h ('k') | chrome/browser/autofill/validation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698