OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "base/time.h" |
| 15 #include "chrome/browser/autofill/autofill_manager_delegate.h" |
| 16 #include "chrome/browser/autofill/autofill_metrics.h" |
14 #include "chrome/browser/autofill/field_types.h" | 17 #include "chrome/browser/autofill/field_types.h" |
15 #include "chrome/browser/autofill/form_structure.h" | 18 #include "chrome/browser/autofill/form_structure.h" |
16 #include "chrome/browser/autofill/personal_data_manager.h" | 19 #include "chrome/browser/autofill/personal_data_manager.h" |
17 #include "chrome/browser/autofill/personal_data_manager_observer.h" | 20 #include "chrome/browser/autofill/personal_data_manager_observer.h" |
18 #include "chrome/browser/autofill/wallet/required_action.h" | 21 #include "chrome/browser/autofill/wallet/required_action.h" |
19 #include "chrome/browser/autofill/wallet/wallet_client.h" | 22 #include "chrome/browser/autofill/wallet/wallet_client.h" |
20 #include "chrome/browser/autofill/wallet/wallet_client_observer.h" | 23 #include "chrome/browser/autofill/wallet/wallet_client_observer.h" |
21 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 24 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
22 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 25 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
23 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 26 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
(...skipping 25 matching lines...) Expand all Loading... |
49 public content::NotificationObserver, | 52 public content::NotificationObserver, |
50 public SuggestionsMenuModelDelegate, | 53 public SuggestionsMenuModelDelegate, |
51 public wallet::WalletClientObserver, | 54 public wallet::WalletClientObserver, |
52 public PersonalDataManagerObserver { | 55 public PersonalDataManagerObserver { |
53 public: | 56 public: |
54 AutofillDialogControllerImpl( | 57 AutofillDialogControllerImpl( |
55 content::WebContents* contents, | 58 content::WebContents* contents, |
56 const FormData& form_structure, | 59 const FormData& form_structure, |
57 const GURL& source_url, | 60 const GURL& source_url, |
58 const content::SSLStatus& ssl_status, | 61 const content::SSLStatus& ssl_status, |
| 62 const AutofillMetrics& metric_logger, |
| 63 const DialogType dialog_type, |
59 const base::Callback<void(const FormStructure*)>& callback); | 64 const base::Callback<void(const FormStructure*)>& callback); |
60 virtual ~AutofillDialogControllerImpl(); | 65 virtual ~AutofillDialogControllerImpl(); |
61 | 66 |
62 void Show(); | 67 void Show(); |
63 void Hide(); | 68 void Hide(); |
64 | 69 |
65 // Updates the progress bar based on the Autocheckout progress. |value| should | 70 // Updates the progress bar based on the Autocheckout progress. |value| should |
66 // be in [0.0, 1.0]. | 71 // be in [0.0, 1.0]. |
67 void UpdateProgressBar(double value); | 72 void UpdateProgressBar(double value); |
68 | 73 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 const std::string& address_id) OVERRIDE; | 147 const std::string& address_id) OVERRIDE; |
143 virtual void OnDidSendAutocheckoutStatus() OVERRIDE; | 148 virtual void OnDidSendAutocheckoutStatus() OVERRIDE; |
144 virtual void OnDidUpdateInstrument(const std::string& instrument_id) OVERRIDE; | 149 virtual void OnDidUpdateInstrument(const std::string& instrument_id) OVERRIDE; |
145 virtual void OnWalletError() OVERRIDE; | 150 virtual void OnWalletError() OVERRIDE; |
146 virtual void OnMalformedResponse() OVERRIDE; | 151 virtual void OnMalformedResponse() OVERRIDE; |
147 virtual void OnNetworkError(int response_code) OVERRIDE; | 152 virtual void OnNetworkError(int response_code) OVERRIDE; |
148 | 153 |
149 // PersonalDataManagerObserver implementation. | 154 // PersonalDataManagerObserver implementation. |
150 virtual void OnPersonalDataChanged() OVERRIDE; | 155 virtual void OnPersonalDataChanged() OVERRIDE; |
151 | 156 |
| 157 protected: |
| 158 // Exposed for testing. |
| 159 AutofillDialogView* view() { return view_.get(); } |
| 160 |
152 private: | 161 private: |
153 // Refresh wallet items immediately if there's no refresh currently in | 162 // Refresh wallet items immediately if there's no refresh currently in |
154 // progress, otherwise wait until the current refresh completes. | 163 // progress, otherwise wait until the current refresh completes. |
155 void ScheduleRefreshWalletItems(); | 164 void ScheduleRefreshWalletItems(); |
156 | 165 |
157 // Called when any type of request to Online Wallet completes. |success| is | 166 // Called when any type of request to Online Wallet completes. |success| is |
158 // true when there was no network error, the response wasn't malformed, and no | 167 // true when there was no network error, the response wasn't malformed, and no |
159 // Wallet error occurred. | 168 // Wallet error occurred. |
160 void WalletRequestCompleted(bool success); | 169 void WalletRequestCompleted(bool success); |
161 | 170 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 299 |
291 // The section for which |popup_controller_| is currently showing a popup | 300 // The section for which |popup_controller_| is currently showing a popup |
292 // (if any). | 301 // (if any). |
293 DialogSection section_showing_popup_; | 302 DialogSection section_showing_popup_; |
294 | 303 |
295 scoped_ptr<AutofillDialogView> view_; | 304 scoped_ptr<AutofillDialogView> view_; |
296 | 305 |
297 // A NotificationRegistrar for tracking the completion of sign-in. | 306 // A NotificationRegistrar for tracking the completion of sign-in. |
298 content::NotificationRegistrar registrar_; | 307 content::NotificationRegistrar registrar_; |
299 | 308 |
| 309 // For logging UMA metrics. |
| 310 const AutofillMetrics& metric_logger_; |
| 311 base::Time dialog_shown_timestamp_; |
| 312 DialogType dialog_type_; |
| 313 |
300 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 314 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
301 }; | 315 }; |
302 | 316 |
303 } // namespace autofill | 317 } // namespace autofill |
304 | 318 |
305 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 319 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
OLD | NEW |