| 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 <utility> | 10 #include <utility> |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // use. | 185 // use. |
| 186 void RecordAndLogUse(); | 186 void RecordAndLogUse(); |
| 187 | 187 |
| 188 // Converts a string representation of a month (such as "February" or "feb." | 188 // Converts a string representation of a month (such as "February" or "feb." |
| 189 // or "2") into a numeric value in [1, 12]. Returns true on successful | 189 // or "2") into a numeric value in [1, 12]. Returns true on successful |
| 190 // conversion or false if a month was not recognized. | 190 // conversion or false if a month was not recognized. |
| 191 static bool ConvertMonth(const base::string16& month, | 191 static bool ConvertMonth(const base::string16& month, |
| 192 const std::string& app_locale, | 192 const std::string& app_locale, |
| 193 int* num); | 193 int* num); |
| 194 | 194 |
| 195 // Returns whether the credit card is expired based on |current_time|. |
| 196 bool IsExpired(const base::Time& current_time) const; |
| 197 |
| 195 private: | 198 private: |
| 196 // FormGroup: | 199 // FormGroup: |
| 197 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; | 200 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
| 198 | 201 |
| 199 // The type of the card to fill in to the page, e.g. 'Mastercard'. | 202 // The type of the card to fill in to the page, e.g. 'Mastercard'. |
| 200 base::string16 TypeForFill() const; | 203 base::string16 TypeForFill() const; |
| 201 | 204 |
| 202 // The month and year are zero if not present. | 205 // The month and year are zero if not present. |
| 203 int Expiration4DigitYear() const { return expiration_year_; } | 206 int Expiration4DigitYear() const { return expiration_year_; } |
| 204 int Expiration2DigitYear() const { return expiration_year_ % 100; } | 207 int Expiration2DigitYear() const { return expiration_year_ % 100; } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 extern const char kDiscoverCard[]; | 252 extern const char kDiscoverCard[]; |
| 250 extern const char kGenericCard[]; | 253 extern const char kGenericCard[]; |
| 251 extern const char kJCBCard[]; | 254 extern const char kJCBCard[]; |
| 252 extern const char kMasterCard[]; | 255 extern const char kMasterCard[]; |
| 253 extern const char kUnionPay[]; | 256 extern const char kUnionPay[]; |
| 254 extern const char kVisaCard[]; | 257 extern const char kVisaCard[]; |
| 255 | 258 |
| 256 } // namespace autofill | 259 } // namespace autofill |
| 257 | 260 |
| 258 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ | 261 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ |
| OLD | NEW |