Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: components/autofill/browser/credit_card.cc

Issue 12893007: Implementing VERIFY_CVV required action. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/browser/credit_card.h ('k') | components/autofill/browser/wallet/wallet_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/browser/credit_card.cc
diff --git a/components/autofill/browser/credit_card.cc b/components/autofill/browser/credit_card.cc
index c93f9a59050dfe738859fe00da5d08ecfe46cb5d..4d004c43a25348c5b4b96b1526ec3b1a81ab6586 100644
--- a/components/autofill/browser/credit_card.cc
+++ b/components/autofill/browser/credit_card.cc
@@ -220,6 +220,29 @@ const string16 CreditCard::StripSeparators(const string16& number) {
return stripped;
}
+// static
+string16 CreditCard::TypeForDisplay(const std::string& type) {
+ if (type == kAmericanExpressCard)
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_AMEX);
+ if (type == kDinersCard)
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_DINERS);
+ if (type == kDiscoverCard)
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_DISCOVER);
+ if (type == kJCBCard)
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_JCB);
+ if (type == kMasterCard)
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_MASTERCARD);
+ if (type == kSoloCard)
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_SOLO);
+ if (type == kVisaCard)
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_VISA);
+
+ // If you hit this DCHECK, the above list of cases needs to be updated to
+ // include a new card.
+ DCHECK_EQ(kGenericCard, type);
+ return string16();
+}
+
std::string CreditCard::GetGUID() const {
return guid();
}
@@ -416,25 +439,7 @@ string16 CreditCard::LastFourDigits() const {
}
string16 CreditCard::TypeForDisplay() const {
- if (type_ == kAmericanExpressCard)
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_AMEX);
- if (type_ == kDinersCard)
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_DINERS);
- if (type_ == kDiscoverCard)
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_DISCOVER);
- if (type_ == kJCBCard)
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_JCB);
- if (type_ == kMasterCard)
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_MASTERCARD);
- if (type_ == kSoloCard)
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_SOLO);
- if (type_ == kVisaCard)
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_VISA);
-
- // If you hit this DCHECK, the above list of cases needs to be updated to
- // include a new card.
- DCHECK_EQ(kGenericCard, type_);
- return string16();
+ return CreditCard::TypeForDisplay(type_);
}
string16 CreditCard::TypeAndLastFourDigits() const {
« no previous file with comments | « components/autofill/browser/credit_card.h ('k') | components/autofill/browser/wallet/wallet_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698