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

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
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..b87dcf9a7626efab84d9c7daca7d4b475cff54d7 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 TypeForDisplay(type_);
Ilya Sherman 2013/03/27 23:59:23 nit: Write this as "return CreditCard::TypeForDisp
Dan Beam 2013/03/28 03:38:12 Done.
}
string16 CreditCard::TypeAndLastFourDigits() const {

Powered by Google App Engine
This is Rietveld 408576698