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

Side by Side Diff: components/autofill/content/browser/autocheckout_manager.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
(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_CONTENT_BROWSER_AUTOCHECKOUT_MANAGER_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOCHECKOUT_MANAGER_H_
7
8 #include <string>
9
10 #include "base/callback_forward.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/strings/string16.h"
14 #include "base/threading/thread_checker.h"
15 #include "base/time/time.h"
16 #include "components/autofill/content/browser/autocheckout_page_meta_data.h"
17 #include "components/autofill/content/browser/autocheckout_statistic.h"
18 #include "components/autofill/core/browser/autocheckout_bubble_state.h"
19 #include "components/autofill/core/common/autocheckout_status.h"
20
21 class GURL;
22
23 namespace gfx {
24 class RectF;
25 }
26
27 namespace net {
28 class URLRequestContextGetter;
29 }
30
31 namespace autofill {
32
33 class AutofillField;
34 class AutofillManager;
35 class AutofillMetrics;
36 class AutofillProfile;
37 class CreditCard;
38 class FormStructure;
39
40 struct FormData;
41 struct FormFieldData;
42
43 class AutocheckoutManager {
44 public:
45 explicit AutocheckoutManager(AutofillManager* autofill_manager);
46 virtual ~AutocheckoutManager();
47
48 // Fill all the forms seen by the Autofill manager with the information
49 // gathered from the requestAutocomplete dialog.
50 void FillForms();
51
52 // Called to signal that the renderer has completed processing a page in the
53 // Autocheckout flow. |status| is the reason for the failure, or |SUCCESS| if
54 // there were no errors.
55 void OnAutocheckoutPageCompleted(AutocheckoutStatus status);
56
57 // Sets |page_meta_data_| with the meta data for the current page.
58 void OnLoadedPageMetaData(
59 scoped_ptr<AutocheckoutPageMetaData> page_meta_data);
60
61 // Called when a page containing forms is loaded.
62 void OnFormsSeen();
63
64 // Whether ajax on the current page should be ignored during
65 // an Autocheckout flow.
66 bool ShouldIgnoreAjax();
67
68 // Causes the Autocheckout bubble to be displayed if the user hasn't seen it
69 // yet for the current page. |frame_url| is the page where Autocheckout is
70 // being initiated. |bounding_box| is the bounding box of the input field in
71 // focus.
72 virtual void MaybeShowAutocheckoutBubble(const GURL& frame_url,
73 const gfx::RectF& bounding_box);
74
75 // Determine whether we should keep the dialog visible.
76 bool should_preserve_dialog() const { return should_preserve_dialog_; }
77
78 void set_should_show_bubble(bool should_show_bubble) {
79 should_show_bubble_ = should_show_bubble;
80 }
81
82 bool is_autocheckout_bubble_showing() const {
83 return is_autocheckout_bubble_showing_;
84 }
85
86 protected:
87 // Exposed for testing.
88 bool in_autocheckout_flow() const { return in_autocheckout_flow_; }
89
90 // Exposed for testing.
91 bool should_show_bubble() const { return should_show_bubble_; }
92
93 // Show the requestAutocomplete dialog if |state| is
94 // AUTOCHECKOUT_BUBBLE_ACCEPTED. Also, does bookkeeping for whether or not
95 // the bubble is showing.
96 virtual void MaybeShowAutocheckoutDialog(const GURL& frame_url,
97 AutocheckoutBubbleState state);
98
99 // Callback called from AutofillDialogController on filling up the UI form.
100 void ReturnAutocheckoutData(const FormStructure* result,
101 const std::string& google_transaction_id);
102
103 const AutofillMetrics& metric_logger() const { return *metric_logger_; }
104 void set_metric_logger(scoped_ptr<AutofillMetrics> metric_logger);
105
106 private:
107 // Shows the Autocheckout bubble. Must be called on the UI thread. |frame_url|
108 // is the page where Autocheckout is being initiated. |bounding_box| is the
109 // bounding box of the input field in focus. |cookies| is any Google Account
110 // cookies.
111 void ShowAutocheckoutBubble(const GURL& frame_url,
112 const gfx::RectF& bounding_box,
113 const std::string& cookies);
114
115 // Whether or not the current page is the start of a multipage Autofill flow.
116 bool IsStartOfAutofillableFlow() const;
117
118 // Whether or not the current page is part of a multipage Autofill flow.
119 bool IsInAutofillableFlow() const;
120
121 // Sends |status| to Online Wallet using AutocheckoutRequestManager.
122 void SendAutocheckoutStatus(AutocheckoutStatus status);
123
124 // Sets value of form field data |field_to_fill| based on the Autofill
125 // field type specified by |field|.
126 void SetValue(const AutofillField& field, FormFieldData* field_to_fill);
127
128 // Sets the progress of all steps for the given page to the provided value.
129 void SetStepProgressForPage(int page_number, AutocheckoutStepStatus status);
130
131 // Account time spent between now and |last_step_completion_timestamp_|
132 // towards |page_number|.
133 void RecordTimeTaken(int page_number);
134
135 // Terminate the Autocheckout flow and send Autocheckout status to Wallet
136 // server.
137 void EndAutocheckout(AutocheckoutStatus status);
138
139 AutofillManager* autofill_manager_; // WEAK; owns us
140
141 // Credit card verification code.
142 base::string16 cvv_;
143
144 // Profile built using the data supplied by requestAutocomplete dialog.
145 scoped_ptr<AutofillProfile> profile_;
146
147 // Credit card built using the data supplied by requestAutocomplete dialog.
148 scoped_ptr<CreditCard> credit_card_;
149
150 // Billing address built using data supplied by requestAutocomplete dialog.
151 scoped_ptr<AutofillProfile> billing_address_;
152
153 // Autocheckout specific page meta data of current page.
154 scoped_ptr<AutocheckoutPageMetaData> page_meta_data_;
155
156 scoped_ptr<AutofillMetrics> metric_logger_;
157
158 // Whether or not the Autocheckout bubble should be shown to user.
159 bool should_show_bubble_;
160
161 // Whether or not the Autocheckout bubble is being displayed to the user.
162 bool is_autocheckout_bubble_showing_;
163
164 // Whether or not the user is in an Autocheckout flow.
165 bool in_autocheckout_flow_;
166
167 // Whether or not the currently visible dialog, if there is one, should be
168 // preserved.
169 bool should_preserve_dialog_;
170
171 // AutocheckoutStepTypes for the various pages of the flow.
172 std::map<int, std::vector<AutocheckoutStepType> > page_types_;
173
174 // Timestamp of last step's completion.
175 base::TimeTicks last_step_completion_timestamp_;
176
177 // Per page latency statistics.
178 std::vector<AutocheckoutStatistic> latency_statistics_;
179
180 std::string google_transaction_id_;
181
182 base::WeakPtrFactory<AutocheckoutManager> weak_ptr_factory_;
183
184 base::ThreadChecker thread_checker_;
185
186 DISALLOW_COPY_AND_ASSIGN(AutocheckoutManager);
187 };
188
189 } // namespace autofill
190
191 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOCHECKOUT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698