| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. | 198 // Whether the card expiration date should be updated. |
| 199 bool ShouldUpdateExpiration(const base::Time& current_time) const; | 199 bool ShouldUpdateExpiration(const base::Time& current_time) const; |
| 200 | 200 |
| 201 const std::string& billing_address_id() const { return billing_address_id_; } |
| 202 void set_billing_address_id(const std::string& id) { |
| 203 billing_address_id_ = id; |
| 204 } |
| 205 |
| 201 private: | 206 private: |
| 202 // FormGroup: | 207 // FormGroup: |
| 203 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; | 208 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
| 204 | 209 |
| 205 // The type of the card to fill in to the page, e.g. 'Mastercard'. | 210 // The type of the card to fill in to the page, e.g. 'Mastercard'. |
| 206 base::string16 TypeForFill() const; | 211 base::string16 TypeForFill() const; |
| 207 | 212 |
| 208 // The month and year are zero if not present. | 213 // The month and year are zero if not present. |
| 209 int Expiration4DigitYear() const { return expiration_year_; } | 214 int Expiration4DigitYear() const { return expiration_year_; } |
| 210 int Expiration2DigitYear() const { return expiration_year_ % 100; } | 215 int Expiration2DigitYear() const { return expiration_year_ % 100; } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 237 int expiration_month_; | 242 int expiration_month_; |
| 238 int expiration_year_; | 243 int expiration_year_; |
| 239 | 244 |
| 240 // For server cards (both MASKED and UNMASKED) this is the ID assigned by the | 245 // For server cards (both MASKED and UNMASKED) this is the ID assigned by the |
| 241 // server to uniquely identify this card. | 246 // server to uniquely identify this card. |
| 242 std::string server_id_; | 247 std::string server_id_; |
| 243 | 248 |
| 244 // The status of the card, as reported by the server. Not valid for local | 249 // The status of the card, as reported by the server. Not valid for local |
| 245 // cards. | 250 // cards. |
| 246 ServerStatus server_status_; | 251 ServerStatus server_status_; |
| 252 |
| 253 // The identifier of the billing address for this card. |
| 254 std::string billing_address_id_; |
| 247 }; | 255 }; |
| 248 | 256 |
| 249 // So we can compare CreditCards with EXPECT_EQ(). | 257 // So we can compare CreditCards with EXPECT_EQ(). |
| 250 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card); | 258 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card); |
| 251 | 259 |
| 252 // The string identifiers for credit card icon resources. | 260 // The string identifiers for credit card icon resources. |
| 253 extern const char kAmericanExpressCard[]; | 261 extern const char kAmericanExpressCard[]; |
| 254 extern const char kDinersCard[]; | 262 extern const char kDinersCard[]; |
| 255 extern const char kDiscoverCard[]; | 263 extern const char kDiscoverCard[]; |
| 256 extern const char kGenericCard[]; | 264 extern const char kGenericCard[]; |
| 257 extern const char kJCBCard[]; | 265 extern const char kJCBCard[]; |
| 258 extern const char kMasterCard[]; | 266 extern const char kMasterCard[]; |
| 259 extern const char kUnionPay[]; | 267 extern const char kUnionPay[]; |
| 260 extern const char kVisaCard[]; | 268 extern const char kVisaCard[]; |
| 261 | 269 |
| 262 } // namespace autofill | 270 } // namespace autofill |
| 263 | 271 |
| 264 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ | 272 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ |
| OLD | NEW |