| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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|. | 195 // Returns whether the credit card is expired based on |current_time|. |
| 196 bool IsExpired(const base::Time& current_time) const; | 196 bool IsExpired(const base::Time& current_time) const; |
| 197 | 197 |
| 198 // Whether the card expiration date should be updated. |
| 199 bool ShouldUpdateExpiration(const base::Time& current_time) const; |
| 200 |
| 198 private: | 201 private: |
| 199 // FormGroup: | 202 // FormGroup: |
| 200 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; | 203 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
| 201 | 204 |
| 202 // The type of the card to fill in to the page, e.g. 'Mastercard'. | 205 // The type of the card to fill in to the page, e.g. 'Mastercard'. |
| 203 base::string16 TypeForFill() const; | 206 base::string16 TypeForFill() const; |
| 204 | 207 |
| 205 // The month and year are zero if not present. | 208 // The month and year are zero if not present. |
| 206 int Expiration4DigitYear() const { return expiration_year_; } | 209 int Expiration4DigitYear() const { return expiration_year_; } |
| 207 int Expiration2DigitYear() const { return expiration_year_ % 100; } | 210 int Expiration2DigitYear() const { return expiration_year_ % 100; } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 extern const char kDiscoverCard[]; | 255 extern const char kDiscoverCard[]; |
| 253 extern const char kGenericCard[]; | 256 extern const char kGenericCard[]; |
| 254 extern const char kJCBCard[]; | 257 extern const char kJCBCard[]; |
| 255 extern const char kMasterCard[]; | 258 extern const char kMasterCard[]; |
| 256 extern const char kUnionPay[]; | 259 extern const char kUnionPay[]; |
| 257 extern const char kVisaCard[]; | 260 extern const char kVisaCard[]; |
| 258 | 261 |
| 259 } // namespace autofill | 262 } // namespace autofill |
| 260 | 263 |
| 261 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ | 264 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ |
| OLD | NEW |