OLD | NEW |
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/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "components/autofill/core/browser/autofill_client.h" | 12 #include "components/autofill/core/browser/autofill_client.h" |
13 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
14 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 struct FrameNavigateParams; | 17 struct FrameNavigateParams; |
18 struct LoadCommittedDetails; | 18 struct LoadCommittedDetails; |
19 class WebContents; | 19 class WebContents; |
20 } | 20 } |
21 | 21 |
22 namespace autofill { | 22 namespace autofill { |
23 | 23 |
24 class AutofillDialogController; | 24 class AutofillDialogController; |
| 25 class AutofillKeystoneBridgeWrapper; |
25 class AutofillPopupControllerImpl; | 26 class AutofillPopupControllerImpl; |
26 struct FormData; | 27 struct FormData; |
27 | 28 |
28 // Chrome implementation of AutofillClient. | 29 // Chrome implementation of AutofillClient. |
29 class ChromeAutofillClient | 30 class ChromeAutofillClient |
30 : public AutofillClient, | 31 : public AutofillClient, |
31 public content::WebContentsUserData<ChromeAutofillClient>, | 32 public content::WebContentsUserData<ChromeAutofillClient>, |
32 public content::WebContentsObserver { | 33 public content::WebContentsObserver { |
33 public: | 34 public: |
34 virtual ~ChromeAutofillClient(); | 35 virtual ~ChromeAutofillClient(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // Exposed for testing. | 75 // Exposed for testing. |
75 AutofillDialogController* GetDialogControllerForTesting() { | 76 AutofillDialogController* GetDialogControllerForTesting() { |
76 return dialog_controller_.get(); | 77 return dialog_controller_.get(); |
77 } | 78 } |
78 void SetDialogControllerForTesting( | 79 void SetDialogControllerForTesting( |
79 const base::WeakPtr<AutofillDialogController>& dialog_controller) { | 80 const base::WeakPtr<AutofillDialogController>& dialog_controller) { |
80 dialog_controller_ = dialog_controller; | 81 dialog_controller_ = dialog_controller; |
81 } | 82 } |
82 | 83 |
83 private: | 84 private: |
| 85 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 86 // Creates |bridge_wrapper_|, which is responsible for dealing with Keystone |
| 87 // notifications. |
| 88 void RegisterForKeystoneNotifications(); |
| 89 |
| 90 // Deletes |bridge_wrapper_|. |
| 91 void UnregisterFromKeystoneNotifications(); |
| 92 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 93 |
84 explicit ChromeAutofillClient(content::WebContents* web_contents); | 94 explicit ChromeAutofillClient(content::WebContents* web_contents); |
85 friend class content::WebContentsUserData<ChromeAutofillClient>; | 95 friend class content::WebContentsUserData<ChromeAutofillClient>; |
86 | 96 |
87 content::WebContents* const web_contents_; | 97 content::WebContents* const web_contents_; |
88 base::WeakPtr<AutofillDialogController> dialog_controller_; | 98 base::WeakPtr<AutofillDialogController> dialog_controller_; |
89 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; | 99 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; |
90 | 100 |
| 101 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 102 // Listens to Keystone notifications and passes relevant ones on to the |
| 103 // PersonalDataManager. |
| 104 // |
| 105 // The class of this member must remain a forward declaration, even in the |
| 106 // .cc implementation file, since the class is defined in a Mac-only |
| 107 // implementation file. This means that the pointer cannot be wrapped in a |
| 108 // scoped_ptr. |
| 109 AutofillKeystoneBridgeWrapper* bridge_wrapper_; |
| 110 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 111 |
91 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient); | 112 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient); |
92 }; | 113 }; |
93 | 114 |
94 } // namespace autofill | 115 } // namespace autofill |
95 | 116 |
96 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ | 117 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ |
OLD | NEW |