| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 ~CreditCard() override; | 56 ~CreditCard() override; |
| 57 | 57 |
| 58 // Returns a version of |number| that has any separator characters removed. | 58 // Returns a version of |number| that has any separator characters removed. |
| 59 static const base::string16 StripSeparators(const base::string16& number); | 59 static const base::string16 StripSeparators(const base::string16& number); |
| 60 | 60 |
| 61 // The user-visible type of the card, e.g. 'Mastercard'. | 61 // The user-visible type of the card, e.g. 'Mastercard'. |
| 62 static base::string16 TypeForDisplay(const std::string& type); | 62 static base::string16 TypeForDisplay(const std::string& type); |
| 63 | 63 |
| 64 // This method is not compiled on iOS because the resources are not used and | 64 // This method is not compiled on iOS because the resources are not used and |
| 65 // should not be shipped. | 65 // should not be shipped. |
| 66 // TODO(jdonnelly): Use credit card issuer images on iOS. |
| 67 // http://crbug.com/535784 |
| 66 #if !defined(OS_IOS) | 68 #if !defined(OS_IOS) |
| 67 // The ResourceBundle ID for the appropriate credit card image. | 69 // The ResourceBundle ID for the appropriate credit card image. |
| 68 static int IconResourceId(const std::string& type); | 70 static int IconResourceId(const std::string& type); |
| 69 #endif // #if !defined(OS_IOS) | 71 #endif // #if !defined(OS_IOS) |
| 70 | 72 |
| 71 // Returns the internal representation of credit card type corresponding to | 73 // Returns the internal representation of credit card type corresponding to |
| 72 // the given |number|. The credit card type is determined purely according to | 74 // the given |number|. The credit card type is determined purely according to |
| 73 // the Issuer Identification Number (IIN), a.k.a. the "Bank Identification | 75 // the Issuer Identification Number (IIN), a.k.a. the "Bank Identification |
| 74 // Number (BIN)", which is parsed from the relevant prefix of the |number|. | 76 // Number (BIN)", which is parsed from the relevant prefix of the |number|. |
| 75 // This function performs no additional validation checks on the |number|. | 77 // This function performs no additional validation checks on the |number|. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 106 void SetInfoForMonthInputType(const base::string16& value); | 108 void SetInfoForMonthInputType(const base::string16& value); |
| 107 | 109 |
| 108 // The last four digits of the credit card number (or possibly less if there | 110 // The last four digits of the credit card number (or possibly less if there |
| 109 // aren't enough characters). | 111 // aren't enough characters). |
| 110 base::string16 LastFourDigits() const; | 112 base::string16 LastFourDigits() const; |
| 111 // The user-visible type of the card, e.g. 'Mastercard'. | 113 // The user-visible type of the card, e.g. 'Mastercard'. |
| 112 base::string16 TypeForDisplay() const; | 114 base::string16 TypeForDisplay() const; |
| 113 // A label for this credit card formatted as 'Cardname - 2345'. | 115 // A label for this credit card formatted as 'Cardname - 2345'. |
| 114 base::string16 TypeAndLastFourDigits() const; | 116 base::string16 TypeAndLastFourDigits() const; |
| 115 | 117 |
| 118 // Localized expiration for this credit card formatted as 'Exp: 06/17'. |
| 119 base::string16 AbbreviatedExpirationDateForDisplay() const; |
| 120 |
| 116 const std::string& type() const { return type_; } | 121 const std::string& type() const { return type_; } |
| 117 | 122 |
| 118 int expiration_month() const { return expiration_month_; } | 123 int expiration_month() const { return expiration_month_; } |
| 119 int expiration_year() const { return expiration_year_; } | 124 int expiration_year() const { return expiration_year_; } |
| 120 | 125 |
| 121 // These setters verify that the month and year are within appropriate | 126 // These setters verify that the month and year are within appropriate |
| 122 // ranges, or 0. They take integers as an alternative to setting the inputs | 127 // ranges, or 0. They take integers as an alternative to setting the inputs |
| 123 // from strings via SetInfo(). | 128 // from strings via SetInfo(). |
| 124 void SetExpirationMonth(int expiration_month); | 129 void SetExpirationMonth(int expiration_month); |
| 125 void SetExpirationYear(int expiration_year); | 130 void SetExpirationYear(int expiration_year); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 extern const char kDiscoverCard[]; | 245 extern const char kDiscoverCard[]; |
| 241 extern const char kGenericCard[]; | 246 extern const char kGenericCard[]; |
| 242 extern const char kJCBCard[]; | 247 extern const char kJCBCard[]; |
| 243 extern const char kMasterCard[]; | 248 extern const char kMasterCard[]; |
| 244 extern const char kUnionPay[]; | 249 extern const char kUnionPay[]; |
| 245 extern const char kVisaCard[]; | 250 extern const char kVisaCard[]; |
| 246 | 251 |
| 247 } // namespace autofill | 252 } // namespace autofill |
| 248 | 253 |
| 249 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ | 254 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ |
| OLD | NEW |