OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/content/browser/wallet/full_wallet.h" | 5 #include "components/autofill/content/browser/wallet/full_wallet.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 } // anonymous namespace | 24 } // anonymous namespace |
25 | 25 |
26 namespace autofill { | 26 namespace autofill { |
27 namespace wallet { | 27 namespace wallet { |
28 | 28 |
29 FullWallet::FullWallet(int expiration_month, | 29 FullWallet::FullWallet(int expiration_month, |
30 int expiration_year, | 30 int expiration_year, |
31 const std::string& iin, | 31 const std::string& iin, |
32 const std::string& encrypted_rest, | 32 const std::string& encrypted_rest, |
33 scoped_ptr<Address> billing_address, | 33 std::unique_ptr<Address> billing_address, |
34 scoped_ptr<Address> shipping_address) | 34 std::unique_ptr<Address> shipping_address) |
35 : expiration_month_(expiration_month), | 35 : expiration_month_(expiration_month), |
36 expiration_year_(expiration_year), | 36 expiration_year_(expiration_year), |
37 iin_(iin), | 37 iin_(iin), |
38 encrypted_rest_(encrypted_rest), | 38 encrypted_rest_(encrypted_rest), |
39 billing_address_(std::move(billing_address)), | 39 billing_address_(std::move(billing_address)), |
40 shipping_address_(std::move(shipping_address)) { | 40 shipping_address_(std::move(shipping_address)) { |
41 DCHECK(billing_address_.get()); | 41 DCHECK(billing_address_.get()); |
42 } | 42 } |
43 | 43 |
44 FullWallet::~FullWallet() {} | 44 FullWallet::~FullWallet() {} |
45 | 45 |
46 // static | 46 // static |
47 scoped_ptr<FullWallet> | 47 std::unique_ptr<FullWallet> FullWallet::CreateFullWalletFromClearText( |
48 FullWallet::CreateFullWalletFromClearText( | 48 int expiration_month, |
49 int expiration_month, | 49 int expiration_year, |
50 int expiration_year, | 50 const std::string& pan, |
51 const std::string& pan, | 51 const std::string& cvn, |
52 const std::string& cvn, | 52 std::unique_ptr<Address> billing_address, |
53 scoped_ptr<Address> billing_address, | 53 std::unique_ptr<Address> shipping_address) { |
54 scoped_ptr<Address> shipping_address) { | |
55 DCHECK(billing_address); | 54 DCHECK(billing_address); |
56 DCHECK(!pan.empty()); | 55 DCHECK(!pan.empty()); |
57 DCHECK(!cvn.empty()); | 56 DCHECK(!cvn.empty()); |
58 | 57 |
59 scoped_ptr<FullWallet> wallet(new FullWallet( | 58 std::unique_ptr<FullWallet> wallet(new FullWallet( |
60 expiration_month, expiration_year, | 59 expiration_month, expiration_year, |
61 std::string(), // no iin -- clear text pan/cvn are set below. | 60 std::string(), // no iin -- clear text pan/cvn are set below. |
62 std::string(), // no encrypted_rest -- clear text pan/cvn are set below. | 61 std::string(), // no encrypted_rest -- clear text pan/cvn are set below. |
63 std::move(billing_address), std::move(shipping_address))); | 62 std::move(billing_address), std::move(shipping_address))); |
64 wallet->pan_ = pan; | 63 wallet->pan_ = pan; |
65 wallet->cvn_ = cvn; | 64 wallet->cvn_ = cvn; |
66 return wallet; | 65 return wallet; |
67 } | 66 } |
68 | 67 |
69 base::string16 FullWallet::GetInfo(const std::string& app_locale, | 68 base::string16 FullWallet::GetInfo(const std::string& app_locale, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 225 } |
227 | 226 |
228 const std::string& FullWallet::GetCvn() { | 227 const std::string& FullWallet::GetCvn() { |
229 if (cvn_.empty()) | 228 if (cvn_.empty()) |
230 DecryptCardInfo(); | 229 DecryptCardInfo(); |
231 return cvn_; | 230 return cvn_; |
232 } | 231 } |
233 | 232 |
234 } // namespace wallet | 233 } // namespace wallet |
235 } // namespace autofill | 234 } // namespace autofill |
OLD | NEW |