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

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: Created 7 years, 4 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // GetFullWallet retrieves the a FullWallet for the user. 163 // GetFullWallet retrieves the a FullWallet for the user.
168 virtual void GetFullWallet(const FullWalletRequest& full_wallet_request); 164 virtual void GetFullWallet(const FullWalletRequest& full_wallet_request);
169 165
170 // Saves the data in |instrument| and/or |address| to Wallet. |instrument| 166 // Saves the data in |instrument| and/or |address| to Wallet. |instrument|
171 // does not have to be complete if its being used to update an existing 167 // does not have to be complete if its being used to update an existing
172 // instrument, like in the case of expiration date or address only updates. 168 // instrument, like in the case of expiration date or address only updates.
173 virtual void SaveToWallet(scoped_ptr<Instrument> instrument, 169 virtual void SaveToWallet(scoped_ptr<Instrument> instrument,
174 scoped_ptr<Address> address, 170 scoped_ptr<Address> address,
175 const GURL& source_url); 171 const GURL& source_url);
176 172
177 // SendAutocheckoutStatus is used for tracking the success of Autocheckout
178 // flows. |status| is the result of the flow, |source_url| is the domain
179 // where the purchase occured, and |google_transaction_id| is the same as the
180 // one provided by GetWalletItems. |latency_statistics| contain statistics
181 // required to measure Autocheckout process.
182 virtual void SendAutocheckoutStatus(
183 autofill::AutocheckoutStatus status,
184 const GURL& source_url,
185 const std::vector<AutocheckoutStatistic>& latency_statistics,
186 const std::string& google_transaction_id);
187
188 bool HasRequestInProgress() const; 173 bool HasRequestInProgress() const;
189 174
190 // Cancels and clears the current |request_| and |pending_requests_| (if any). 175 // Cancels and clears the current |request_| and |pending_requests_| (if any).
191 void CancelRequests(); 176 void CancelRequests();
192 177
193 private: 178 private:
194 FRIEND_TEST_ALL_PREFIXES(WalletClientTest, PendingRequest); 179 FRIEND_TEST_ALL_PREFIXES(WalletClientTest, PendingRequest);
195 FRIEND_TEST_ALL_PREFIXES(WalletClientTest, CancelRequests); 180 FRIEND_TEST_ALL_PREFIXES(WalletClientTest, CancelRequests);
196 181
197 enum RequestType { 182 enum RequestType {
198 NO_PENDING_REQUEST, 183 NO_PENDING_REQUEST,
199 ACCEPT_LEGAL_DOCUMENTS, 184 ACCEPT_LEGAL_DOCUMENTS,
200 AUTHENTICATE_INSTRUMENT, 185 AUTHENTICATE_INSTRUMENT,
201 GET_FULL_WALLET, 186 GET_FULL_WALLET,
202 GET_WALLET_ITEMS, 187 GET_WALLET_ITEMS,
203 SAVE_TO_WALLET, 188 SAVE_TO_WALLET,
204 SEND_STATUS,
205 }; 189 };
206 190
207 // Like AcceptLegalDocuments, but takes a vector of document ids. 191 // Like AcceptLegalDocuments, but takes a vector of document ids.
208 void DoAcceptLegalDocuments( 192 void DoAcceptLegalDocuments(
209 const std::vector<std::string>& document_ids, 193 const std::vector<std::string>& document_ids,
210 const std::string& google_transaction_id, 194 const std::string& google_transaction_id,
211 const GURL& source_url); 195 const GURL& source_url);
212 196
213 // Posts |post_body| to |url| with content type |mime_type| and notifies 197 // Posts |post_body| to |url| with content type |mime_type| and notifies
214 // |delegate_| when the request is complete. 198 // |delegate_| when the request is complete.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 245
262 base::WeakPtrFactory<WalletClient> weak_ptr_factory_; 246 base::WeakPtrFactory<WalletClient> weak_ptr_factory_;
263 247
264 DISALLOW_COPY_AND_ASSIGN(WalletClient); 248 DISALLOW_COPY_AND_ASSIGN(WalletClient);
265 }; 249 };
266 250
267 } // namespace wallet 251 } // namespace wallet
268 } // namespace autofill 252 } // namespace autofill
269 253
270 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_CLIENT_H_ 254 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698