| 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_TAB_AUTOFILL_MANAGER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_TAB_AUTOFILL_MANAGER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_AUTOFILL_TAB_AUTOFILL_MANAGER_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_TAB_AUTOFILL_MANAGER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 12 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 13 #include "components/autofill/content/browser/autocheckout_steps.h" | |
| 14 #include "components/autofill/core/browser/autocheckout_bubble_state.h" | |
| 15 #include "components/autofill/core/browser/autofill_manager_delegate.h" | 13 #include "components/autofill/core/browser/autofill_manager_delegate.h" |
| 16 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 17 #include "content/public/browser/web_contents_user_data.h" | 15 #include "content/public/browser/web_contents_user_data.h" |
| 18 | 16 |
| 19 namespace content { | 17 namespace content { |
| 20 struct FrameNavigateParams; | 18 struct FrameNavigateParams; |
| 21 struct LoadCommittedDetails; | 19 struct LoadCommittedDetails; |
| 22 class WebContents; | 20 class WebContents; |
| 23 } | 21 } |
| 24 | 22 |
| 25 namespace autofill { | 23 namespace autofill { |
| 26 | 24 |
| 27 class AutocheckoutBubble; | |
| 28 class AutofillDialogController; | 25 class AutofillDialogController; |
| 29 class AutofillPopupControllerImpl; | 26 class AutofillPopupControllerImpl; |
| 30 struct FormData; | 27 struct FormData; |
| 31 | 28 |
| 32 // Chrome implementation of AutofillManagerDelegate. | 29 // Chrome implementation of AutofillManagerDelegate. |
| 33 class TabAutofillManagerDelegate | 30 class TabAutofillManagerDelegate |
| 34 : public AutofillManagerDelegate, | 31 : public AutofillManagerDelegate, |
| 35 public content::WebContentsUserData<TabAutofillManagerDelegate>, | 32 public content::WebContentsUserData<TabAutofillManagerDelegate>, |
| 36 public content::WebContentsObserver { | 33 public content::WebContentsObserver { |
| 37 public: | 34 public: |
| 38 virtual ~TabAutofillManagerDelegate(); | 35 virtual ~TabAutofillManagerDelegate(); |
| 39 | 36 |
| 40 // Called when the tab corresponding to |this| instance is activated. | 37 // Called when the tab corresponding to |this| instance is activated. |
| 41 void TabActivated(int reason); | 38 void TabActivated(int reason); |
| 42 | 39 |
| 43 // AutofillManagerDelegate implementation. | 40 // AutofillManagerDelegate implementation. |
| 44 virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE; | 41 virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE; |
| 45 virtual PrefService* GetPrefs() OVERRIDE; | 42 virtual PrefService* GetPrefs() OVERRIDE; |
| 46 virtual autocheckout::WhitelistManager* | |
| 47 GetAutocheckoutWhitelistManager() const OVERRIDE; | |
| 48 virtual void HideRequestAutocompleteDialog() OVERRIDE; | 43 virtual void HideRequestAutocompleteDialog() OVERRIDE; |
| 49 virtual void OnAutocheckoutError() OVERRIDE; | |
| 50 virtual void OnAutocheckoutSuccess() OVERRIDE; | |
| 51 virtual void ShowAutofillSettings() OVERRIDE; | 44 virtual void ShowAutofillSettings() OVERRIDE; |
| 52 virtual void ConfirmSaveCreditCard( | 45 virtual void ConfirmSaveCreditCard( |
| 53 const AutofillMetrics& metric_logger, | 46 const AutofillMetrics& metric_logger, |
| 54 const CreditCard& credit_card, | 47 const CreditCard& credit_card, |
| 55 const base::Closure& save_card_callback) OVERRIDE; | 48 const base::Closure& save_card_callback) OVERRIDE; |
| 56 virtual bool ShowAutocheckoutBubble( | |
| 57 const gfx::RectF& bounds, | |
| 58 bool is_google_user, | |
| 59 const base::Callback<void(AutocheckoutBubbleState)>& callback) OVERRIDE; | |
| 60 virtual void HideAutocheckoutBubble() OVERRIDE; | |
| 61 virtual void ShowRequestAutocompleteDialog( | 49 virtual void ShowRequestAutocompleteDialog( |
| 62 const FormData& form, | 50 const FormData& form, |
| 63 const GURL& source_url, | 51 const GURL& source_url, |
| 64 DialogType dialog_type, | 52 DialogType dialog_type, |
| 65 const base::Callback<void(const FormStructure*, | 53 const base::Callback<void(const FormStructure*, |
| 66 const std::string&)>& callback) OVERRIDE; | 54 const std::string&)>& callback) OVERRIDE; |
| 67 virtual void ShowAutofillPopup( | 55 virtual void ShowAutofillPopup( |
| 68 const gfx::RectF& element_bounds, | 56 const gfx::RectF& element_bounds, |
| 69 base::i18n::TextDirection text_direction, | 57 base::i18n::TextDirection text_direction, |
| 70 const std::vector<string16>& values, | 58 const std::vector<string16>& values, |
| 71 const std::vector<string16>& labels, | 59 const std::vector<string16>& labels, |
| 72 const std::vector<string16>& icons, | 60 const std::vector<string16>& icons, |
| 73 const std::vector<int>& identifiers, | 61 const std::vector<int>& identifiers, |
| 74 base::WeakPtr<AutofillPopupDelegate> delegate) OVERRIDE; | 62 base::WeakPtr<AutofillPopupDelegate> delegate) OVERRIDE; |
| 75 virtual void UpdateAutofillPopupDataListValues( | 63 virtual void UpdateAutofillPopupDataListValues( |
| 76 const std::vector<base::string16>& values, | 64 const std::vector<base::string16>& values, |
| 77 const std::vector<base::string16>& labels) OVERRIDE; | 65 const std::vector<base::string16>& labels) OVERRIDE; |
| 78 virtual void HideAutofillPopup() OVERRIDE; | 66 virtual void HideAutofillPopup() OVERRIDE; |
| 79 virtual bool IsAutocompleteEnabled() OVERRIDE; | 67 virtual bool IsAutocompleteEnabled() OVERRIDE; |
| 80 | 68 |
| 81 virtual void AddAutocheckoutStep(AutocheckoutStepType step_type) OVERRIDE; | |
| 82 virtual void UpdateAutocheckoutStep( | |
| 83 AutocheckoutStepType step_type, | |
| 84 AutocheckoutStepStatus step_status) OVERRIDE; | |
| 85 | |
| 86 // content::WebContentsObserver implementation. | 69 // content::WebContentsObserver implementation. |
| 87 virtual void DidNavigateMainFrame( | 70 virtual void DidNavigateMainFrame( |
| 88 const content::LoadCommittedDetails& details, | 71 const content::LoadCommittedDetails& details, |
| 89 const content::FrameNavigateParams& params) OVERRIDE; | 72 const content::FrameNavigateParams& params) OVERRIDE; |
| 90 virtual void WebContentsDestroyed( | 73 virtual void WebContentsDestroyed( |
| 91 content::WebContents* web_contents) OVERRIDE; | 74 content::WebContents* web_contents) OVERRIDE; |
| 92 virtual void WasShown() OVERRIDE; | 75 virtual void WasShown() OVERRIDE; |
| 93 | 76 |
| 94 // Exposed for testing. | 77 // Exposed for testing. |
| 95 AutofillDialogController* GetDialogControllerForTesting() { | 78 AutofillDialogController* GetDialogControllerForTesting() { |
| 96 return dialog_controller_.get(); | 79 return dialog_controller_.get(); |
| 97 } | 80 } |
| 98 | 81 |
| 99 private: | 82 private: |
| 100 explicit TabAutofillManagerDelegate(content::WebContents* web_contents); | 83 explicit TabAutofillManagerDelegate(content::WebContents* web_contents); |
| 101 friend class content::WebContentsUserData<TabAutofillManagerDelegate>; | 84 friend class content::WebContentsUserData<TabAutofillManagerDelegate>; |
| 102 | 85 |
| 103 content::WebContents* const web_contents_; | 86 content::WebContents* const web_contents_; |
| 104 base::WeakPtr<AutofillDialogController> dialog_controller_; | 87 base::WeakPtr<AutofillDialogController> dialog_controller_; |
| 105 base::WeakPtr<AutocheckoutBubble> autocheckout_bubble_; | |
| 106 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; | 88 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; |
| 107 | 89 |
| 108 DISALLOW_COPY_AND_ASSIGN(TabAutofillManagerDelegate); | 90 DISALLOW_COPY_AND_ASSIGN(TabAutofillManagerDelegate); |
| 109 }; | 91 }; |
| 110 | 92 |
| 111 } // namespace autofill | 93 } // namespace autofill |
| 112 | 94 |
| 113 #endif // CHROME_BROWSER_UI_AUTOFILL_TAB_AUTOFILL_MANAGER_DELEGATE_H_ | 95 #endif // CHROME_BROWSER_UI_AUTOFILL_TAB_AUTOFILL_MANAGER_DELEGATE_H_ |
| OLD | NEW |