Index: components/autofill/core/browser/credit_card.cc |
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc |
index 9906f27ab6b34a4fc7a3c70827cf0361e0b2c2b2..ca1b20f44cdb9c2857d970a1c300e3a9fa87ce43 100644 |
--- a/components/autofill/core/browser/credit_card.cc |
+++ b/components/autofill/core/browser/credit_card.cc |
@@ -151,6 +151,8 @@ base::string16 CreditCard::TypeForDisplay(const std::string& type) { |
return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_JCB); |
if (type == kMasterCard) |
return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_MASTERCARD); |
+ if (type == kUnionPay) |
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_UNION_PAY); |
if (type == kVisaCard) |
return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_VISA); |
@@ -172,6 +174,8 @@ int CreditCard::IconResourceId(const std::string& type) { |
return IDR_AUTOFILL_CC_JCB; |
if (type == kMasterCard) |
return IDR_AUTOFILL_CC_MASTERCARD; |
+ if (type == kUnionPay) |
+ return IDR_AUTOFILL_CC_GENERIC; // Needs resource: http://crbug.com/259211 |
if (type == kVisaCard) |
return IDR_AUTOFILL_CC_VISA; |
@@ -200,6 +204,7 @@ std::string CreditCard::GetCreditCardType(const base::string16& number) { |
// Discover Card 6011,644-649,65 16 |
// JCB 3528-3589 16 |
// MasterCard 51-55 16 |
+ // UnionPay 62 16 |
Albert Bodenhamer
2013/07/11 16:28:42
Wikipedia claims 62 or 88 with a length of 16-19 h
Ilya Sherman
2013/07/12 01:06:47
AFAICT, 62 is the only prefix that most places ten
|
// Check for prefixes of length 1. |
if (number.empty()) |
@@ -227,6 +232,9 @@ std::string CreditCard::GetCreditCardType(const base::string16& number) { |
if (first_two_digits >= 51 && first_two_digits <= 55) |
return kMasterCard; |
+ if (first_two_digits == 62) |
+ return kUnionPay; |
+ |
if (first_two_digits == 65) |
return kDiscoverCard; |
@@ -692,6 +700,7 @@ const char* const kDiscoverCard = "discoverCC"; |
const char* const kGenericCard = "genericCC"; |
const char* const kJCBCard = "jcbCC"; |
const char* const kMasterCard = "masterCardCC"; |
+const char* const kUnionPay = "unionPayCC"; |
const char* const kVisaCard = "visaCC"; |
} // namespace autofill |