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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 const std::string& app_locale, | 73 const std::string& app_locale, |
74 ServerFieldTypeSet* matching_types) const override; | 74 ServerFieldTypeSet* matching_types) const override; |
75 base::string16 GetRawInfo(ServerFieldType type) const override; | 75 base::string16 GetRawInfo(ServerFieldType type) const override; |
76 void SetRawInfo(ServerFieldType type, const base::string16& value) override; | 76 void SetRawInfo(ServerFieldType type, const base::string16& value) override; |
77 base::string16 GetInfo(const AutofillType& type, | 77 base::string16 GetInfo(const AutofillType& type, |
78 const std::string& app_locale) const override; | 78 const std::string& app_locale) const override; |
79 bool SetInfo(const AutofillType& type, | 79 bool SetInfo(const AutofillType& type, |
80 const base::string16& value, | 80 const base::string16& value, |
81 const std::string& app_locale) override; | 81 const std::string& app_locale) override; |
82 | 82 |
83 // Credit card preview summary, for example: ******1234, Exp: 01/2020 | 83 // Credit card preview summary, for example: Visa - 1234, Exp: 01/2020 |
| 84 // Used for settings and the requestAutocomplete dialog, but not |
| 85 // the autofill dropdown. |
84 const base::string16 Label() const; | 86 const base::string16 Label() const; |
85 | 87 |
86 // Special method to set value for HTML5 month input type. | 88 // Special method to set value for HTML5 month input type. |
87 void SetInfoForMonthInputType(const base::string16& value); | 89 void SetInfoForMonthInputType(const base::string16& value); |
88 | 90 |
89 // The number altered for display, for example: ******1234 | |
90 base::string16 ObfuscatedNumber() const; | |
91 // The last four digits of the credit card number (or possibly less if there | 91 // The last four digits of the credit card number (or possibly less if there |
92 // aren't enough characters). | 92 // aren't enough characters). |
93 base::string16 LastFourDigits() const; | 93 base::string16 LastFourDigits() const; |
94 // The user-visible type of the card, e.g. 'Mastercard'. | 94 // The user-visible type of the card, e.g. 'Mastercard'. |
95 base::string16 TypeForDisplay() const; | 95 base::string16 TypeForDisplay() const; |
96 // A label for this credit card formatted as 'Cardname - 2345'. | 96 // A label for this credit card formatted as 'Cardname - 2345'. |
97 base::string16 TypeAndLastFourDigits() const; | 97 base::string16 TypeAndLastFourDigits() const; |
98 | 98 |
99 const std::string& type() const { return type_; } | 99 const std::string& type() const { return type_; } |
100 | 100 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // not complete. | 141 // not complete. |
142 bool IsValid() const; | 142 bool IsValid() const; |
143 | 143 |
144 // Returns the credit card number. | 144 // Returns the credit card number. |
145 const base::string16& number() const { return number_; } | 145 const base::string16& number() const { return number_; } |
146 | 146 |
147 private: | 147 private: |
148 // FormGroup: | 148 // FormGroup: |
149 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; | 149 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
150 | 150 |
| 151 // The type of the card to fill in to the page, e.g. 'Mastercard'. |
| 152 base::string16 TypeForFill() const; |
| 153 |
151 // The month and year are zero if not present. | 154 // The month and year are zero if not present. |
152 int Expiration4DigitYear() const { return expiration_year_; } | 155 int Expiration4DigitYear() const { return expiration_year_; } |
153 int Expiration2DigitYear() const { return expiration_year_ % 100; } | 156 int Expiration2DigitYear() const { return expiration_year_ % 100; } |
154 base::string16 ExpirationMonthAsString() const; | 157 base::string16 ExpirationMonthAsString() const; |
155 base::string16 Expiration4DigitYearAsString() const; | 158 base::string16 Expiration4DigitYearAsString() const; |
156 base::string16 Expiration2DigitYearAsString() const; | 159 base::string16 Expiration2DigitYearAsString() const; |
157 | 160 |
158 // Sets |expiration_month_| to the integer conversion of |text|. | 161 // Sets |expiration_month_| to the integer conversion of |text|. |
159 void SetExpirationMonthFromString(const base::string16& text, | 162 void SetExpirationMonthFromString(const base::string16& text, |
160 const std::string& app_locale); | 163 const std::string& app_locale); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 extern const char* const kDiscoverCard; | 204 extern const char* const kDiscoverCard; |
202 extern const char* const kGenericCard; | 205 extern const char* const kGenericCard; |
203 extern const char* const kJCBCard; | 206 extern const char* const kJCBCard; |
204 extern const char* const kMasterCard; | 207 extern const char* const kMasterCard; |
205 extern const char* const kUnionPay; | 208 extern const char* const kUnionPay; |
206 extern const char* const kVisaCard; | 209 extern const char* const kVisaCard; |
207 | 210 |
208 } // namespace autofill | 211 } // namespace autofill |
209 | 212 |
210 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ | 213 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ |
OLD | NEW |