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

Unified Diff: components/autofill/core/browser/credit_card.h

Issue 2136453003: [Autofill] Improve support for various credit card expiration dates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final nits Created 4 years, 5 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 | « no previous file | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/credit_card.h
diff --git a/components/autofill/core/browser/credit_card.h b/components/autofill/core/browser/credit_card.h
index f516e9807cc1d0706a5a5e7ce9117a64c8006476..0a636a6de6b2696ef7172fcc93d8cc1a22ade02a 100644
--- a/components/autofill/core/browser/credit_card.h
+++ b/components/autofill/core/browser/credit_card.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/compiler_specific.h"
+#include "base/gtest_prod_util.h"
#include "base/strings/string16.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/autofill_data_model.h"
@@ -204,6 +205,9 @@ class CreditCard : public AutofillDataModel {
}
private:
+ FRIEND_TEST_ALL_PREFIXES(CreditCardTest, SetExpirationDateFromString);
+ FRIEND_TEST_ALL_PREFIXES(CreditCardTest, SetExpirationYearFromString);
+
// FormGroup:
void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override;
@@ -222,9 +226,15 @@ class CreditCard : public AutofillDataModel {
bool SetExpirationMonthFromString(const base::string16& text,
const std::string& app_locale);
- // Sets |expiration_year_| to the integer conversion of |text|.
+ // Sets |expiration_year_| to the integer conversion of |text|. Will handle
+ // 4-digit year or 2-digit year (eventually converted to 4-digit year).
void SetExpirationYearFromString(const base::string16& text);
+ // Sets |expiration_year_| and |expiration_month_| to the integer conversion
+ // of |text|. Will handle mmyy, mmyyyy, mm-yyyy and mm-yy as well as single
+ // digit months, with various separators.
+ void SetExpirationDateFromString(const base::string16& text);
+
// See enum definition above.
RecordType record_type_;
« no previous file with comments | « no previous file | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698