| Index: components/autofill/browser/wallet/full_wallet.cc
|
| diff --git a/components/autofill/browser/wallet/full_wallet.cc b/components/autofill/browser/wallet/full_wallet.cc
|
| index 875ce6c0ba0d713796fb0e04945a1250232c1cb7..be6b0915368c4c961b9f64b1f6db7abe15417d2f 100644
|
| --- a/components/autofill/browser/wallet/full_wallet.cc
|
| +++ b/components/autofill/browser/wallet/full_wallet.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/logging.h"
|
| #include "base/strings/string_number_conversions.h"
|
| +#include "base/utf_string_conversions.h"
|
| #include "base/values.h"
|
|
|
| namespace {
|
| @@ -123,6 +124,76 @@ scoped_ptr<FullWallet>
|
| required_actions));
|
| }
|
|
|
| +const std::string& FullWallet::GetPan() {
|
| + if (pan_.empty())
|
| + DecryptCardInfo();
|
| + return pan_;
|
| +}
|
| +
|
| +const std::string& FullWallet::GetCvn() {
|
| + if (cvn_.empty())
|
| + DecryptCardInfo();
|
| + return cvn_;
|
| +}
|
| +
|
| +const wallet::Address* FullWallet::GetAddress(bool is_billing) const {
|
| + return is_billing ? billing_address() : shipping_address();
|
| +}
|
| +
|
| +string16 FullWallet::GetInfo(AutofillFieldType type, bool is_billing) {
|
| + switch (type) {
|
| + case CREDIT_CARD_NUMBER:
|
| + DCHECK(is_billing);
|
| + return UTF8ToUTF16(GetPan());
|
| +
|
| + case CREDIT_CARD_NAME:
|
| + DCHECK(is_billing);
|
| + return billing_address()->recipient_name();
|
| +
|
| + case CREDIT_CARD_VERIFICATION_CODE:
|
| + DCHECK(is_billing);
|
| + return UTF8ToUTF16(GetCvn());
|
| +
|
| + case CREDIT_CARD_EXP_MONTH:
|
| + DCHECK(is_billing);
|
| + return base::IntToString16(expiration_month());
|
| +
|
| + case CREDIT_CARD_EXP_4_DIGIT_YEAR:
|
| + case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR:
|
| + DCHECK(is_billing);
|
| + return base::IntToString16(expiration_year());
|
| +
|
| + case NAME_FULL:
|
| + return GetAddress(is_billing)->recipient_name();
|
| +
|
| + case ADDRESS_HOME_LINE1:
|
| + return GetAddress(is_billing)->address_line_1();
|
| +
|
| + case ADDRESS_HOME_LINE2:
|
| + return GetAddress(is_billing)->address_line_2();
|
| +
|
| + case ADDRESS_HOME_CITY:
|
| + return GetAddress(is_billing)->locality_name();
|
| +
|
| + case ADDRESS_HOME_STATE:
|
| + return GetAddress(is_billing)->administrative_area_name();
|
| +
|
| + case ADDRESS_HOME_ZIP:
|
| + return GetAddress(is_billing)->postal_code_number();
|
| +
|
| + case ADDRESS_HOME_COUNTRY:
|
| + return UTF8ToUTF16(GetAddress(is_billing)->country_name_code());
|
| +
|
| + case PHONE_HOME_WHOLE_NUMBER:
|
| + return GetAddress(is_billing)->phone_number();
|
| +
|
| + default:
|
| + NOTREACHED();
|
| + }
|
| +
|
| + return string16();
|
| +}
|
| +
|
| bool FullWallet::HasRequiredAction(RequiredAction action) const {
|
| DCHECK(ActionAppliesToFullWallet(action));
|
| return std::find(required_actions_.begin(),
|
| @@ -167,18 +238,6 @@ bool FullWallet::operator!=(const FullWallet& other) const {
|
| return !(*this == other);
|
| }
|
|
|
| -const std::string& FullWallet::GetPan() {
|
| - if (pan_.empty())
|
| - DecryptCardInfo();
|
| - return pan_;
|
| -}
|
| -
|
| -const std::string& FullWallet::GetCvn() {
|
| - if (cvn_.empty())
|
| - DecryptCardInfo();
|
| - return cvn_;
|
| -}
|
| -
|
| void FullWallet::DecryptCardInfo() {
|
| std::vector<uint8> operating_data;
|
| // Convert |encrypted_rest_| to bytes so we can decrypt it with |otp|.
|
|
|