| 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 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ |
| 6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // - a proxy card for the backing card selected from a user's wallet items | 34 // - a proxy card for the backing card selected from a user's wallet items |
| 35 class FullWallet { | 35 class FullWallet { |
| 36 public: | 36 public: |
| 37 ~FullWallet(); | 37 ~FullWallet(); |
| 38 | 38 |
| 39 // Returns an empty scoped_ptr if the input invalid, an empty wallet with | 39 // Returns an empty scoped_ptr if the input invalid, an empty wallet with |
| 40 // required actions if there are any, or a valid wallet. | 40 // required actions if there are any, or a valid wallet. |
| 41 static scoped_ptr<FullWallet> | 41 static scoped_ptr<FullWallet> |
| 42 CreateFullWallet(const base::DictionaryValue& dictionary); | 42 CreateFullWallet(const base::DictionaryValue& dictionary); |
| 43 | 43 |
| 44 // Returns a wallet built from the provided clear-text data. |
| 45 // Data is not validated; |pan|, |cvn| and |billing_address| must be set. |
| 46 static scoped_ptr<FullWallet> |
| 47 CreateFullWalletFromClearText(int expiration_month, |
| 48 int expiration_year, |
| 49 const std::string& pan, |
| 50 const std::string& cvn, |
| 51 scoped_ptr<Address> billing_address, |
| 52 scoped_ptr<Address> shipping_address); |
| 53 |
| 44 // Returns corresponding data for |type|. | 54 // Returns corresponding data for |type|. |
| 45 base::string16 GetInfo(const AutofillType& type); | 55 base::string16 GetInfo(const AutofillType& type); |
| 46 | 56 |
| 47 // Whether or not |action| is in |required_actions_|. | 57 // Whether or not |action| is in |required_actions_|. |
| 48 bool HasRequiredAction(RequiredAction action) const; | 58 bool HasRequiredAction(RequiredAction action) const; |
| 49 | 59 |
| 50 // The type of the card that this FullWallet contains and the last four digits | 60 // The type of the card that this FullWallet contains and the last four digits |
| 51 // like this "Visa - 4111". | 61 // like this "Visa - 4111". |
| 52 base::string16 TypeAndLastFourDigits(); | 62 base::string16 TypeAndLastFourDigits(); |
| 53 | 63 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 73 | 83 |
| 74 private: | 84 private: |
| 75 friend class FullWalletTest; | 85 friend class FullWalletTest; |
| 76 friend scoped_ptr<FullWallet> GetTestFullWallet(); | 86 friend scoped_ptr<FullWallet> GetTestFullWallet(); |
| 77 friend scoped_ptr<FullWallet> GetTestFullWalletInstrumentOnly(); | 87 friend scoped_ptr<FullWallet> GetTestFullWalletInstrumentOnly(); |
| 78 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet); | 88 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet); |
| 79 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWalletWithRequiredActions); | 89 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWalletWithRequiredActions); |
| 80 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthCorrectDecryptionTest); | 90 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthCorrectDecryptionTest); |
| 81 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthUnderDecryptionTest); | 91 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthUnderDecryptionTest); |
| 82 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, GetCreditCardInfo); | 92 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, GetCreditCardInfo); |
| 93 |
| 83 FullWallet(int expiration_month, | 94 FullWallet(int expiration_month, |
| 84 int expiration_year, | 95 int expiration_year, |
| 85 const std::string& iin, | 96 const std::string& iin, |
| 86 const std::string& encrypted_rest, | 97 const std::string& encrypted_rest, |
| 87 scoped_ptr<Address> billing_address, | 98 scoped_ptr<Address> billing_address, |
| 88 scoped_ptr<Address> shipping_address, | 99 scoped_ptr<Address> shipping_address, |
| 89 const std::vector<RequiredAction>& required_actions); | 100 const std::vector<RequiredAction>& required_actions); |
| 90 | 101 |
| 91 // Decrypts both |pan_| and |cvn_|. | 102 // Decrypts both |pan_| and |cvn_|. |
| 92 void DecryptCardInfo(); | 103 void DecryptCardInfo(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // The one time pad used for FullWallet encryption. | 141 // The one time pad used for FullWallet encryption. |
| 131 std::vector<uint8> one_time_pad_; | 142 std::vector<uint8> one_time_pad_; |
| 132 | 143 |
| 133 DISALLOW_COPY_AND_ASSIGN(FullWallet); | 144 DISALLOW_COPY_AND_ASSIGN(FullWallet); |
| 134 }; | 145 }; |
| 135 | 146 |
| 136 } // namespace wallet | 147 } // namespace wallet |
| 137 } // namespace autofill | 148 } // namespace autofill |
| 138 | 149 |
| 139 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ | 150 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ |
| OLD | NEW |