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

Unified Diff: components/autofill/browser/credit_card.cc

Issue 17099006: Validate saved credit card number in interactive autocomplete (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move credit card validation to credit card class Created 7 years, 6 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
« no previous file with comments | « components/autofill/browser/credit_card.h ('k') | components/autofill/browser/credit_card_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/browser/credit_card.cc
diff --git a/components/autofill/browser/credit_card.cc b/components/autofill/browser/credit_card.cc
index 8a96fa9955f15ed0157f4e24d825c0f27b828e30..5aca667646ddec508d01b824c91641ff91966990 100644
--- a/components/autofill/browser/credit_card.cc
+++ b/components/autofill/browser/credit_card.cc
@@ -17,6 +17,7 @@
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/time.h"
#include "components/autofill/browser/autofill_field.h"
#include "components/autofill/browser/autofill_regexes.h"
#include "components/autofill/browser/autofill_type.h"
@@ -585,6 +586,13 @@ bool CreditCard::IsComplete() const {
expiration_year_ != 0;
}
+bool CreditCard::IsValid() const {
+ return IsComplete() && autofill::IsValidCreditCardExpirationDate(
+ Expiration4DigitYearAsString(),
Evan Stade 2013/06/17 19:17:57 nit: I would rather not make this depend on IsComp
please use gerrit instead 2013/06/17 21:40:24 Done.
+ ExpirationMonthAsString(),
+ base::Time::Now());
+}
+
void CreditCard::GetSupportedTypes(FieldTypeSet* supported_types) const {
supported_types->insert(CREDIT_CARD_NAME);
supported_types->insert(CREDIT_CARD_NUMBER);
« no previous file with comments | « components/autofill/browser/credit_card.h ('k') | components/autofill/browser/credit_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698