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 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
erikchen
2014/06/12 23:54:41
This was a lot of #ifdef-ing. Let me know if you p
Ilya Sherman
2014/06/14 01:18:51
Would it make sense for the client to own a class
erikchen
2014/06/16 20:30:46
That adds another layer of indirection to reduce t
| |
17 #include "chrome/browser/autofill/autofill_keystone_observer_mac_delegate.h" | |
18 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | |
19 | |
16 namespace content { | 20 namespace content { |
17 struct FrameNavigateParams; | 21 struct FrameNavigateParams; |
18 struct LoadCommittedDetails; | 22 struct LoadCommittedDetails; |
19 class WebContents; | 23 class WebContents; |
20 } | 24 } |
21 | 25 |
22 namespace autofill { | 26 namespace autofill { |
23 | 27 |
24 class AutofillDialogController; | 28 class AutofillDialogController; |
29 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
30 class AutofillKeystoneObserverMac; | |
31 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | |
Ilya Sherman
2014/06/14 01:18:51
It's fine to forward-declare the class on all plat
erikchen
2014/06/16 20:30:46
I've removed the ifdefs here.
| |
25 class AutofillPopupControllerImpl; | 32 class AutofillPopupControllerImpl; |
26 struct FormData; | 33 struct FormData; |
27 | 34 |
28 // Chrome implementation of AutofillClient. | 35 // Chrome implementation of AutofillClient. |
29 class ChromeAutofillClient | 36 class ChromeAutofillClient |
30 : public AutofillClient, | 37 : public AutofillClient, |
38 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
39 public AutofillKeystoneObserverMacDelegate, | |
40 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | |
31 public content::WebContentsUserData<ChromeAutofillClient>, | 41 public content::WebContentsUserData<ChromeAutofillClient>, |
32 public content::WebContentsObserver { | 42 public content::WebContentsObserver { |
33 public: | 43 public: |
34 virtual ~ChromeAutofillClient(); | 44 virtual ~ChromeAutofillClient(); |
35 | 45 |
36 // Called when the tab corresponding to |this| instance is activated. | 46 // Called when the tab corresponding to |this| instance is activated. |
37 void TabActivated(); | 47 void TabActivated(); |
38 | 48 |
39 // AutofillClient: | 49 // AutofillClient: |
40 virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE; | 50 virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE; |
(...skipping 20 matching lines...) Expand all Loading... | |
61 const std::vector<base::string16>& values, | 71 const std::vector<base::string16>& values, |
62 const std::vector<base::string16>& labels) OVERRIDE; | 72 const std::vector<base::string16>& labels) OVERRIDE; |
63 virtual void HideAutofillPopup() OVERRIDE; | 73 virtual void HideAutofillPopup() OVERRIDE; |
64 virtual bool IsAutocompleteEnabled() OVERRIDE; | 74 virtual bool IsAutocompleteEnabled() OVERRIDE; |
65 virtual void DetectAccountCreationForms( | 75 virtual void DetectAccountCreationForms( |
66 const std::vector<autofill::FormStructure*>& forms) OVERRIDE; | 76 const std::vector<autofill::FormStructure*>& forms) OVERRIDE; |
67 virtual void DidFillOrPreviewField( | 77 virtual void DidFillOrPreviewField( |
68 const base::string16& autofilled_value, | 78 const base::string16& autofilled_value, |
69 const base::string16& profile_full_name) OVERRIDE; | 79 const base::string16& profile_full_name) OVERRIDE; |
70 | 80 |
81 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
82 // AutofillKeystoneObserverMacDelegate | |
Ilya Sherman
2014/06/14 01:18:51
nit: Please add a trailing colon.
erikchen
2014/06/16 20:30:46
Done.
| |
83 virtual void OnKeystoneNotification( | |
84 keystone_glue::AutoupdateStatus status) OVERRIDE; | |
85 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | |
86 | |
71 // content::WebContentsObserver implementation. | 87 // content::WebContentsObserver implementation. |
72 virtual void WebContentsDestroyed() OVERRIDE; | 88 virtual void WebContentsDestroyed() OVERRIDE; |
73 | 89 |
74 // Exposed for testing. | 90 // Exposed for testing. |
75 AutofillDialogController* GetDialogControllerForTesting() { | 91 AutofillDialogController* GetDialogControllerForTesting() { |
76 return dialog_controller_.get(); | 92 return dialog_controller_.get(); |
77 } | 93 } |
78 void SetDialogControllerForTesting( | 94 void SetDialogControllerForTesting( |
79 const base::WeakPtr<AutofillDialogController>& dialog_controller) { | 95 const base::WeakPtr<AutofillDialogController>& dialog_controller) { |
80 dialog_controller_ = dialog_controller; | 96 dialog_controller_ = dialog_controller; |
81 } | 97 } |
82 | 98 |
83 private: | 99 private: |
100 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
101 void AddKeystoneObserver(); | |
102 void RemoveKeystoneObserver(); | |
103 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | |
104 | |
84 explicit ChromeAutofillClient(content::WebContents* web_contents); | 105 explicit ChromeAutofillClient(content::WebContents* web_contents); |
85 friend class content::WebContentsUserData<ChromeAutofillClient>; | 106 friend class content::WebContentsUserData<ChromeAutofillClient>; |
86 | 107 |
87 content::WebContents* const web_contents_; | 108 content::WebContents* const web_contents_; |
88 base::WeakPtr<AutofillDialogController> dialog_controller_; | 109 base::WeakPtr<AutofillDialogController> dialog_controller_; |
89 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; | 110 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; |
Ilya Sherman
2014/06/14 01:18:51
nit: Please leave a blank line below this one.
erikchen
2014/06/16 20:30:46
Done.
| |
111 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
112 // The class of this property must remain a forward declaration, since the | |
113 // header file for the class requires ObjC++ to compile. This means that the | |
114 // pointer cannot be wrapped in a scoped_ptr. | |
Ilya Sherman
2014/06/14 01:18:51
I'm pretty sure that scoped_ptrs work fine with fo
erikchen
2014/06/16 20:30:46
I've updated the comment to further indicate why t
| |
115 AutofillKeystoneObserverMac* keystone_observer_; | |
116 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | |
90 | 117 |
91 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient); | 118 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient); |
92 }; | 119 }; |
93 | 120 |
94 } // namespace autofill | 121 } // namespace autofill |
95 | 122 |
96 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ | 123 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ |
OLD | NEW |