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" |
(...skipping 22 matching lines...) Expand all Loading... |
33 class FormGroup; | 33 class FormGroup; |
34 class Profile; | 34 class Profile; |
35 | 35 |
36 namespace content { | 36 namespace content { |
37 class WebContents; | 37 class WebContents; |
38 } | 38 } |
39 | 39 |
40 namespace autofill { | 40 namespace autofill { |
41 | 41 |
42 class AutofillDialogView; | 42 class AutofillDialogView; |
| 43 class DataModelWrapper; |
43 | 44 |
44 // This class drives the dialog that appears when a site uses the imperative | 45 // This class drives the dialog that appears when a site uses the imperative |
45 // autocomplete API to fill out a form. | 46 // autocomplete API to fill out a form. |
46 class AutofillDialogControllerImpl : public AutofillDialogController, | 47 class AutofillDialogControllerImpl : public AutofillDialogController, |
47 public AutofillPopupDelegate, | 48 public AutofillPopupDelegate, |
48 public content::NotificationObserver, | 49 public content::NotificationObserver, |
49 public SuggestionsMenuModelDelegate, | 50 public SuggestionsMenuModelDelegate, |
50 public wallet::WalletClientObserver, | 51 public wallet::WalletClientObserver, |
51 public PersonalDataManagerObserver { | 52 public PersonalDataManagerObserver { |
52 public: | 53 public: |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 virtual void OnDidSendAutocheckoutStatus() OVERRIDE; | 143 virtual void OnDidSendAutocheckoutStatus() OVERRIDE; |
143 virtual void OnDidUpdateInstrument(const std::string& instrument_id) OVERRIDE; | 144 virtual void OnDidUpdateInstrument(const std::string& instrument_id) OVERRIDE; |
144 virtual void OnWalletError() OVERRIDE; | 145 virtual void OnWalletError() OVERRIDE; |
145 virtual void OnMalformedResponse() OVERRIDE; | 146 virtual void OnMalformedResponse() OVERRIDE; |
146 virtual void OnNetworkError(int response_code) OVERRIDE; | 147 virtual void OnNetworkError(int response_code) OVERRIDE; |
147 | 148 |
148 // PersonalDataManagerObserver implementation. | 149 // PersonalDataManagerObserver implementation. |
149 virtual void OnPersonalDataChanged() OVERRIDE; | 150 virtual void OnPersonalDataChanged() OVERRIDE; |
150 | 151 |
151 private: | 152 private: |
152 // Determines whether |input| and |field| match. | |
153 typedef base::Callback<bool(const DetailInput& input, | |
154 const AutofillField& field)> InputFieldComparator; | |
155 | |
156 // Refresh wallet items immediately if there's no refresh currently in | 153 // Refresh wallet items immediately if there's no refresh currently in |
157 // progress, otherwise wait until the current refresh completes. | 154 // progress, otherwise wait until the current refresh completes. |
158 void ScheduleRefreshWalletItems(); | 155 void ScheduleRefreshWalletItems(); |
159 | 156 |
160 // Called when any type of request to Online Wallet completes. |success| is | 157 // Called when any type of request to Online Wallet completes. |success| is |
161 // true when there was no network error, the response wasn't malformed, and no | 158 // true when there was no network error, the response wasn't malformed, and no |
162 // Wallet error occurred. | 159 // Wallet error occurred. |
163 void WalletRequestCompleted(bool success); | 160 void WalletRequestCompleted(bool success); |
164 | 161 |
165 // Whether or not the current request wants credit info back. | 162 // Whether or not the current request wants credit info back. |
166 bool RequestingCreditCardInfo() const; | 163 bool RequestingCreditCardInfo() const; |
167 | 164 |
168 // Whether the information input in this dialog will be securely transmitted | 165 // Whether the information input in this dialog will be securely transmitted |
169 // to the requesting site. | 166 // to the requesting site. |
170 bool TransmissionWillBeSecure() const; | 167 bool TransmissionWillBeSecure() const; |
171 | 168 |
172 // Convenience method to tell whether we need to address |action|. | 169 // Convenience method to tell whether we need to address |action|. |
173 bool HasRequiredAction(wallet::RequiredAction action) const; | 170 bool HasRequiredAction(wallet::RequiredAction action) const; |
174 | 171 |
175 // Initializes |suggested_email_| et al. | 172 // Initializes |suggested_email_| et al. |
176 void GenerateSuggestionsModels(); | 173 void GenerateSuggestionsModels(); |
177 | 174 |
178 // Returns whether |profile| is complete, i.e. can fill out all the relevant | 175 // Returns whether |profile| is complete, i.e. can fill out all the relevant |
179 // address info. Incomplete profiles will not be displayed in the dropdown | 176 // address info. Incomplete profiles will not be displayed in the dropdown |
180 // menu. | 177 // menu. |
181 bool IsCompleteProfile(const AutofillProfile& profile); | 178 bool IsCompleteProfile(const AutofillProfile& profile); |
182 | 179 |
| 180 // Creates a DataModelWrapper item for the item that's checked in the |
| 181 // suggestion model for |section|. This may represent Autofill |
| 182 // data or Wallet data, depending on whether Wallet is currently enabled. |
| 183 scoped_ptr<DataModelWrapper> CreateWrapper(DialogSection section); |
| 184 |
183 // Fills in |section|-related fields in |output_| according to the state of | 185 // Fills in |section|-related fields in |output_| according to the state of |
184 // |view_|. | 186 // |view_|. |
185 void FillOutputForSection(DialogSection section); | 187 void FillOutputForSection(DialogSection section); |
186 // As above, but uses |compare| to determine whether a DetailInput matches | 188 // As above, but uses |compare| to determine whether a DetailInput matches |
187 // a field. | 189 // a field. |
188 void FillOutputForSectionWithComparator(DialogSection section, | 190 void FillOutputForSectionWithComparator(DialogSection section, |
189 const InputFieldComparator& compare); | 191 const InputFieldComparator& compare); |
190 | 192 |
191 // Fills in |form_structure_| using |form_group|. Utility method for | 193 // Fills in |form_structure_| using |form_group|. Utility method for |
192 // FillOutputForSection. | 194 // FillOutputForSection. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 296 |
295 // A NotificationRegistrar for tracking the completion of sign-in. | 297 // A NotificationRegistrar for tracking the completion of sign-in. |
296 content::NotificationRegistrar registrar_; | 298 content::NotificationRegistrar registrar_; |
297 | 299 |
298 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 300 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
299 }; | 301 }; |
300 | 302 |
301 } // namespace autofill | 303 } // namespace autofill |
302 | 304 |
303 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 305 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
OLD | NEW |