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_AUTOCHECKOUT_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOCHECKOUT_MANAGER_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOCHECKOUT_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOCHECKOUT_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 class AutocheckoutManager { | 43 class AutocheckoutManager { |
44 public: | 44 public: |
45 explicit AutocheckoutManager(AutofillManager* autofill_manager); | 45 explicit AutocheckoutManager(AutofillManager* autofill_manager); |
46 virtual ~AutocheckoutManager(); | 46 virtual ~AutocheckoutManager(); |
47 | 47 |
48 // Fill all the forms seen by the Autofill manager with the information | 48 // Fill all the forms seen by the Autofill manager with the information |
49 // gathered from the requestAutocomplete dialog. | 49 // gathered from the requestAutocomplete dialog. |
50 void FillForms(); | 50 void FillForms(); |
51 | 51 |
52 // Called when clicking a proceed element in an Autocheckout flow fails. | 52 // Called to signal that the renderer has completed processing a page in the |
53 // |status| is the reason for the failure. | 53 // Autocheckout flow. |status| is the reason for the failure, or |SUCCESS| if |
54 void OnClickFailed(AutocheckoutStatus status); | 54 // there were no errors. |
| 55 void OnAutocheckoutPageCompleted(AutocheckoutStatus status); |
55 | 56 |
56 // Sets |page_meta_data_| with the meta data for the current page. | 57 // Sets |page_meta_data_| with the meta data for the current page. |
57 void OnLoadedPageMetaData( | 58 void OnLoadedPageMetaData( |
58 scoped_ptr<AutocheckoutPageMetaData> page_meta_data); | 59 scoped_ptr<AutocheckoutPageMetaData> page_meta_data); |
59 | 60 |
60 // Called when a page containing forms is loaded. | 61 // Called when a page containing forms is loaded. |
61 void OnFormsSeen(); | 62 void OnFormsSeen(); |
62 | 63 |
63 // Whether ajax on the current page should be ignored during | 64 // Whether ajax on the current page should be ignored during |
64 // an Autocheckout flow. | 65 // an Autocheckout flow. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // field type specified by |field|. | 122 // field type specified by |field|. |
122 void SetValue(const AutofillField& field, FormFieldData* field_to_fill); | 123 void SetValue(const AutofillField& field, FormFieldData* field_to_fill); |
123 | 124 |
124 // Sets the progress of all steps for the given page to the provided value. | 125 // Sets the progress of all steps for the given page to the provided value. |
125 void SetStepProgressForPage(int page_number, AutocheckoutStepStatus status); | 126 void SetStepProgressForPage(int page_number, AutocheckoutStepStatus status); |
126 | 127 |
127 // Account time spent between now and |last_step_completion_timestamp_| | 128 // Account time spent between now and |last_step_completion_timestamp_| |
128 // towards |page_number|. | 129 // towards |page_number|. |
129 void RecordTimeTaken(int page_number); | 130 void RecordTimeTaken(int page_number); |
130 | 131 |
| 132 // Terminate the Autocheckout flow and send Autocheckout status to Wallet |
| 133 // server. |
| 134 void EndAutocheckout(AutocheckoutStatus status); |
| 135 |
131 AutofillManager* autofill_manager_; // WEAK; owns us | 136 AutofillManager* autofill_manager_; // WEAK; owns us |
132 | 137 |
133 // Credit card verification code. | 138 // Credit card verification code. |
134 base::string16 cvv_; | 139 base::string16 cvv_; |
135 | 140 |
136 // Profile built using the data supplied by requestAutocomplete dialog. | 141 // Profile built using the data supplied by requestAutocomplete dialog. |
137 scoped_ptr<AutofillProfile> profile_; | 142 scoped_ptr<AutofillProfile> profile_; |
138 | 143 |
139 // Credit card built using the data supplied by requestAutocomplete dialog. | 144 // Credit card built using the data supplied by requestAutocomplete dialog. |
140 scoped_ptr<CreditCard> credit_card_; | 145 scoped_ptr<CreditCard> credit_card_; |
(...skipping 29 matching lines...) Expand all Loading... |
170 base::WeakPtrFactory<AutocheckoutManager> weak_ptr_factory_; | 175 base::WeakPtrFactory<AutocheckoutManager> weak_ptr_factory_; |
171 | 176 |
172 base::ThreadChecker thread_checker_; | 177 base::ThreadChecker thread_checker_; |
173 | 178 |
174 DISALLOW_COPY_AND_ASSIGN(AutocheckoutManager); | 179 DISALLOW_COPY_AND_ASSIGN(AutocheckoutManager); |
175 }; | 180 }; |
176 | 181 |
177 } // namespace autofill | 182 } // namespace autofill |
178 | 183 |
179 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOCHECKOUT_MANAGER_H_ | 184 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_AUTOCHECKOUT_MANAGER_H_ |
OLD | NEW |