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_WALLET_CLIENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_CLIENT_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_CLIENT_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // |card_verification_number|. |delegate_| is notified when the request is | 158 // |card_verification_number|. |delegate_| is notified when the request is |
159 // complete. Used to respond to Risk challenges. | 159 // complete. Used to respond to Risk challenges. |
160 virtual void AuthenticateInstrument( | 160 virtual void AuthenticateInstrument( |
161 const std::string& instrument_id, | 161 const std::string& instrument_id, |
162 const std::string& card_verification_number); | 162 const std::string& card_verification_number); |
163 | 163 |
164 // GetFullWallet retrieves the a FullWallet for the user. | 164 // GetFullWallet retrieves the a FullWallet for the user. |
165 virtual void GetFullWallet(const FullWalletRequest& full_wallet_request); | 165 virtual void GetFullWallet(const FullWalletRequest& full_wallet_request); |
166 | 166 |
167 // Saves the data in |instrument| and/or |address| to Wallet. |instrument| | 167 // Saves the data in |instrument| and/or |address| to Wallet. |instrument| |
168 // does not have to be complete if its being used to update an existing | 168 // does not have to be complete if it's being used to update an existing |
169 // instrument, like in the case of expiration date or address only updates. | 169 // instrument, like in the case of expiration date or address only updates. |
170 virtual void SaveToWallet(scoped_ptr<Instrument> instrument, | 170 // |reference_instrument| and |reference_address| are the original instrument |
171 scoped_ptr<Address> address); | 171 // and address to be updated on the server (and should be NULL if |instrument| |
| 172 // or |address| are new data). |
| 173 virtual void SaveToWallet( |
| 174 scoped_ptr<Instrument> instrument, |
| 175 scoped_ptr<Address> address, |
| 176 const WalletItems::MaskedInstrument* reference_instrument, |
| 177 const Address* reference_address); |
172 | 178 |
173 bool HasRequestInProgress() const; | 179 bool HasRequestInProgress() const; |
174 | 180 |
175 // Cancels and clears the current |request_| and |pending_requests_| (if any). | 181 // Cancels and clears the current |request_| and |pending_requests_| (if any). |
176 void CancelRequests(); | 182 void CancelRequests(); |
177 | 183 |
178 size_t user_index() const { return user_index_; } | 184 size_t user_index() const { return user_index_; } |
179 void set_user_index(size_t user_index) { | 185 void set_user_index(size_t user_index) { |
180 user_index_ = user_index; | 186 user_index_ = user_index; |
181 } | 187 } |
(...skipping 13 matching lines...) Expand all Loading... |
195 | 201 |
196 // Like AcceptLegalDocuments, but takes a vector of document ids. | 202 // Like AcceptLegalDocuments, but takes a vector of document ids. |
197 void DoAcceptLegalDocuments( | 203 void DoAcceptLegalDocuments( |
198 const std::vector<std::string>& document_ids, | 204 const std::vector<std::string>& document_ids, |
199 const std::string& google_transaction_id); | 205 const std::string& google_transaction_id); |
200 | 206 |
201 // Posts |post_body| to |url| with content type |mime_type| and notifies | 207 // Posts |post_body| to |url| with content type |mime_type| and notifies |
202 // |delegate_| when the request is complete. | 208 // |delegate_| when the request is complete. |
203 void MakeWalletRequest(const GURL& url, | 209 void MakeWalletRequest(const GURL& url, |
204 const std::string& post_body, | 210 const std::string& post_body, |
205 const std::string& mime_type); | 211 const std::string& mime_type, |
| 212 RequestType request_type); |
206 | 213 |
207 // Performs bookkeeping tasks for any invalid requests. | 214 // Performs bookkeeping tasks for any invalid requests. |
208 void HandleMalformedResponse(RequestType request_type, | 215 void HandleMalformedResponse(RequestType request_type, |
209 net::URLFetcher* request); | 216 net::URLFetcher* request); |
210 void HandleNetworkError(int response_code); | 217 void HandleNetworkError(int response_code); |
211 void HandleWalletError(ErrorType error_type); | 218 void HandleWalletError(ErrorType error_type); |
212 | 219 |
213 // Start the next pending request (if any). | 220 // Start the next pending request (if any). |
214 void StartNextPendingRequest(); | 221 void StartNextPendingRequest(); |
215 | 222 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 264 |
258 base::WeakPtrFactory<WalletClient> weak_ptr_factory_; | 265 base::WeakPtrFactory<WalletClient> weak_ptr_factory_; |
259 | 266 |
260 DISALLOW_COPY_AND_ASSIGN(WalletClient); | 267 DISALLOW_COPY_AND_ASSIGN(WalletClient); |
261 }; | 268 }; |
262 | 269 |
263 } // namespace wallet | 270 } // namespace wallet |
264 } // namespace autofill | 271 } // namespace autofill |
265 | 272 |
266 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_CLIENT_H_ | 273 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_CLIENT_H_ |
OLD | NEW |