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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Returns a version of |number| that has any separator characters removed. | 31 // Returns a version of |number| that has any separator characters removed. |
32 static const base::string16 StripSeparators(const base::string16& number); | 32 static const base::string16 StripSeparators(const base::string16& number); |
33 | 33 |
34 // The user-visible type of the card, e.g. 'Mastercard'. | 34 // The user-visible type of the card, e.g. 'Mastercard'. |
35 static base::string16 TypeForDisplay(const std::string& type); | 35 static base::string16 TypeForDisplay(const std::string& type); |
36 | 36 |
37 // The ResourceBundle ID for the appropriate credit card image. | 37 // The ResourceBundle ID for the appropriate credit card image. |
38 static int IconResourceId(const std::string& type); | 38 static int IconResourceId(const std::string& type); |
39 | 39 |
40 // The internal representation of credit card type. | 40 // Returns the internal representation of credit card type corresponding to |
| 41 // the given |number|. The credit card type is determined purely according to |
| 42 // the Issuer Identification Number (IIN), a.k.a. the "Bank Identification |
| 43 // Number (BIN)", which is parsed from the relevant prefix of the |number|. |
| 44 // This function performs no additional validation checks on the |number|. |
| 45 // Hence, the returned type for both the valid card "4111-1111-1111-1111" and |
| 46 // the invalid card "4garbage" will be Visa, which has an IIN of 4. |
41 static std::string GetCreditCardType(const base::string16& number); | 47 static std::string GetCreditCardType(const base::string16& number); |
42 | 48 |
43 // FormGroup: | 49 // FormGroup: |
44 virtual void GetMatchingTypes(const base::string16& text, | 50 virtual void GetMatchingTypes(const base::string16& text, |
45 const std::string& app_locale, | 51 const std::string& app_locale, |
46 FieldTypeSet* matching_types) const OVERRIDE; | 52 FieldTypeSet* matching_types) const OVERRIDE; |
47 virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; | 53 virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; |
48 virtual void SetRawInfo(AutofillFieldType type, | 54 virtual void SetRawInfo(AutofillFieldType type, |
49 const base::string16& value) OVERRIDE; | 55 const base::string16& value) OVERRIDE; |
50 virtual base::string16 GetInfo(AutofillFieldType type, | 56 virtual base::string16 GetInfo(AutofillFieldType type, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // So we can compare CreditCards with EXPECT_EQ(). | 154 // So we can compare CreditCards with EXPECT_EQ(). |
149 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card); | 155 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card); |
150 | 156 |
151 // The string identifiers for credit card icon resources. | 157 // The string identifiers for credit card icon resources. |
152 extern const char* const kAmericanExpressCard; | 158 extern const char* const kAmericanExpressCard; |
153 extern const char* const kDinersCard; | 159 extern const char* const kDinersCard; |
154 extern const char* const kDiscoverCard; | 160 extern const char* const kDiscoverCard; |
155 extern const char* const kGenericCard; | 161 extern const char* const kGenericCard; |
156 extern const char* const kJCBCard; | 162 extern const char* const kJCBCard; |
157 extern const char* const kMasterCard; | 163 extern const char* const kMasterCard; |
158 extern const char* const kSoloCard; | |
159 extern const char* const kVisaCard; | 164 extern const char* const kVisaCard; |
160 | 165 |
161 } // namespace autofill | 166 } // namespace autofill |
162 | 167 |
163 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ | 168 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ |
OLD | NEW |