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 <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "chrome/browser/ui/autofill/account_chooser_model.h" | 16 #include "chrome/browser/ui/autofill/account_chooser_model.h" |
| 17 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
17 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 18 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
18 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 19 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
19 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | 20 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
20 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 21 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
21 #include "chrome/browser/ui/autofill/country_combobox_model.h" | 22 #include "chrome/browser/ui/autofill/country_combobox_model.h" |
22 #include "components/autofill/content/browser/autocheckout_steps.h" | 23 #include "components/autofill/content/browser/autocheckout_steps.h" |
23 #include "components/autofill/content/browser/wallet/wallet_client.h" | 24 #include "components/autofill/content/browser/wallet/wallet_client.h" |
24 #include "components/autofill/content/browser/wallet/wallet_client_delegate.h" | 25 #include "components/autofill/content/browser/wallet/wallet_client_delegate.h" |
25 #include "components/autofill/content/browser/wallet/wallet_items.h" | 26 #include "components/autofill/content/browser/wallet/wallet_items.h" |
26 #include "components/autofill/content/browser/wallet/wallet_signin_helper_delega
te.h" | 27 #include "components/autofill/content/browser/wallet/wallet_signin_helper_delega
te.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 class Fingerprint; | 62 class Fingerprint; |
62 } | 63 } |
63 | 64 |
64 namespace wallet { | 65 namespace wallet { |
65 class WalletSigninHelper; | 66 class WalletSigninHelper; |
66 } | 67 } |
67 | 68 |
68 // This class drives the dialog that appears when a site uses the imperative | 69 // This class drives the dialog that appears when a site uses the imperative |
69 // autocomplete API to fill out a form. | 70 // autocomplete API to fill out a form. |
70 class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, | 71 class AutofillDialogControllerImpl : public AutofillDialogViewDelegate, |
| 72 public AutofillDialogController, |
71 public AutofillPopupDelegate, | 73 public AutofillPopupDelegate, |
72 public content::NotificationObserver, | 74 public content::NotificationObserver, |
73 public content::WebContentsObserver, | 75 public content::WebContentsObserver, |
74 public SuggestionsMenuModelDelegate, | 76 public SuggestionsMenuModelDelegate, |
75 public wallet::WalletClientDelegate, | 77 public wallet::WalletClientDelegate, |
76 public wallet::WalletSigninHelperDelegate, | 78 public wallet::WalletSigninHelperDelegate, |
77 public PersonalDataManagerObserver, | 79 public PersonalDataManagerObserver, |
78 public AccountChooserModelDelegate { | 80 public AccountChooserModelDelegate { |
79 public: | 81 public: |
80 virtual ~AutofillDialogControllerImpl(); | 82 virtual ~AutofillDialogControllerImpl(); |
81 | 83 |
82 static base::WeakPtr<AutofillDialogControllerImpl> Create( | 84 static base::WeakPtr<AutofillDialogControllerImpl> Create( |
83 content::WebContents* contents, | 85 content::WebContents* contents, |
84 const FormData& form_structure, | 86 const FormData& form_structure, |
85 const GURL& source_url, | 87 const GURL& source_url, |
86 const DialogType dialog_type, | 88 const DialogType dialog_type, |
87 const base::Callback<void(const FormStructure*, | 89 const base::Callback<void(const FormStructure*, |
88 const std::string&)>& callback); | 90 const std::string&)>& callback); |
89 | 91 |
90 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 92 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
91 | 93 |
92 void Show(); | 94 // AutofillDialogController implementation. |
93 void Hide(); | 95 virtual void Show() OVERRIDE; |
94 | 96 virtual void Hide() OVERRIDE; |
95 // Called when the tab hosting this dialog is activated by a user gesture. | 97 virtual void TabActivated() OVERRIDE; |
96 // Used to trigger a refresh of the user's Wallet data. | 98 virtual void AddAutocheckoutStep(AutocheckoutStepType step_type) OVERRIDE; |
97 void TabActivated(); | 99 virtual void UpdateAutocheckoutStep( |
98 | 100 AutocheckoutStepType step_type, |
99 // Adds a step in the flow to the Autocheckout UI. | 101 AutocheckoutStepStatus step_status) OVERRIDE; |
100 void AddAutocheckoutStep(AutocheckoutStepType step_type); | 102 virtual void OnAutocheckoutError() OVERRIDE; |
101 | 103 virtual void OnAutocheckoutSuccess() OVERRIDE; |
102 // Updates the status of a step in the Autocheckout UI. | |
103 void UpdateAutocheckoutStep(AutocheckoutStepType step_type, | |
104 AutocheckoutStepStatus step_status); | |
105 | |
106 // Called when there is an error in an active Autocheckout flow. | |
107 void OnAutocheckoutError(); | |
108 | |
109 // Called when an Autocheckout flow completes successfully. | |
110 void OnAutocheckoutSuccess(); | |
111 | 104 |
112 // Returns |view_| as a testable version of itself (if |view_| exists and | 105 // Returns |view_| as a testable version of itself (if |view_| exists and |
113 // actually implements |AutofillDialogView::GetTestableView()|). | 106 // actually implements |AutofillDialogView::GetTestableView()|). |
114 TestableAutofillDialogView* GetTestableView(); | 107 TestableAutofillDialogView* GetTestableView(); |
115 | 108 |
116 // AutofillDialogViewDelegate implementation. | 109 // AutofillDialogViewDelegate implementation. |
117 virtual string16 DialogTitle() const OVERRIDE; | 110 virtual string16 DialogTitle() const OVERRIDE; |
118 virtual string16 AccountChooserText() const OVERRIDE; | 111 virtual string16 AccountChooserText() const OVERRIDE; |
119 virtual string16 SignInLinkText() const OVERRIDE; | 112 virtual string16 SignInLinkText() const OVERRIDE; |
120 virtual string16 EditSuggestionText() const OVERRIDE; | 113 virtual string16 EditSuggestionText() const OVERRIDE; |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 // show a bubble as the dialog closes to confirm a user's new card info was | 706 // show a bubble as the dialog closes to confirm a user's new card info was |
714 // saved. Never populated while incognito (as nothing's actually saved). | 707 // saved. Never populated while incognito (as nothing's actually saved). |
715 scoped_ptr<CreditCard> newly_saved_card_; | 708 scoped_ptr<CreditCard> newly_saved_card_; |
716 | 709 |
717 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 710 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
718 }; | 711 }; |
719 | 712 |
720 } // namespace autofill | 713 } // namespace autofill |
721 | 714 |
722 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 715 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
OLD | NEW |