| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Number (BIN)", which is parsed from the relevant prefix of the |number|. | 42 // Number (BIN)", which is parsed from the relevant prefix of the |number|. |
| 43 // This function performs no additional validation checks on the |number|. | 43 // This function performs no additional validation checks on the |number|. |
| 44 // Hence, the returned type for both the valid card "4111-1111-1111-1111" and | 44 // Hence, the returned type for both the valid card "4111-1111-1111-1111" and |
| 45 // the invalid card "4garbage" will be Visa, which has an IIN of 4. | 45 // the invalid card "4garbage" will be Visa, which has an IIN of 4. |
| 46 static const char* GetCreditCardType(const base::string16& number); | 46 static const char* GetCreditCardType(const base::string16& number); |
| 47 | 47 |
| 48 // FormGroup: | 48 // FormGroup: |
| 49 virtual void GetMatchingTypes( | 49 virtual void GetMatchingTypes( |
| 50 const base::string16& text, | 50 const base::string16& text, |
| 51 const std::string& app_locale, | 51 const std::string& app_locale, |
| 52 ServerFieldTypeSet* matching_types) const OVERRIDE; | 52 ServerFieldTypeSet* matching_types) const override; |
| 53 virtual base::string16 GetRawInfo(ServerFieldType type) const OVERRIDE; | 53 virtual base::string16 GetRawInfo(ServerFieldType type) const override; |
| 54 virtual void SetRawInfo(ServerFieldType type, | 54 virtual void SetRawInfo(ServerFieldType type, |
| 55 const base::string16& value) OVERRIDE; | 55 const base::string16& value) override; |
| 56 virtual base::string16 GetInfo(const AutofillType& type, | 56 virtual base::string16 GetInfo(const AutofillType& type, |
| 57 const std::string& app_locale) const OVERRIDE; | 57 const std::string& app_locale) const override; |
| 58 virtual bool SetInfo(const AutofillType& type, | 58 virtual bool SetInfo(const AutofillType& type, |
| 59 const base::string16& value, | 59 const base::string16& value, |
| 60 const std::string& app_locale) OVERRIDE; | 60 const std::string& app_locale) override; |
| 61 | 61 |
| 62 // Credit card preview summary, for example: ******1234, Exp: 01/2020 | 62 // Credit card preview summary, for example: ******1234, Exp: 01/2020 |
| 63 const base::string16 Label() const; | 63 const base::string16 Label() const; |
| 64 | 64 |
| 65 // Special method to set value for HTML5 month input type. | 65 // Special method to set value for HTML5 month input type. |
| 66 void SetInfoForMonthInputType(const base::string16& value); | 66 void SetInfoForMonthInputType(const base::string16& value); |
| 67 | 67 |
| 68 // The number altered for display, for example: ******1234 | 68 // The number altered for display, for example: ******1234 |
| 69 base::string16 ObfuscatedNumber() const; | 69 base::string16 ObfuscatedNumber() const; |
| 70 // The last four digits of the credit card number. | 70 // The last four digits of the credit card number. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Returns true if all field types have valid values set and the card is not | 110 // Returns true if all field types have valid values set and the card is not |
| 111 // expired. | 111 // expired. |
| 112 bool IsValid() const; | 112 bool IsValid() const; |
| 113 | 113 |
| 114 // Returns the credit card number. | 114 // Returns the credit card number. |
| 115 const base::string16& number() const { return number_; } | 115 const base::string16& number() const { return number_; } |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 // FormGroup: | 118 // FormGroup: |
| 119 virtual void GetSupportedTypes( | 119 virtual void GetSupportedTypes( |
| 120 ServerFieldTypeSet* supported_types) const OVERRIDE; | 120 ServerFieldTypeSet* supported_types) const override; |
| 121 | 121 |
| 122 // The month and year are zero if not present. | 122 // The month and year are zero if not present. |
| 123 int Expiration4DigitYear() const { return expiration_year_; } | 123 int Expiration4DigitYear() const { return expiration_year_; } |
| 124 int Expiration2DigitYear() const { return expiration_year_ % 100; } | 124 int Expiration2DigitYear() const { return expiration_year_ % 100; } |
| 125 base::string16 ExpirationMonthAsString() const; | 125 base::string16 ExpirationMonthAsString() const; |
| 126 base::string16 Expiration4DigitYearAsString() const; | 126 base::string16 Expiration4DigitYearAsString() const; |
| 127 base::string16 Expiration2DigitYearAsString() const; | 127 base::string16 Expiration2DigitYearAsString() const; |
| 128 | 128 |
| 129 // Sets |expiration_month_| to the integer conversion of |text|. | 129 // Sets |expiration_month_| to the integer conversion of |text|. |
| 130 void SetExpirationMonthFromString(const base::string16& text, | 130 void SetExpirationMonthFromString(const base::string16& text, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 159 extern const char* const kDiscoverCard; | 159 extern const char* const kDiscoverCard; |
| 160 extern const char* const kGenericCard; | 160 extern const char* const kGenericCard; |
| 161 extern const char* const kJCBCard; | 161 extern const char* const kJCBCard; |
| 162 extern const char* const kMasterCard; | 162 extern const char* const kMasterCard; |
| 163 extern const char* const kUnionPay; | 163 extern const char* const kUnionPay; |
| 164 extern const char* const kVisaCard; | 164 extern const char* const kVisaCard; |
| 165 | 165 |
| 166 } // namespace autofill | 166 } // namespace autofill |
| 167 | 167 |
| 168 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ | 168 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ |
| OLD | NEW |