Index: components/autofill/core/browser/credit_card.cc |
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc |
index b63d627c4f4dc943f036cc5088db3f56f07b9354..125879443da737254df5c713e93840c26ce31806 100644 |
--- a/components/autofill/core/browser/credit_card.cc |
+++ b/components/autofill/core/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/core/browser/autofill_field.h" |
#include "components/autofill/core/browser/autofill_regexes.h" |
#include "components/autofill/core/browser/autofill_type.h" |
@@ -586,6 +587,12 @@ bool CreditCard::IsComplete() const { |
expiration_year_ != 0; |
} |
+bool CreditCard::IsValid() const { |
+ return autofill::IsValidCreditCardNumber(number_) && |
+ autofill::IsValidCreditCardExpirationDate( |
+ expiration_year_, expiration_month_, base::Time::Now()); |
+} |
+ |
void CreditCard::GetSupportedTypes(FieldTypeSet* supported_types) const { |
supported_types->insert(CREDIT_CARD_NAME); |
supported_types->insert(CREDIT_CARD_NUMBER); |