BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / autofill / chrome_autofill_client.h
blobfe705ec44417ada950ce90492e961d6c20822803
1 // Copyright 2014 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_CHROME_AUTOFILL_CLIENT_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_
8 #include <vector>
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "base/i18n/rtl.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
15 #include "components/autofill/core/browser/autofill_client.h"
16 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.h"
17 #include "components/ui/zoom/zoom_observer.h"
18 #include "content/public/browser/web_contents_observer.h"
19 #include "content/public/browser/web_contents_user_data.h"
21 namespace content {
22 struct FrameNavigateParams;
23 struct LoadCommittedDetails;
24 class WebContents;
27 namespace autofill {
29 class AutofillDialogController;
30 class AutofillPopupControllerImpl;
31 class CreditCardScannerController;
32 struct FormData;
34 // Chrome implementation of AutofillClient.
35 class ChromeAutofillClient
36 : public AutofillClient,
37 public content::WebContentsUserData<ChromeAutofillClient>,
38 public content::WebContentsObserver,
39 public ui_zoom::ZoomObserver {
40 public:
41 ~ChromeAutofillClient() override;
43 // Called when the tab corresponding to |this| instance is activated.
44 void TabActivated();
46 // AutofillClient:
47 PersonalDataManager* GetPersonalDataManager() override;
48 scoped_refptr<AutofillWebDataService> GetDatabase() override;
49 PrefService* GetPrefs() override;
50 IdentityProvider* GetIdentityProvider() override;
51 rappor::RapporService* GetRapporService() override;
52 void HideRequestAutocompleteDialog() override;
53 void ShowAutofillSettings() override;
54 void ShowUnmaskPrompt(const CreditCard& card,
55 base::WeakPtr<CardUnmaskDelegate> delegate) override;
56 void OnUnmaskVerificationResult(GetRealPanResult result) override;
57 void ConfirmSaveCreditCard(const base::Closure& save_card_callback) override;
58 bool HasCreditCardScanFeature() override;
59 void ScanCreditCard(const CreditCardScanCallback& callback) override;
60 void ShowRequestAutocompleteDialog(
61 const FormData& form,
62 content::RenderFrameHost* render_frame_host,
63 const ResultCallback& callback) override;
64 void ShowAutofillPopup(
65 const gfx::RectF& element_bounds,
66 base::i18n::TextDirection text_direction,
67 const std::vector<autofill::Suggestion>& suggestions,
68 base::WeakPtr<AutofillPopupDelegate> delegate) override;
69 void UpdateAutofillPopupDataListValues(
70 const std::vector<base::string16>& values,
71 const std::vector<base::string16>& labels) override;
72 void HideAutofillPopup() override;
73 bool IsAutocompleteEnabled() override;
74 void PropagateAutofillPredictions(
75 content::RenderFrameHost* rfh,
76 const std::vector<autofill::FormStructure*>& forms) override;
77 void DidFillOrPreviewField(const base::string16& autofilled_value,
78 const base::string16& profile_full_name) override;
79 void OnFirstUserGestureObserved() override;
80 void LinkClicked(const GURL& url, WindowOpenDisposition disposition) override;
81 bool IsContextSecure(const GURL& form_origin) override;
83 // content::WebContentsObserver implementation.
84 void RenderFrameDeleted(content::RenderFrameHost* rfh) override;
85 void DidNavigateAnyFrame(
86 content::RenderFrameHost* render_frame_host,
87 const content::LoadCommittedDetails& details,
88 const content::FrameNavigateParams& params) override;
89 void MainFrameWasResized(bool width_changed) override;
90 void WebContentsDestroyed() override;
92 // ZoomObserver implementation.
93 void OnZoomChanged(
94 const ui_zoom::ZoomController::ZoomChangedEventData& data) override;
96 // Exposed for testing.
97 AutofillDialogController* GetDialogControllerForTesting() {
98 return dialog_controller_.get();
100 void SetDialogControllerForTesting(
101 const base::WeakPtr<AutofillDialogController>& dialog_controller) {
102 dialog_controller_ = dialog_controller;
105 private:
106 explicit ChromeAutofillClient(content::WebContents* web_contents);
107 friend class content::WebContentsUserData<ChromeAutofillClient>;
109 base::WeakPtr<AutofillDialogController> dialog_controller_;
110 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_;
111 CardUnmaskPromptControllerImpl unmask_controller_;
113 // The last render frame that called requestAutocomplete.
114 content::RenderFrameHost* last_rfh_to_rac_;
116 // The identity provider, used for Wallet integration.
117 scoped_ptr<IdentityProvider> identity_provider_;
119 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient);
122 } // namespace autofill
124 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_