Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: components/autofill/content/browser/wallet/wallet_client.h

Issue 23033016: Remove autocheckout code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Even more deletes, and Ilya review. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 11
12 #include "base/callback.h" // For base::Closure. 12 #include "base/callback.h" // For base::Closure.
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "components/autofill/content/browser/autocheckout_statistic.h"
18 #include "components/autofill/content/browser/wallet/full_wallet.h" 17 #include "components/autofill/content/browser/wallet/full_wallet.h"
19 #include "components/autofill/content/browser/wallet/wallet_items.h" 18 #include "components/autofill/content/browser/wallet/wallet_items.h"
20 #include "components/autofill/core/browser/autofill_manager_delegate.h" 19 #include "components/autofill/core/browser/autofill_manager_delegate.h"
21 #include "components/autofill/core/browser/autofill_metrics.h" 20 #include "components/autofill/core/browser/autofill_metrics.h"
22 #include "components/autofill/core/common/autocheckout_status.h"
23 #include "net/url_request/url_fetcher_delegate.h" 21 #include "net/url_request/url_fetcher_delegate.h"
24 #include "testing/gtest/include/gtest/gtest_prod.h" 22 #include "testing/gtest/include/gtest/gtest_prod.h"
25 #include "url/gurl.h" 23 #include "url/gurl.h"
26 24
27 namespace net { 25 namespace net {
28 class URLFetcher; 26 class URLFetcher;
29 class URLRequestContextGetter; 27 class URLRequestContextGetter;
30 } 28 }
31 29
32 namespace autofill { 30 namespace autofill {
(...skipping 16 matching lines...) Expand all
49 // a) If they choose an instrument with a zip code only address, the billing 47 // a) If they choose an instrument with a zip code only address, the billing
50 // address will need to be updated using SaveToWallet. 48 // address will need to be updated using SaveToWallet.
51 // b) The user may also choose to add a new instrument or address using 49 // b) The user may also choose to add a new instrument or address using
52 // SaveToWallet. 50 // SaveToWallet.
53 // 3) Once the user has selected the backing instrument and shipping address 51 // 3) Once the user has selected the backing instrument and shipping address
54 // for this transaction, a FullWallet with the fronting card is generated 52 // for this transaction, a FullWallet with the fronting card is generated
55 // using GetFullWallet. 53 // using GetFullWallet.
56 // a) GetFullWallet may return a Risk challenge for the user. In that case, 54 // a) GetFullWallet may return a Risk challenge for the user. In that case,
57 // the user will need to verify who they are by authenticating their 55 // the user will need to verify who they are by authenticating their
58 // chosen backing instrument through AuthenticateInstrument 56 // chosen backing instrument through AuthenticateInstrument
59 // 4) If the user initiated Autocheckout, SendAutocheckoutStatus to notify
60 // Online Wallet of the status flow to record various metrics.
61 // 57 //
62 // WalletClient is designed so only one request to Online Wallet can be outgoing 58 // WalletClient is designed so only one request to Online Wallet can be outgoing
63 // at any one time. If |HasRequestInProgress()| is true while calling e.g. 59 // at any one time. If |HasRequestInProgress()| is true while calling e.g.
64 // GetWalletItems(), the request will be queued and started later. Queued 60 // GetWalletItems(), the request will be queued and started later. Queued
65 // requests start in the order they were received. 61 // requests start in the order they were received.
66 62
67 class WalletClient : public net::URLFetcherDelegate { 63 class WalletClient : public net::URLFetcherDelegate {
68 public: 64 public:
69 // The Risk challenges supported by users of WalletClient. 65 // The Risk challenges supported by users of WalletClient.
70 enum RiskCapability { 66 enum RiskCapability {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // GetFullWallet retrieves the a FullWallet for the user. 167 // GetFullWallet retrieves the a FullWallet for the user.
172 virtual void GetFullWallet(const FullWalletRequest& full_wallet_request); 168 virtual void GetFullWallet(const FullWalletRequest& full_wallet_request);
173 169
174 // Saves the data in |instrument| and/or |address| to Wallet. |instrument| 170 // Saves the data in |instrument| and/or |address| to Wallet. |instrument|
175 // does not have to be complete if its being used to update an existing 171 // does not have to be complete if its being used to update an existing
176 // instrument, like in the case of expiration date or address only updates. 172 // instrument, like in the case of expiration date or address only updates.
177 virtual void SaveToWallet(scoped_ptr<Instrument> instrument, 173 virtual void SaveToWallet(scoped_ptr<Instrument> instrument,
178 scoped_ptr<Address> address, 174 scoped_ptr<Address> address,
179 const GURL& source_url); 175 const GURL& source_url);
180 176
181 // SendAutocheckoutStatus is used for tracking the success of Autocheckout
182 // flows. |status| is the result of the flow, |source_url| is the domain
183 // where the purchase occured, and |google_transaction_id| is the same as the
184 // one provided by GetWalletItems. |latency_statistics| contain statistics
185 // required to measure Autocheckout process.
186 virtual void SendAutocheckoutStatus(
187 autofill::AutocheckoutStatus status,
188 const GURL& source_url,
189 const std::vector<AutocheckoutStatistic>& latency_statistics,
190 const std::string& google_transaction_id);
191
192 bool HasRequestInProgress() const; 177 bool HasRequestInProgress() const;
193 178
194 // Cancels and clears the current |request_| and |pending_requests_| (if any). 179 // Cancels and clears the current |request_| and |pending_requests_| (if any).
195 void CancelRequests(); 180 void CancelRequests();
196 181
197 private: 182 private:
198 FRIEND_TEST_ALL_PREFIXES(WalletClientTest, PendingRequest); 183 FRIEND_TEST_ALL_PREFIXES(WalletClientTest, PendingRequest);
199 FRIEND_TEST_ALL_PREFIXES(WalletClientTest, CancelRequests); 184 FRIEND_TEST_ALL_PREFIXES(WalletClientTest, CancelRequests);
200 185
201 enum RequestType { 186 enum RequestType {
202 NO_PENDING_REQUEST, 187 NO_PENDING_REQUEST,
203 ACCEPT_LEGAL_DOCUMENTS, 188 ACCEPT_LEGAL_DOCUMENTS,
204 AUTHENTICATE_INSTRUMENT, 189 AUTHENTICATE_INSTRUMENT,
205 GET_FULL_WALLET, 190 GET_FULL_WALLET,
206 GET_WALLET_ITEMS, 191 GET_WALLET_ITEMS,
207 SAVE_TO_WALLET, 192 SAVE_TO_WALLET,
208 SEND_STATUS,
209 }; 193 };
210 194
211 // Like AcceptLegalDocuments, but takes a vector of document ids. 195 // Like AcceptLegalDocuments, but takes a vector of document ids.
212 void DoAcceptLegalDocuments( 196 void DoAcceptLegalDocuments(
213 const std::vector<std::string>& document_ids, 197 const std::vector<std::string>& document_ids,
214 const std::string& google_transaction_id, 198 const std::string& google_transaction_id,
215 const GURL& source_url); 199 const GURL& source_url);
216 200
217 // Posts |post_body| to |url| with content type |mime_type| and notifies 201 // Posts |post_body| to |url| with content type |mime_type| and notifies
218 // |delegate_| when the request is complete. 202 // |delegate_| when the request is complete.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 249
266 base::WeakPtrFactory<WalletClient> weak_ptr_factory_; 250 base::WeakPtrFactory<WalletClient> weak_ptr_factory_;
267 251
268 DISALLOW_COPY_AND_ASSIGN(WalletClient); 252 DISALLOW_COPY_AND_ASSIGN(WalletClient);
269 }; 253 };
270 254
271 } // namespace wallet 255 } // namespace wallet
272 } // namespace autofill 256 } // namespace autofill
273 257
274 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_CLIENT_H_ 258 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698