| 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 <map> | 8 #include <map> |
| 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/string16.h" | 14 #include "base/string16.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 16 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| 17 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 17 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
| 18 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 18 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 19 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 19 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| 20 #include "chrome/browser/ui/autofill/country_combobox_model.h" | 20 #include "chrome/browser/ui/autofill/country_combobox_model.h" |
| 21 #include "components/autofill/browser/autofill_manager_delegate.h" | 21 #include "components/autofill/browser/autofill_manager_delegate.h" |
| 22 #include "components/autofill/browser/autofill_metrics.h" | 22 #include "components/autofill/browser/autofill_metrics.h" |
| 23 #include "components/autofill/browser/autofill_popup_delegate.h" | 23 #include "components/autofill/browser/autofill_popup_delegate.h" |
| 24 #include "components/autofill/browser/field_types.h" | 24 #include "components/autofill/browser/field_types.h" |
| 25 #include "components/autofill/browser/form_structure.h" | 25 #include "components/autofill/browser/form_structure.h" |
| 26 #include "components/autofill/browser/personal_data_manager.h" | 26 #include "components/autofill/browser/personal_data_manager.h" |
| 27 #include "components/autofill/browser/personal_data_manager_observer.h" | 27 #include "components/autofill/browser/personal_data_manager_observer.h" |
| 28 #include "components/autofill/browser/wallet/required_action.h" | |
| 29 #include "components/autofill/browser/wallet/wallet_client.h" | 28 #include "components/autofill/browser/wallet/wallet_client.h" |
| 30 #include "components/autofill/browser/wallet/wallet_client_delegate.h" | 29 #include "components/autofill/browser/wallet/wallet_client_delegate.h" |
| 31 #include "components/autofill/browser/wallet/wallet_signin_helper_delegate.h" | 30 #include "components/autofill/browser/wallet/wallet_signin_helper_delegate.h" |
| 32 #include "content/public/browser/notification_observer.h" | 31 #include "content/public/browser/notification_observer.h" |
| 33 #include "content/public/browser/notification_registrar.h" | 32 #include "content/public/browser/notification_registrar.h" |
| 34 #include "content/public/common/ssl_status.h" | 33 #include "content/public/common/ssl_status.h" |
| 35 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
| 36 #include "ui/base/models/simple_menu_model.h" | 35 #include "ui/base/models/simple_menu_model.h" |
| 37 #include "ui/base/ui_base_types.h" | 36 #include "ui/base/ui_base_types.h" |
| 38 | 37 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 virtual string16 CancelSignInText() const OVERRIDE; | 101 virtual string16 CancelSignInText() const OVERRIDE; |
| 103 virtual string16 ProgressBarText() const OVERRIDE; | 102 virtual string16 ProgressBarText() const OVERRIDE; |
| 104 virtual DialogSignedInState SignedInState() const OVERRIDE; | 103 virtual DialogSignedInState SignedInState() const OVERRIDE; |
| 105 virtual bool ShouldShowSpinner() const OVERRIDE; | 104 virtual bool ShouldShowSpinner() const OVERRIDE; |
| 106 virtual bool ShouldOfferToSaveInChrome() const OVERRIDE; | 105 virtual bool ShouldOfferToSaveInChrome() const OVERRIDE; |
| 107 virtual ui::MenuModel* MenuModelForAccountChooser() OVERRIDE; | 106 virtual ui::MenuModel* MenuModelForAccountChooser() OVERRIDE; |
| 108 virtual gfx::Image AccountChooserImage() OVERRIDE; | 107 virtual gfx::Image AccountChooserImage() OVERRIDE; |
| 109 virtual bool AutocheckoutIsRunning() const OVERRIDE; | 108 virtual bool AutocheckoutIsRunning() const OVERRIDE; |
| 110 virtual bool HadAutocheckoutError() const OVERRIDE; | 109 virtual bool HadAutocheckoutError() const OVERRIDE; |
| 111 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 110 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; |
| 111 virtual bool IsSubmitPausedOn(wallet::RequiredAction action) const OVERRIDE; |
| 112 virtual bool SectionIsActive(DialogSection section) const OVERRIDE; | 112 virtual bool SectionIsActive(DialogSection section) const OVERRIDE; |
| 113 virtual const DetailInputs& RequestedFieldsForSection(DialogSection section) | 113 virtual const DetailInputs& RequestedFieldsForSection(DialogSection section) |
| 114 const OVERRIDE; | 114 const OVERRIDE; |
| 115 virtual ui::ComboboxModel* ComboboxModelForAutofillType( | 115 virtual ui::ComboboxModel* ComboboxModelForAutofillType( |
| 116 AutofillFieldType type) OVERRIDE; | 116 AutofillFieldType type) OVERRIDE; |
| 117 virtual ui::MenuModel* MenuModelForSection(DialogSection section) OVERRIDE; | 117 virtual ui::MenuModel* MenuModelForSection(DialogSection section) OVERRIDE; |
| 118 virtual string16 LabelForSection(DialogSection section) const OVERRIDE; | 118 virtual string16 LabelForSection(DialogSection section) const OVERRIDE; |
| 119 virtual string16 SuggestionTextForSection(DialogSection section) OVERRIDE; | 119 virtual string16 SuggestionTextForSection(DialogSection section) OVERRIDE; |
| 120 virtual gfx::Image SuggestionIconForSection(DialogSection section) OVERRIDE; | 120 virtual gfx::Image SuggestionIconForSection(DialogSection section) OVERRIDE; |
| 121 virtual void EditClickedForSection(DialogSection section) OVERRIDE; | 121 virtual void EditClickedForSection(DialogSection section) OVERRIDE; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 132 const string16& field_contents, | 132 const string16& field_contents, |
| 133 bool was_edit) OVERRIDE; | 133 bool was_edit) OVERRIDE; |
| 134 virtual bool HandleKeyPressEventInInput( | 134 virtual bool HandleKeyPressEventInInput( |
| 135 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 135 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 136 virtual void FocusMoved() OVERRIDE; | 136 virtual void FocusMoved() OVERRIDE; |
| 137 virtual void ViewClosed() OVERRIDE; | 137 virtual void ViewClosed() OVERRIDE; |
| 138 virtual std::vector<DialogNotification> CurrentNotifications() const OVERRIDE; | 138 virtual std::vector<DialogNotification> CurrentNotifications() const OVERRIDE; |
| 139 virtual void StartSignInFlow() OVERRIDE; | 139 virtual void StartSignInFlow() OVERRIDE; |
| 140 virtual void EndSignInFlow() OVERRIDE; | 140 virtual void EndSignInFlow() OVERRIDE; |
| 141 virtual void OnCancel() OVERRIDE; | 141 virtual void OnCancel() OVERRIDE; |
| 142 virtual void OnSubmit() OVERRIDE; | 142 virtual void OnAccept() OVERRIDE; |
| 143 virtual Profile* profile() OVERRIDE; | 143 virtual Profile* profile() OVERRIDE; |
| 144 virtual content::WebContents* web_contents() OVERRIDE; | 144 virtual content::WebContents* web_contents() OVERRIDE; |
| 145 | 145 |
| 146 // AutofillPopupDelegate implementation. | 146 // AutofillPopupDelegate implementation. |
| 147 virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE; | 147 virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE; |
| 148 virtual void OnPopupHidden(content::KeyboardListener* listener) OVERRIDE; | 148 virtual void OnPopupHidden(content::KeyboardListener* listener) OVERRIDE; |
| 149 virtual void DidSelectSuggestion(int identifier) OVERRIDE; | 149 virtual void DidSelectSuggestion(int identifier) OVERRIDE; |
| 150 virtual void DidAcceptSuggestion(const string16& value, | 150 virtual void DidAcceptSuggestion(const string16& value, |
| 151 int identifier) OVERRIDE; | 151 int identifier) OVERRIDE; |
| 152 virtual void RemoveSuggestion(const string16& value, | 152 virtual void RemoveSuggestion(const string16& value, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 // Sets the CVC result on |form_structure_| to the value in |cvc|. | 289 // Sets the CVC result on |form_structure_| to the value in |cvc|. |
| 290 void SetCvcResult(const string16& cvc); | 290 void SetCvcResult(const string16& cvc); |
| 291 | 291 |
| 292 // Gets the SuggestionsMenuModel for |section|. | 292 // Gets the SuggestionsMenuModel for |section|. |
| 293 SuggestionsMenuModel* SuggestionsMenuModelForSection(DialogSection section); | 293 SuggestionsMenuModel* SuggestionsMenuModelForSection(DialogSection section); |
| 294 // And the reverse. | 294 // And the reverse. |
| 295 DialogSection SectionForSuggestionsMenuModel( | 295 DialogSection SectionForSuggestionsMenuModel( |
| 296 const SuggestionsMenuModel& model); | 296 const SuggestionsMenuModel& model); |
| 297 | 297 |
| 298 // Suggested text for a section in the middle of processing a required action. |
| 299 string16 RequiredActionSuggestionTextForSection(DialogSection section); |
| 300 |
| 298 // Loads profiles that can suggest data for |type|. |field_contents| is the | 301 // Loads profiles that can suggest data for |type|. |field_contents| is the |
| 299 // part the user has already typed. |inputs| is the rest of section. | 302 // part the user has already typed. |inputs| is the rest of section. |
| 300 // Identifying info is loaded into the last three outparams as well as | 303 // Identifying info is loaded into the last three outparams as well as |
| 301 // |popup_guids_|. | 304 // |popup_guids_|. |
| 302 void GetProfileSuggestions( | 305 void GetProfileSuggestions( |
| 303 AutofillFieldType type, | 306 AutofillFieldType type, |
| 304 const string16& field_contents, | 307 const string16& field_contents, |
| 305 const DetailInputs& inputs, | 308 const DetailInputs& inputs, |
| 306 std::vector<string16>* popup_values, | 309 std::vector<string16>* popup_values, |
| 307 std::vector<string16>* popup_labels, | 310 std::vector<string16>* popup_labels, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 437 |
| 435 // For logging UMA metrics. | 438 // For logging UMA metrics. |
| 436 const AutofillMetrics& metric_logger_; | 439 const AutofillMetrics& metric_logger_; |
| 437 base::Time dialog_shown_timestamp_; | 440 base::Time dialog_shown_timestamp_; |
| 438 base::Time autocheckout_started_timestamp_; | 441 base::Time autocheckout_started_timestamp_; |
| 439 AutofillMetrics::DialogInitialUserStateMetric initial_user_state_; | 442 AutofillMetrics::DialogInitialUserStateMetric initial_user_state_; |
| 440 | 443 |
| 441 // Whether this is an Autocheckout or a requestAutocomplete dialog. | 444 // Whether this is an Autocheckout or a requestAutocomplete dialog. |
| 442 const DialogType dialog_type_; | 445 const DialogType dialog_type_; |
| 443 | 446 |
| 444 // True if the termination action was a submit. | 447 // True after the user first accepts the dialog and presses "Submit". May |
| 445 bool did_submit_; | 448 // continue to be true while processing required actions. |
| 449 bool is_submitting_; |
| 446 | 450 |
| 447 // Whether or not an Autocheckout flow is running. | 451 // Whether or not an Autocheckout flow is running. |
| 448 bool autocheckout_is_running_; | 452 bool autocheckout_is_running_; |
| 449 | 453 |
| 450 // Whether or not there was an error in the Autocheckout flow. | 454 // Whether or not there was an error in the Autocheckout flow. |
| 451 bool had_autocheckout_error_; | 455 bool had_autocheckout_error_; |
| 452 | 456 |
| 453 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 457 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
| 454 }; | 458 }; |
| 455 | 459 |
| 456 } // namespace autofill | 460 } // namespace autofill |
| 457 | 461 |
| 458 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 462 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
| OLD | NEW |