| 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) |
| 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 class AutofillKeystoneObserverMac; |
| 25 class AutofillPopupControllerImpl; | 30 class AutofillPopupControllerImpl; |
| 26 struct FormData; | 31 struct FormData; |
| 27 | 32 |
| 28 // Chrome implementation of AutofillClient. | 33 // Chrome implementation of AutofillClient. |
| 29 class ChromeAutofillClient | 34 class ChromeAutofillClient |
| 30 : public AutofillClient, | 35 : public AutofillClient, |
| 36 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 37 public AutofillKeystoneObserverMacDelegate, |
| 38 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 31 public content::WebContentsUserData<ChromeAutofillClient>, | 39 public content::WebContentsUserData<ChromeAutofillClient>, |
| 32 public content::WebContentsObserver { | 40 public content::WebContentsObserver { |
| 33 public: | 41 public: |
| 34 virtual ~ChromeAutofillClient(); | 42 virtual ~ChromeAutofillClient(); |
| 35 | 43 |
| 36 // Called when the tab corresponding to |this| instance is activated. | 44 // Called when the tab corresponding to |this| instance is activated. |
| 37 void TabActivated(); | 45 void TabActivated(); |
| 38 | 46 |
| 39 // AutofillClient: | 47 // AutofillClient: |
| 40 virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE; | 48 virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 61 const std::vector<base::string16>& values, | 69 const std::vector<base::string16>& values, |
| 62 const std::vector<base::string16>& labels) OVERRIDE; | 70 const std::vector<base::string16>& labels) OVERRIDE; |
| 63 virtual void HideAutofillPopup() OVERRIDE; | 71 virtual void HideAutofillPopup() OVERRIDE; |
| 64 virtual bool IsAutocompleteEnabled() OVERRIDE; | 72 virtual bool IsAutocompleteEnabled() OVERRIDE; |
| 65 virtual void DetectAccountCreationForms( | 73 virtual void DetectAccountCreationForms( |
| 66 const std::vector<autofill::FormStructure*>& forms) OVERRIDE; | 74 const std::vector<autofill::FormStructure*>& forms) OVERRIDE; |
| 67 virtual void DidFillOrPreviewField( | 75 virtual void DidFillOrPreviewField( |
| 68 const base::string16& autofilled_value, | 76 const base::string16& autofilled_value, |
| 69 const base::string16& profile_full_name) OVERRIDE; | 77 const base::string16& profile_full_name) OVERRIDE; |
| 70 | 78 |
| 79 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 80 // AutofillKeystoneObserverMacDelegate: |
| 81 virtual void OnKeystoneNotification( |
| 82 keystone_glue::AutoupdateStatus status) OVERRIDE; |
| 83 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 84 |
| 71 // content::WebContentsObserver implementation. | 85 // content::WebContentsObserver implementation. |
| 72 virtual void WebContentsDestroyed() OVERRIDE; | 86 virtual void WebContentsDestroyed() OVERRIDE; |
| 73 | 87 |
| 74 // Exposed for testing. | 88 // Exposed for testing. |
| 75 AutofillDialogController* GetDialogControllerForTesting() { | 89 AutofillDialogController* GetDialogControllerForTesting() { |
| 76 return dialog_controller_.get(); | 90 return dialog_controller_.get(); |
| 77 } | 91 } |
| 78 void SetDialogControllerForTesting( | 92 void SetDialogControllerForTesting( |
| 79 const base::WeakPtr<AutofillDialogController>& dialog_controller) { | 93 const base::WeakPtr<AutofillDialogController>& dialog_controller) { |
| 80 dialog_controller_ = dialog_controller; | 94 dialog_controller_ = dialog_controller; |
| 81 } | 95 } |
| 82 | 96 |
| 83 private: | 97 private: |
| 98 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 99 void AddKeystoneObserver(); |
| 100 void RemoveKeystoneObserver(); |
| 101 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 102 |
| 84 explicit ChromeAutofillClient(content::WebContents* web_contents); | 103 explicit ChromeAutofillClient(content::WebContents* web_contents); |
| 85 friend class content::WebContentsUserData<ChromeAutofillClient>; | 104 friend class content::WebContentsUserData<ChromeAutofillClient>; |
| 86 | 105 |
| 87 content::WebContents* const web_contents_; | 106 content::WebContents* const web_contents_; |
| 88 base::WeakPtr<AutofillDialogController> dialog_controller_; | 107 base::WeakPtr<AutofillDialogController> dialog_controller_; |
| 89 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; | 108 base::WeakPtr<AutofillPopupControllerImpl> popup_controller_; |
| 90 | 109 |
| 110 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 111 // The class of this property must remain a forward declaration, even in the |
| 112 // .cc implementation file, since the header file for the class requires |
| 113 // ObjC++ to compile. This means that the pointer cannot be wrapped in a |
| 114 // scoped_ptr. |
| 115 AutofillKeystoneObserverMac* keystone_observer_; |
| 116 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 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 |