Chromium Code Reviews| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 virtual void OnWalletError() OVERRIDE; | 146 virtual void OnWalletError() OVERRIDE; |
| 146 virtual void OnMalformedResponse() OVERRIDE; | 147 virtual void OnMalformedResponse() OVERRIDE; |
| 147 virtual void OnNetworkError(int response_code) OVERRIDE; | 148 virtual void OnNetworkError(int response_code) OVERRIDE; |
| 148 | 149 |
| 149 // PersonalDataManagerObserver implementation. | 150 // PersonalDataManagerObserver implementation. |
| 150 virtual void OnPersonalDataChanged() OVERRIDE; | 151 virtual void OnPersonalDataChanged() OVERRIDE; |
| 151 | 152 |
| 152 private: | 153 private: |
| 153 // Determines whether |input| and |field| match. | 154 // Determines whether |input| and |field| match. |
| 154 typedef base::Callback<bool(const DetailInput& input, | 155 typedef base::Callback<bool(const DetailInput& input, |
| 155 const AutofillField& field)> InputFieldComparator; | 156 const AutofillField& field)> InputFieldComparator; |
|
Ilya Sherman
2013/02/12 22:50:34
nit: Remove this, since it's now in autofill_dialo
Evan Stade
2013/02/13 00:11:58
Done.
| |
| 156 | 157 |
| 157 // Refresh wallet items immediately if there's no refresh currently in | 158 // Refresh wallet items immediately if there's no refresh currently in |
| 158 // progress, otherwise wait until the current refresh completes. | 159 // progress, otherwise wait until the current refresh completes. |
| 159 void ScheduleRefreshWalletItems(); | 160 void ScheduleRefreshWalletItems(); |
| 160 | 161 |
| 161 // Called when any type of request to Online Wallet completes. |success| is | 162 // Called when any type of request to Online Wallet completes. |success| is |
| 162 // true when there was no network error, the response wasn't malformed, and no | 163 // true when there was no network error, the response wasn't malformed, and no |
| 163 // Wallet error occurred. | 164 // Wallet error occurred. |
| 164 void WalletRequestCompleted(bool success); | 165 void WalletRequestCompleted(bool success); |
| 165 | 166 |
| 166 // Whether or not the current request wants credit info back. | 167 // Whether or not the current request wants credit info back. |
| 167 bool RequestingCreditCardInfo() const; | 168 bool RequestingCreditCardInfo() const; |
| 168 | 169 |
| 169 // Whether the information input in this dialog will be securely transmitted | 170 // Whether the information input in this dialog will be securely transmitted |
| 170 // to the requesting site. | 171 // to the requesting site. |
| 171 bool TransmissionWillBeSecure() const; | 172 bool TransmissionWillBeSecure() const; |
| 172 | 173 |
| 173 // Convenience method to tell whether we need to address |action|. | 174 // Convenience method to tell whether we need to address |action|. |
| 174 bool HasRequiredAction(wallet::RequiredAction action) const; | 175 bool HasRequiredAction(wallet::RequiredAction action) const; |
| 175 | 176 |
| 176 // Initializes |suggested_email_| et al. | 177 // Initializes |suggested_email_| et al. |
| 177 void GenerateSuggestionsModels(); | 178 void GenerateSuggestionsModels(); |
| 178 | 179 |
| 179 // Returns whether |profile| is complete, i.e. can fill out all the relevant | 180 // Returns whether |profile| is complete, i.e. can fill out all the relevant |
| 180 // address info. Incomplete profiles will not be displayed in the dropdown | 181 // address info. Incomplete profiles will not be displayed in the dropdown |
| 181 // menu. | 182 // menu. |
| 182 bool IsCompleteProfile(const AutofillProfile& profile); | 183 bool IsCompleteProfile(const AutofillProfile& profile); |
| 183 | 184 |
| 185 // Creates a DataModelWrapper item for the item that's checked in the | |
| 186 // suggestion model for |section|. This may represent Autofill | |
| 187 // data or Wallet data, depending on whether Wallet is currently enabled. | |
| 188 DataModelWrapper* CreateWrapper(DialogSection section); | |
|
Ilya Sherman
2013/02/12 22:50:34
Please return a scoped_ptr<>
Evan Stade
2013/02/13 00:11:58
Done.
| |
| 189 | |
| 184 // Fills in |section|-related fields in |output_| according to the state of | 190 // Fills in |section|-related fields in |output_| according to the state of |
| 185 // |view_|. | 191 // |view_|. |
| 186 void FillOutputForSection(DialogSection section); | 192 void FillOutputForSection(DialogSection section); |
| 187 // As above, but uses |compare| to determine whether a DetailInput matches | 193 // As above, but uses |compare| to determine whether a DetailInput matches |
| 188 // a field. | 194 // a field. |
| 189 void FillOutputForSectionWithComparator(DialogSection section, | 195 void FillOutputForSectionWithComparator(DialogSection section, |
| 190 const InputFieldComparator& compare); | 196 const InputFieldComparator& compare); |
| 191 | 197 |
| 192 // Fills in |form_structure_| using |form_group|. Utility method for | 198 // Fills in |form_structure_| using |form_group|. Utility method for |
| 193 // FillOutputForSection. | 199 // FillOutputForSection. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 | 301 |
| 296 // A NotificationRegistrar for tracking the completion of sign-in. | 302 // A NotificationRegistrar for tracking the completion of sign-in. |
| 297 content::NotificationRegistrar registrar_; | 303 content::NotificationRegistrar registrar_; |
| 298 | 304 |
| 299 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 305 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
| 300 }; | 306 }; |
| 301 | 307 |
| 302 } // namespace autofill | 308 } // namespace autofill |
| 303 | 309 |
| 304 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 310 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
| OLD | NEW |