Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / autofill / tab_autofill_manager_delegate.h
blobf2f12bdace9dba9c512852e35dada8dfb4f9bfc4
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_TAB_AUTOFILL_MANAGER_DELEGATE_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_TAB_AUTOFILL_MANAGER_DELEGATE_H_
8 #include "base/callback.h"
9 #include "base/compiler_specific.h"
10 #include "base/i18n/rtl.h"
11 #include "base/memory/weak_ptr.h"
12 #include "components/autofill/core/browser/autofill_manager_delegate.h"
13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/browser/web_contents_user_data.h"
16 namespace content {
17 struct FrameNavigateParams;
18 struct LoadCommittedDetails;
19 class WebContents;
22 namespace autofill {
24 class AutofillDialogController;
25 class AutofillPopupControllerImpl;
26 struct FormData;
28 // Chrome implementation of AutofillManagerDelegate.
29 class TabAutofillManagerDelegate
30 : public AutofillManagerDelegate,
31 public content::WebContentsUserData<TabAutofillManagerDelegate>,
32 public content::WebContentsObserver {
33 public:
34 virtual ~TabAutofillManagerDelegate();
36 // Called when the tab corresponding to |this| instance is activated.
37 void TabActivated();
39 // AutofillManagerDelegate implementation.
40 virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE;
41 virtual scoped_refptr<AutofillWebDataService>
42 GetDatabase() OVERRIDE;
43 virtual PrefService* GetPrefs() OVERRIDE;
44 virtual void HideRequestAutocompleteDialog() OVERRIDE;
45 virtual void ShowAutofillSettings() OVERRIDE;
46 virtual void ConfirmSaveCreditCard(
47 const AutofillMetrics& metric_logger,
48 const base::Closure& save_card_callback) OVERRIDE;
49 virtual void ShowRequestAutocompleteDialog(
50 const FormData& form,
51 const GURL& source_url,
52 const base::Callback<void(const FormStructure*)>& callback) OVERRIDE;
53 virtual void ShowAutofillPopup(
54 const gfx::RectF& element_bounds,
55 base::i18n::TextDirection text_direction,
56 const std::vector<base::string16>& values,
57 const std::vector<base::string16>& labels,
58 const std::vector<base::string16>& icons,
59 const std::vector<int>& identifiers,
60 base::WeakPtr<AutofillPopupDelegate> delegate) OVERRIDE;
61 virtual void UpdateAutofillPopupDataListValues(
62 const std::vector<base::string16>& values,
63 const std::vector<base::string16>& labels) OVERRIDE;
64 virtual void HideAutofillPopup() OVERRIDE;
65 virtual bool IsAutocompleteEnabled() OVERRIDE;
67 virtual void DetectAccountCreationForms(
68 const std::vector<autofill::FormStructure*>& forms) OVERRIDE;
70 // content::WebContentsObserver implementation.
71 virtual void DidNavigateMainFrame(
72 const content::LoadCommittedDetails& details,
73 const content::FrameNavigateParams& params) OVERRIDE;
74 virtual void WebContentsDestroyed(
75 content::WebContents* web_contents) OVERRIDE;
76 virtual void WasShown() OVERRIDE;
78 // Exposed for testing.
79 AutofillDialogController* GetDialogControllerForTesting() {
80 return dialog_controller_.get();
82 void SetDialogControllerForTesting(
83 const base::WeakPtr<AutofillDialogController>& dialog_controller) {
84 dialog_controller_ = dialog_controller;
87 private:
88 explicit TabAutofillManagerDelegate(content::WebContents* web_contents);
89 friend class content::WebContentsUserData<TabAutofillManagerDelegate>;
91 content::WebContents* const web_contents_;
92 base::WeakPtr<AutofillDialogController> dialog_controller_;
93 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_;
95 DISALLOW_COPY_AND_ASSIGN(TabAutofillManagerDelegate);
98 } // namespace autofill
100 #endif // CHROME_BROWSER_UI_AUTOFILL_TAB_AUTOFILL_MANAGER_DELEGATE_H_