OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef COMPONENTS_AUTOFILL_BROWSER_CREDIT_CARD_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_CREDIT_CARD_H_ |
6 #define COMPONENTS_AUTOFILL_BROWSER_CREDIT_CARD_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_CREDIT_CARD_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Used by tests. | 99 // Used by tests. |
100 bool operator==(const CreditCard& credit_card) const; | 100 bool operator==(const CreditCard& credit_card) const; |
101 bool operator!=(const CreditCard& credit_card) const; | 101 bool operator!=(const CreditCard& credit_card) const; |
102 | 102 |
103 // Returns true if there are no values (field types) set. | 103 // Returns true if there are no values (field types) set. |
104 bool IsEmpty(const std::string& app_locale) const; | 104 bool IsEmpty(const std::string& app_locale) const; |
105 | 105 |
106 // Returns true if all field types have valid values set. | 106 // Returns true if all field types have valid values set. |
107 bool IsComplete() const; | 107 bool IsComplete() const; |
108 | 108 |
| 109 // Returns true if all field types have valid values set and the card is not |
| 110 // expired. |
| 111 bool IsValid() const; |
| 112 |
109 // Returns the credit card number. | 113 // Returns the credit card number. |
110 const base::string16& number() const { return number_; } | 114 const base::string16& number() const { return number_; } |
111 | 115 |
112 private: | 116 private: |
113 // FormGroup: | 117 // FormGroup: |
114 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; | 118 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; |
115 | 119 |
116 // The month and year are zero if not present. | 120 // The month and year are zero if not present. |
117 int Expiration4DigitYear() const { return expiration_year_; } | 121 int Expiration4DigitYear() const { return expiration_year_; } |
118 int Expiration2DigitYear() const { return expiration_year_ % 100; } | 122 int Expiration2DigitYear() const { return expiration_year_ % 100; } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 extern const char* const kDiscoverCard; | 157 extern const char* const kDiscoverCard; |
154 extern const char* const kGenericCard; | 158 extern const char* const kGenericCard; |
155 extern const char* const kJCBCard; | 159 extern const char* const kJCBCard; |
156 extern const char* const kMasterCard; | 160 extern const char* const kMasterCard; |
157 extern const char* const kSoloCard; | 161 extern const char* const kSoloCard; |
158 extern const char* const kVisaCard; | 162 extern const char* const kVisaCard; |
159 | 163 |
160 } // namespace autofill | 164 } // namespace autofill |
161 | 165 |
162 #endif // COMPONENTS_AUTOFILL_BROWSER_CREDIT_CARD_H_ | 166 #endif // COMPONENTS_AUTOFILL_BROWSER_CREDIT_CARD_H_ |
OLD | NEW |