| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/autofill/browser/wallet/full_wallet.h" | 5 #include "components/autofill/browser/wallet/full_wallet.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 return scoped_ptr<FullWallet>(new FullWallet(expiration_month, | 118 return scoped_ptr<FullWallet>(new FullWallet(expiration_month, |
| 119 expiration_year, | 119 expiration_year, |
| 120 iin, | 120 iin, |
| 121 encrypted_rest, | 121 encrypted_rest, |
| 122 billing_address.Pass(), | 122 billing_address.Pass(), |
| 123 shipping_address.Pass(), | 123 shipping_address.Pass(), |
| 124 required_actions)); | 124 required_actions)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 string16 FullWallet::GetInfo(AutofillFieldType type) { | 127 base::string16 FullWallet::GetInfo(AutofillFieldType type) { |
| 128 switch (type) { | 128 switch (type) { |
| 129 case CREDIT_CARD_NUMBER: | 129 case CREDIT_CARD_NUMBER: |
| 130 return UTF8ToUTF16(GetPan()); | 130 return UTF8ToUTF16(GetPan()); |
| 131 | 131 |
| 132 case CREDIT_CARD_NAME: | 132 case CREDIT_CARD_NAME: |
| 133 return billing_address()->recipient_name(); | 133 return billing_address()->recipient_name(); |
| 134 | 134 |
| 135 case CREDIT_CARD_VERIFICATION_CODE: | 135 case CREDIT_CARD_VERIFICATION_CODE: |
| 136 return UTF8ToUTF16(GetCvn()); | 136 return UTF8ToUTF16(GetCvn()); |
| 137 | 137 |
| 138 case CREDIT_CARD_EXP_MONTH: | 138 case CREDIT_CARD_EXP_MONTH: |
| 139 return base::IntToString16(expiration_month()); | 139 return base::IntToString16(expiration_month()); |
| 140 | 140 |
| 141 case CREDIT_CARD_EXP_4_DIGIT_YEAR: | 141 case CREDIT_CARD_EXP_4_DIGIT_YEAR: |
| 142 return base::IntToString16(expiration_year()); | 142 return base::IntToString16(expiration_year()); |
| 143 | 143 |
| 144 default: | 144 default: |
| 145 NOTREACHED(); | 145 NOTREACHED(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 return string16(); | 148 return base::string16(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool FullWallet::HasRequiredAction(RequiredAction action) const { | 151 bool FullWallet::HasRequiredAction(RequiredAction action) const { |
| 152 DCHECK(ActionAppliesToFullWallet(action)); | 152 DCHECK(ActionAppliesToFullWallet(action)); |
| 153 return std::find(required_actions_.begin(), | 153 return std::find(required_actions_.begin(), |
| 154 required_actions_.end(), | 154 required_actions_.end(), |
| 155 action) != required_actions_.end(); | 155 action) != required_actions_.end(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool FullWallet::operator==(const FullWallet& other) const { | 158 bool FullWallet::operator==(const FullWallet& other) const { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 } | 244 } |
| 245 | 245 |
| 246 const std::string& FullWallet::GetCvn() { | 246 const std::string& FullWallet::GetCvn() { |
| 247 if (cvn_.empty()) | 247 if (cvn_.empty()) |
| 248 DecryptCardInfo(); | 248 DecryptCardInfo(); |
| 249 return cvn_; | 249 return cvn_; |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace wallet | 252 } // namespace wallet |
| 253 } // namespace autofill | 253 } // namespace autofill |
| OLD | NEW |