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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Returns true if all field types have valid values set and the card is not | 165 // Returns true if all field types have valid values set and the card is not |
166 // expired. MASKED_SERVER_CARDs will never be valid because the number is | 166 // expired. MASKED_SERVER_CARDs will never be valid because the number is |
167 // not complete. | 167 // not complete. |
168 bool IsValid() const; | 168 bool IsValid() const; |
169 | 169 |
170 // Returns the credit card number. | 170 // Returns the credit card number. |
171 const base::string16& number() const { return number_; } | 171 const base::string16& number() const { return number_; } |
172 // Sets |number_| to |number| and computes the appropriate card |type_|. | 172 // Sets |number_| to |number| and computes the appropriate card |type_|. |
173 void SetNumber(const base::string16& number); | 173 void SetNumber(const base::string16& number); |
174 | 174 |
| 175 // Converts a string representation of a month (such as "February" or "feb." |
| 176 // or "2") into a numeric value in [1, 12]. Returns true on successful |
| 177 // conversion or false if a month was not recognized. |
| 178 static bool ConvertMonth(const base::string16& month, |
| 179 const std::string& app_locale, |
| 180 int* num); |
| 181 |
175 private: | 182 private: |
176 // FormGroup: | 183 // FormGroup: |
177 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; | 184 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
178 | 185 |
179 // The type of the card to fill in to the page, e.g. 'Mastercard'. | 186 // The type of the card to fill in to the page, e.g. 'Mastercard'. |
180 base::string16 TypeForFill() const; | 187 base::string16 TypeForFill() const; |
181 | 188 |
182 // The month and year are zero if not present. | 189 // The month and year are zero if not present. |
183 int Expiration4DigitYear() const { return expiration_year_; } | 190 int Expiration4DigitYear() const { return expiration_year_; } |
184 int Expiration2DigitYear() const { return expiration_year_ % 100; } | 191 int Expiration2DigitYear() const { return expiration_year_ % 100; } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 extern const char* const kDiscoverCard; | 235 extern const char* const kDiscoverCard; |
229 extern const char* const kGenericCard; | 236 extern const char* const kGenericCard; |
230 extern const char* const kJCBCard; | 237 extern const char* const kJCBCard; |
231 extern const char* const kMasterCard; | 238 extern const char* const kMasterCard; |
232 extern const char* const kUnionPay; | 239 extern const char* const kUnionPay; |
233 extern const char* const kVisaCard; | 240 extern const char* const kVisaCard; |
234 | 241 |
235 } // namespace autofill | 242 } // namespace autofill |
236 | 243 |
237 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ | 244 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ |
OLD | NEW |