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

Unified Diff: components/autofill/content/browser/wallet/full_wallet.cc

Issue 137723008: Remove DataModelWrapper from android build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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/content/browser/wallet/full_wallet.cc
diff --git a/components/autofill/content/browser/wallet/full_wallet.cc b/components/autofill/content/browser/wallet/full_wallet.cc
index d4b390ada82c01641106c6e3f6ea5ca3e7e85a5f..fda8811ad5ebd4d7e0bd47af39befb47f8ec3c72 100644
--- a/components/autofill/content/browser/wallet/full_wallet.cc
+++ b/components/autofill/content/browser/wallet/full_wallet.cc
@@ -154,16 +154,17 @@ scoped_ptr<FullWallet>
return wallet.Pass();
}
-base::string16 FullWallet::GetInfo(const AutofillType& type) {
+base::string16 FullWallet::GetInfo(const std::string& app_locale,
+ const AutofillType& type) {
switch (type.GetStorableType()) {
case CREDIT_CARD_NUMBER:
- return base::UTF8ToUTF16(GetPan());
+ return base::ASCIIToUTF16(GetPan());
case CREDIT_CARD_NAME:
return billing_address()->recipient_name();
case CREDIT_CARD_VERIFICATION_CODE:
- return base::UTF8ToUTF16(GetCvn());
+ return base::ASCIIToUTF16(GetCvn());
case CREDIT_CARD_EXP_MONTH:
if (expiration_month() == 0)
@@ -182,7 +183,7 @@ base::string16 FullWallet::GetInfo(const AutofillType& type) {
case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR:
if (expiration_month() == 0 || expiration_year() == 0)
- return base::string16();
+ return base::string16();
return base::IntToString16(expiration_month()) + base::ASCIIToUTF16("/") +
base::IntToString16(expiration_year() % 100);
@@ -194,17 +195,27 @@ base::string16 FullWallet::GetInfo(const AutofillType& type) {
case CREDIT_CARD_TYPE: {
std::string internal_type =
- CreditCard::GetCreditCardType(base::UTF8ToUTF16(GetPan()));
+ CreditCard::GetCreditCardType(base::ASCIIToUTF16(GetPan()));
if (internal_type == kGenericCard)
return base::string16();
return CreditCard::TypeForDisplay(internal_type);
}
- default:
- NOTREACHED();
- }
+ default: {
+ switch (type.group()) {
+ case NAME_BILLING:
+ case PHONE_BILLING:
+ case ADDRESS_BILLING:
+ return billing_address_->GetInfo(type, app_locale);
- return base::string16();
+ case CREDIT_CARD:
+ NOTREACHED();
+
+ default:
+ return shipping_address_->GetInfo(type, app_locale);
+ }
+ }
+ }
}
bool FullWallet::HasRequiredAction(RequiredAction action) const {
@@ -216,11 +227,16 @@ bool FullWallet::HasRequiredAction(RequiredAction action) const {
base::string16 FullWallet::TypeAndLastFourDigits() {
CreditCard card;
- card.SetRawInfo(CREDIT_CARD_NUMBER,
- GetInfo(AutofillType(CREDIT_CARD_NUMBER)));
+ card.SetRawInfo(CREDIT_CARD_NUMBER, base::ASCIIToUTF16(GetPan()));
return card.TypeAndLastFourDigits();
}
+const std::string& FullWallet::GetPan() {
+ if (pan_.empty())
+ DecryptCardInfo();
+ return pan_;
+}
+
bool FullWallet::operator==(const FullWallet& other) const {
if (expiration_month_ != other.expiration_month_)
return false;
@@ -307,12 +323,6 @@ void FullWallet::DecryptCardInfo() {
pan_ = iin_ + card_info.substr(0, split);
}
-const std::string& FullWallet::GetPan() {
- if (pan_.empty())
- DecryptCardInfo();
- return pan_;
-}
-
const std::string& FullWallet::GetCvn() {
if (cvn_.empty())
DecryptCardInfo();

Powered by Google App Engine
This is Rietveld 408576698