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