Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: chrome/browser/ui/autofill/chrome_autofill_client.h

Issue 710453002: [Autofill] Componentize AutofillCCInfoBarDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_CHROME_AUTOFILL_CLIENT_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_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/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "components/autofill/core/browser/autofill_client.h" 13 #include "components/autofill/core/browser/autofill_client.h"
14 #include "components/ui/zoom/zoom_observer.h" 14 #include "components/ui/zoom/zoom_observer.h"
15 #include "content/public/browser/web_contents_observer.h" 15 #include "content/public/browser/web_contents_observer.h"
16 #include "content/public/browser/web_contents_user_data.h" 16 #include "content/public/browser/web_contents_user_data.h"
17 17
18 class ConfirmInfoBarDelegate;
19
18 namespace content { 20 namespace content {
19 struct FrameNavigateParams; 21 struct FrameNavigateParams;
20 struct LoadCommittedDetails; 22 struct LoadCommittedDetails;
21 class WebContents; 23 class WebContents;
22 } 24 }
23 25
26 namespace infobars {
27 class InfoBar;
28 class InfoBarManager;
29 }
30
24 namespace autofill { 31 namespace autofill {
25 32
26 class AutofillDialogController; 33 class AutofillDialogController;
27 class AutofillKeystoneBridgeWrapper; 34 class AutofillKeystoneBridgeWrapper;
35 class AutofillManager;
28 class AutofillPopupControllerImpl; 36 class AutofillPopupControllerImpl;
29 class CreditCardScannerController; 37 class CreditCardScannerController;
30 struct FormData; 38 struct FormData;
31 39
32 // Chrome implementation of AutofillClient. 40 // Chrome implementation of AutofillClient.
33 class ChromeAutofillClient 41 class ChromeAutofillClient
34 : public AutofillClient, 42 : public AutofillClient,
35 public content::WebContentsUserData<ChromeAutofillClient>, 43 public content::WebContentsUserData<ChromeAutofillClient>,
36 public content::WebContentsObserver, 44 public content::WebContentsObserver,
37 public ui_zoom::ZoomObserver { 45 public ui_zoom::ZoomObserver {
38 public: 46 public:
39 ~ChromeAutofillClient() override; 47 ~ChromeAutofillClient() override;
40 48
41 // Called when the tab corresponding to |this| instance is activated. 49 // Called when the tab corresponding to |this| instance is activated.
42 void TabActivated(); 50 void TabActivated();
43 51
44 // AutofillClient: 52 // AutofillClient:
45 PersonalDataManager* GetPersonalDataManager() override; 53 PersonalDataManager* GetPersonalDataManager() override;
46 scoped_refptr<AutofillWebDataService> GetDatabase() override; 54 scoped_refptr<AutofillWebDataService> GetDatabase() override;
47 PrefService* GetPrefs() override; 55 PrefService* GetPrefs() override;
48 void HideRequestAutocompleteDialog() override; 56 void HideRequestAutocompleteDialog() override;
49 void ShowAutofillSettings() override; 57 void ShowAutofillSettings() override;
50 void ShowUnmaskPrompt() override; 58 void ShowUnmaskPrompt() override;
51 void ConfirmSaveCreditCard(const base::Closure& save_card_callback) override; 59 void ConfirmSaveCreditCard(AutofillManager* autofill_manager,
60 const base::Closure& save_card_callback) override;
52 bool HasCreditCardScanFeature() override; 61 bool HasCreditCardScanFeature() override;
53 void ScanCreditCard(const CreditCardScanCallback& callback) override; 62 void ScanCreditCard(const CreditCardScanCallback& callback) override;
54 void ShowRequestAutocompleteDialog(const FormData& form, 63 void ShowRequestAutocompleteDialog(const FormData& form,
55 const GURL& source_url, 64 const GURL& source_url,
56 const ResultCallback& callback) override; 65 const ResultCallback& callback) override;
57 void ShowAutofillPopup( 66 void ShowAutofillPopup(
58 const gfx::RectF& element_bounds, 67 const gfx::RectF& element_bounds,
59 base::i18n::TextDirection text_direction, 68 base::i18n::TextDirection text_direction,
60 const std::vector<base::string16>& values, 69 const std::vector<base::string16>& values,
61 const std::vector<base::string16>& labels, 70 const std::vector<base::string16>& labels,
62 const std::vector<base::string16>& icons, 71 const std::vector<base::string16>& icons,
63 const std::vector<int>& identifiers, 72 const std::vector<int>& identifiers,
64 base::WeakPtr<AutofillPopupDelegate> delegate) override; 73 base::WeakPtr<AutofillPopupDelegate> delegate) override;
65 void UpdateAutofillPopupDataListValues( 74 void UpdateAutofillPopupDataListValues(
66 const std::vector<base::string16>& values, 75 const std::vector<base::string16>& values,
67 const std::vector<base::string16>& labels) override; 76 const std::vector<base::string16>& labels) override;
68 void HideAutofillPopup() override; 77 void HideAutofillPopup() override;
69 bool IsAutocompleteEnabled() override; 78 bool IsAutocompleteEnabled() override;
70 void DetectAccountCreationForms( 79 void DetectAccountCreationForms(
71 content::RenderFrameHost* rfh, 80 content::RenderFrameHost* rfh,
72 const std::vector<autofill::FormStructure*>& forms) override; 81 const std::vector<autofill::FormStructure*>& forms) override;
73 void DidFillOrPreviewField(const base::string16& autofilled_value, 82 void DidFillOrPreviewField(const base::string16& autofilled_value,
74 const base::string16& profile_full_name) override; 83 const base::string16& profile_full_name) override;
75 void OnFirstUserGestureObserved() override; 84 void OnFirstUserGestureObserved() override;
85 scoped_ptr<infobars::InfoBar> CreateInfoBar(
86 scoped_ptr<ConfirmInfoBarDelegate> delegate) override;
76 87
77 // content::WebContentsObserver implementation. 88 // content::WebContentsObserver implementation.
78 void WebContentsDestroyed() override; 89 void WebContentsDestroyed() override;
79 90
80 // ZoomObserver implementation. 91 // ZoomObserver implementation.
81 void OnZoomChanged( 92 void OnZoomChanged(
82 const ui_zoom::ZoomController::ZoomChangedEventData& data) override; 93 const ui_zoom::ZoomController::ZoomChangedEventData& data) override;
83 94
84 // Exposed for testing. 95 // Exposed for testing.
85 AutofillDialogController* GetDialogControllerForTesting() { 96 AutofillDialogController* GetDialogControllerForTesting() {
86 return dialog_controller_.get(); 97 return dialog_controller_.get();
87 } 98 }
88 void SetDialogControllerForTesting( 99 void SetDialogControllerForTesting(
89 const base::WeakPtr<AutofillDialogController>& dialog_controller) { 100 const base::WeakPtr<AutofillDialogController>& dialog_controller) {
90 dialog_controller_ = dialog_controller; 101 dialog_controller_ = dialog_controller;
91 } 102 }
92 103
93 private: 104 private:
105 // Gets the InfoBarManager instance associated with the client.
106 infobars::InfoBarManager* GetInfoBarManager();
107
94 #if defined(OS_MACOSX) && !defined(OS_IOS) 108 #if defined(OS_MACOSX) && !defined(OS_IOS)
95 // Creates |bridge_wrapper_|, which is responsible for dealing with Keystone 109 // Creates |bridge_wrapper_|, which is responsible for dealing with Keystone
96 // notifications. 110 // notifications.
97 void RegisterForKeystoneNotifications(); 111 void RegisterForKeystoneNotifications();
98 112
99 // Deletes |bridge_wrapper_|. 113 // Deletes |bridge_wrapper_|.
100 void UnregisterFromKeystoneNotifications(); 114 void UnregisterFromKeystoneNotifications();
101 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 115 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
102 116
103 void OnUnmaskResponse(const base::string16& response); 117 void OnUnmaskResponse(const base::string16& response);
(...skipping 16 matching lines...) Expand all
120 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 134 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
121 135
122 base::WeakPtrFactory<ChromeAutofillClient> weak_pointer_factory_; 136 base::WeakPtrFactory<ChromeAutofillClient> weak_pointer_factory_;
123 137
124 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient); 138 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient);
125 }; 139 };
126 140
127 } // namespace autofill 141 } // namespace autofill
128 142
129 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ 143 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698