| 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 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 std::string google_transaction_id; | 123 std::string google_transaction_id; |
| 124 | 124 |
| 125 // The Risk challenges supported by the user of WalletClient | 125 // The Risk challenges supported by the user of WalletClient |
| 126 std::vector<RiskCapability> risk_capabilities; | 126 std::vector<RiskCapability> risk_capabilities; |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 DISALLOW_ASSIGN(FullWalletRequest); | 129 DISALLOW_ASSIGN(FullWalletRequest); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 // |context_getter| is reference counted so it has no lifetime or ownership | 132 // |context_getter| is reference counted so it has no lifetime or ownership |
| 133 // requirements. |observer| must outlive |this|. | 133 // requirements. |delegate| must outlive |this|. |
| 134 WalletClient(net::URLRequestContextGetter* context_getter, | 134 WalletClient(net::URLRequestContextGetter* context_getter, |
| 135 WalletClientDelegate* delegate); | 135 WalletClientDelegate* delegate); |
| 136 | 136 |
| 137 virtual ~WalletClient(); | 137 virtual ~WalletClient(); |
| 138 | 138 |
| 139 // GetWalletItems retrieves the user's online wallet. The WalletItems | 139 // GetWalletItems retrieves the user's online wallet. The WalletItems |
| 140 // returned may require additional action such as presenting legal documents | 140 // returned may require additional action such as presenting legal documents |
| 141 // to the user to be accepted. |risk_capabilities| are the Risk challenges | 141 // to the user to be accepted. |risk_capabilities| are the Risk challenges |
| 142 // supported by the users of WalletClient. | 142 // supported by the users of WalletClient. |
| 143 void GetWalletItems(const GURL& source_url, | 143 void GetWalletItems(const GURL& source_url, |
| 144 const std::vector<RiskCapability>& risk_capabilities); | 144 const std::vector<RiskCapability>& risk_capabilities); |
| 145 | 145 |
| 146 // The GetWalletItems call to the Online Wallet backend may require the user | 146 // The GetWalletItems call to the Online Wallet backend may require the user |
| 147 // to accept various legal documents before a FullWallet can be generated. | 147 // to accept various legal documents before a FullWallet can be generated. |
| 148 // The |google_transaction_id| is provided in the response to the | 148 // The |google_transaction_id| is provided in the response to the |
| 149 // GetWalletItems call. | 149 // GetWalletItems call. |
| 150 virtual void AcceptLegalDocuments( | 150 virtual void AcceptLegalDocuments( |
| 151 const std::vector<WalletItems::LegalDocument*>& documents, | 151 const std::vector<WalletItems::LegalDocument*>& documents, |
| 152 const std::string& google_transaction_id, | 152 const std::string& google_transaction_id, |
| 153 const GURL& source_url); | 153 const GURL& source_url); |
| 154 | 154 |
| 155 // Authenticates that |card_verification_number| is for the backing instrument | 155 // Authenticates that |card_verification_number| is for the backing instrument |
| 156 // with |instrument_id|. |obfuscated_gaia_id| is used as a key when escrowing | 156 // with |instrument_id|. |obfuscated_gaia_id| is used as a key when escrowing |
| 157 // |card_verification_number|. |observer| is notified when the request is | 157 // |card_verification_number|. |delegate_| is notified when the request is |
| 158 // complete. Used to respond to Risk challenges. | 158 // complete. Used to respond to Risk challenges. |
| 159 void AuthenticateInstrument(const std::string& instrument_id, | 159 virtual void AuthenticateInstrument( |
| 160 const std::string& card_verification_number, | 160 const std::string& instrument_id, |
| 161 const std::string& obfuscated_gaia_id); | 161 const std::string& card_verification_number, |
| 162 const std::string& obfuscated_gaia_id); |
| 162 | 163 |
| 163 // GetFullWallet retrieves the a FullWallet for the user. | 164 // GetFullWallet retrieves the a FullWallet for the user. |
| 164 virtual void GetFullWallet(const FullWalletRequest& full_wallet_request); | 165 virtual void GetFullWallet(const FullWalletRequest& full_wallet_request); |
| 165 | 166 |
| 166 // SaveAddress saves a new shipping address. | 167 // SaveAddress saves a new shipping address. |
| 167 virtual void SaveAddress(const Address& address, const GURL& source_url); | 168 virtual void SaveAddress(const Address& address, const GURL& source_url); |
| 168 | 169 |
| 169 // SaveInstrument saves a new instrument. | 170 // SaveInstrument saves a new instrument. |
| 170 virtual void SaveInstrument(const Instrument& instrument, | 171 virtual void SaveInstrument(const Instrument& instrument, |
| 171 const std::string& obfuscated_gaia_id, | 172 const std::string& obfuscated_gaia_id, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 UPDATE_ADDRESS, | 222 UPDATE_ADDRESS, |
| 222 UPDATE_INSTRUMENT, | 223 UPDATE_INSTRUMENT, |
| 223 }; | 224 }; |
| 224 | 225 |
| 225 // Like AcceptLegalDocuments, but takes a vector of document ids. | 226 // Like AcceptLegalDocuments, but takes a vector of document ids. |
| 226 void DoAcceptLegalDocuments( | 227 void DoAcceptLegalDocuments( |
| 227 const std::vector<std::string>& document_ids, | 228 const std::vector<std::string>& document_ids, |
| 228 const std::string& google_transaction_id, | 229 const std::string& google_transaction_id, |
| 229 const GURL& source_url); | 230 const GURL& source_url); |
| 230 | 231 |
| 231 // Posts |post_body| to |url| and notifies |observer| when the request is | 232 // Posts |post_body| to |url| and notifies |delegate_| when the request is |
| 232 // complete. | 233 // complete. |
| 233 void MakeWalletRequest(const GURL& url, const std::string& post_body); | 234 void MakeWalletRequest(const GURL& url, const std::string& post_body); |
| 234 | 235 |
| 235 // Performs bookkeeping tasks for any invalid requests. | 236 // Performs bookkeeping tasks for any invalid requests. |
| 236 void HandleMalformedResponse(); | 237 void HandleMalformedResponse(); |
| 237 void HandleNetworkError(int response_code); | 238 void HandleNetworkError(int response_code); |
| 238 void HandleWalletError(ErrorType error_type); | 239 void HandleWalletError(ErrorType error_type); |
| 239 | 240 |
| 240 // Start the next pending request (if any). | 241 // Start the next pending request (if any). |
| 241 void StartNextPendingRequest(); | 242 void StartNextPendingRequest(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // Wallet. | 290 // Wallet. |
| 290 EncryptionEscrowClient encryption_escrow_client_; | 291 EncryptionEscrowClient encryption_escrow_client_; |
| 291 | 292 |
| 292 DISALLOW_COPY_AND_ASSIGN(WalletClient); | 293 DISALLOW_COPY_AND_ASSIGN(WalletClient); |
| 293 }; | 294 }; |
| 294 | 295 |
| 295 } // namespace wallet | 296 } // namespace wallet |
| 296 } // namespace autofill | 297 } // namespace autofill |
| 297 | 298 |
| 298 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_H_ | 299 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_CLIENT_H_ |
| OLD | NEW |