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

Side by Side Diff: components/autofill/browser/autocheckout_request_manager.h

Issue 12457033: Implements SendAutocheckoutStatus API calls for stats tracking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaning up Created 7 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_REQUEST_MANAGER_H_
6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_REQUEST_MANAGER_H_
7
8 #include "base/supports_user_data.h"
9 #include "components/autofill/browser/autofill_metrics.h"
10 #include "components/autofill/browser/wallet/wallet_client.h"
11 #include "components/autofill/browser/wallet/wallet_client_delegate.h"
12 #include "components/autofill/common/autocheckout_status.h"
13 #include "googleurl/src/gurl.h"
14
15 namespace content {
16 class BrowserContext;
17 }
18
19 namespace net {
20 class URLRequestContextGetter;
21 }
22
23 namespace autofill {
24
25 // AutocheckoutRequestManager's only responsiblity is to make sure any
26 // SendAutocheckoutStatus calls succeed regardless of any actions the user may
27 // make in the browser i.e. closing a tab, the requestAutocomplete dialog, etc.
28 // To that end, it is a piece of user data tied to the BrowserContext.
29 class AutocheckoutRequestManager : public base::SupportsUserData::Data,
30 public wallet::WalletClientDelegate {
31 public:
32 ~AutocheckoutRequestManager();
33
34 static void CreateFromBrowserContext(
35 content::BrowserContext* browser_context);
36 static AutocheckoutRequestManager* FromBrowserContext(
37 content::BrowserContext* browser_context);
Ilya Sherman 2013/03/26 23:50:01 nit: Docs
ahutter 2013/03/27 01:23:33 Done.
38
39 // Sends the |status| of an Autocheckout flow to Online Wallet using
40 // |wallet_client_|.
41 void SendAutocheckoutStatus(AutocheckoutStatus status,
42 const GURL& source_url,
43 const std::string& google_transaction_id);
44
45 // wallet::WalletClientDelegate:
46 virtual const AutofillMetrics& GetMetricLogger() const OVERRIDE;
47 virtual DialogType GetDialogType() const OVERRIDE;
48 virtual std::string GetRiskData() const OVERRIDE;
49 virtual void OnDidAcceptLegalDocuments() OVERRIDE;
50 virtual void OnDidAuthenticateInstrument(bool success) OVERRIDE;
51 virtual void OnDidGetFullWallet(
52 scoped_ptr<wallet::FullWallet> full_wallet) OVERRIDE;
53 virtual void OnDidGetWalletItems(
54 scoped_ptr<wallet::WalletItems> wallet_items) OVERRIDE;
55 virtual void OnDidSaveAddress(
56 const std::string& address_id,
57 const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
58 virtual void OnDidSaveInstrument(
59 const std::string& instrument_id,
60 const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
61 virtual void OnDidSaveInstrumentAndAddress(
62 const std::string& instrument_id,
63 const std::string& address_id,
64 const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
65 virtual void OnDidSendAutocheckoutStatus() OVERRIDE;
66 virtual void OnDidUpdateAddress(
67 const std::string& address_id,
68 const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
69 virtual void OnDidUpdateInstrument(
70 const std::string& instrument_id,
71 const std::vector<wallet::RequiredAction>& required_actions) OVERRIDE;
72 virtual void OnWalletError(
73 wallet::WalletClient::ErrorType error_type) OVERRIDE;
74 virtual void OnMalformedResponse() OVERRIDE;
75 virtual void OnNetworkError(int response_code) OVERRIDE;
76
77 private:
78 // |request_context_getter| is passed in to construct |wallet_client_|.
79 AutocheckoutRequestManager(
80 net::URLRequestContextGetter* request_context_getter);
81
82 // Logs various UMA metrics.
83 AutofillMetrics metric_logger_;
84
85 // Makes requests to Online Wallet. The only request this class is configured
86 // to make is SendAutocheckoutStatus.
87 wallet::WalletClient wallet_client_;
88
89 DISALLOW_COPY_AND_ASSIGN(AutocheckoutRequestManager);
90 };
91
92 } // namespace autofill
93
94 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_REQUEST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698