Chromium Code Reviews| 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..240c68ec3eaba76aef6e28854c8a133112d80d58 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,31 @@ scoped_ptr<FullWallet> |
| required_actions)); |
| } |
| +string16 FullWallet::GetInfo(AutofillFieldType type) { |
| + switch (type) { |
| + case CREDIT_CARD_NUMBER: |
| + return UTF8ToUTF16(GetPan()); |
| + |
| + case CREDIT_CARD_NAME: |
| + return billing_address()->recipient_name(); |
| + |
| + case CREDIT_CARD_VERIFICATION_CODE: |
| + return UTF8ToUTF16(GetCvn()); |
| + |
| + case CREDIT_CARD_EXP_MONTH: |
| + return base::IntToString16(expiration_month()); |
| + |
| + case CREDIT_CARD_EXP_4_DIGIT_YEAR: |
| + case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR: |
|
Ilya Sherman
2013/03/14 21:59:08
As I mentioned in the other CL, this isn't how EXP
Dan Beam
2013/03/15 02:10:58
Delorted.
|
| + return base::IntToString16(expiration_year()); |
| + |
| + default: |
| + NOTREACHED(); |
| + } |
| + |
| + return string16(); |
| +} |
| + |
| bool FullWallet::HasRequiredAction(RequiredAction action) const { |
| DCHECK(ActionAppliesToFullWallet(action)); |
| return std::find(required_actions_.begin(), |
| @@ -167,18 +193,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|. |
| @@ -220,5 +234,17 @@ 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(); |
| + return cvn_; |
| +} |
| + |
| } // namespace wallet |
| } // namespace autofill |