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

Unified 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: Address line 2 is always valid. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/validation.cc
diff --git a/chrome/browser/autofill/validation.cc b/chrome/browser/autofill/validation.cc
index ad34b312f7948b54991957b3e2cd356ba3394675..e3123610739da7642471a58c30a215d2005ff881 100644
--- a/chrome/browser/autofill/validation.cc
+++ b/chrome/browser/autofill/validation.cc
@@ -5,6 +5,9 @@
#include "chrome/browser/autofill/validation.h"
#include "base/string_util.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/time.h"
+#include "base/utf_string_conversions.h"
Ilya Sherman 2013/02/11 05:39:51 nit: Not needed?
groby-ooo-7-16 2013/02/11 22:47:53 Left over from patch 1 - removed. On 2013/02/11 05
#include "chrome/browser/autofill/credit_card.h"
namespace autofill {
@@ -45,4 +48,17 @@ bool IsValidCreditCardNumber(const string16& text) {
return (sum % 10) == 0;
}
+bool IsValidCreditCardCSC(const string16& text) {
+ if (text.size() < 3U || text.size() > 4U)
+ return false;
+
+ for (string16::const_iterator iter = text.begin();
+ iter != text.end();
+ ++iter) {
+ if (!IsAsciiDigit(*iter))
+ return false;
+ }
+ return true;
+}
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698