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/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 "base/scoped_observer.h" |
13 #include "components/autofill/core/browser/autofill_client.h" | 14 #include "components/autofill/core/browser/autofill_client.h" |
14 #include "components/ui/zoom/zoom_observer.h" | 15 #include "components/ui/zoom/zoom_observer.h" |
15 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
16 #include "content/public/browser/web_contents_user_data.h" | 17 #include "content/public/browser/web_contents_user_data.h" |
| 18 #include "ui/gfx/display_observer.h" |
| 19 #include "ui/gfx/screen.h" |
17 | 20 |
18 namespace content { | 21 namespace content { |
19 struct FrameNavigateParams; | 22 struct FrameNavigateParams; |
20 struct LoadCommittedDetails; | 23 struct LoadCommittedDetails; |
21 class WebContents; | 24 class WebContents; |
22 } | 25 } |
23 | 26 |
24 namespace autofill { | 27 namespace autofill { |
25 | 28 |
26 class AutofillDialogController; | 29 class AutofillDialogController; |
27 class AutofillKeystoneBridgeWrapper; | 30 class AutofillKeystoneBridgeWrapper; |
28 class AutofillPopupControllerImpl; | 31 class AutofillPopupControllerImpl; |
29 class CreditCardScannerController; | 32 class CreditCardScannerController; |
30 struct FormData; | 33 struct FormData; |
31 | 34 |
32 // Chrome implementation of AutofillClient. | 35 // Chrome implementation of AutofillClient. |
33 class ChromeAutofillClient | 36 class ChromeAutofillClient |
34 : public AutofillClient, | 37 : public AutofillClient, |
35 public content::WebContentsUserData<ChromeAutofillClient>, | 38 public content::WebContentsUserData<ChromeAutofillClient>, |
36 public content::WebContentsObserver, | 39 public content::WebContentsObserver, |
37 public ui_zoom::ZoomObserver { | 40 public ui_zoom::ZoomObserver, |
| 41 public gfx::DisplayObserver { |
38 public: | 42 public: |
39 ~ChromeAutofillClient() override; | 43 ~ChromeAutofillClient() override; |
40 | 44 |
41 // Called when the tab corresponding to |this| instance is activated. | 45 // Called when the tab corresponding to |this| instance is activated. |
42 void TabActivated(); | 46 void TabActivated(); |
43 | 47 |
44 // AutofillClient: | 48 // AutofillClient: |
45 PersonalDataManager* GetPersonalDataManager() override; | 49 PersonalDataManager* GetPersonalDataManager() override; |
46 scoped_refptr<AutofillWebDataService> GetDatabase() override; | 50 scoped_refptr<AutofillWebDataService> GetDatabase() override; |
47 PrefService* GetPrefs() override; | 51 PrefService* GetPrefs() override; |
(...skipping 23 matching lines...) Expand all Loading... |
71 const base::string16& profile_full_name) override; | 75 const base::string16& profile_full_name) override; |
72 void OnFirstUserGestureObserved() override; | 76 void OnFirstUserGestureObserved() override; |
73 | 77 |
74 // content::WebContentsObserver implementation. | 78 // content::WebContentsObserver implementation. |
75 void WebContentsDestroyed() override; | 79 void WebContentsDestroyed() override; |
76 | 80 |
77 // ZoomObserver implementation. | 81 // ZoomObserver implementation. |
78 void OnZoomChanged( | 82 void OnZoomChanged( |
79 const ui_zoom::ZoomController::ZoomChangedEventData& data) override; | 83 const ui_zoom::ZoomController::ZoomChangedEventData& data) override; |
80 | 84 |
| 85 // gfx::DisplayObserver implementation. |
| 86 void OnDisplayAdded(const gfx::Display& new_display) override; |
| 87 void OnDisplayRemoved(const gfx::Display& old_display) override; |
| 88 void OnDisplayMetricsChanged(const gfx::Display& display, |
| 89 uint32_t changed_metrics) override; |
| 90 |
81 // Exposed for testing. | 91 // Exposed for testing. |
82 AutofillDialogController* GetDialogControllerForTesting() { | 92 AutofillDialogController* GetDialogControllerForTesting() { |
83 return dialog_controller_.get(); | 93 return dialog_controller_.get(); |
84 } | 94 } |
85 void SetDialogControllerForTesting( | 95 void SetDialogControllerForTesting( |
86 const base::WeakPtr<AutofillDialogController>& dialog_controller) { | 96 const base::WeakPtr<AutofillDialogController>& dialog_controller) { |
87 dialog_controller_ = dialog_controller; | 97 dialog_controller_ = dialog_controller; |
88 } | 98 } |
89 | 99 |
90 private: | 100 private: |
(...skipping 20 matching lines...) Expand all Loading... |
111 // | 121 // |
112 // The class of this member must remain a forward declaration, even in the | 122 // The class of this member must remain a forward declaration, even in the |
113 // .cc implementation file, since the class is defined in a Mac-only | 123 // .cc implementation file, since the class is defined in a Mac-only |
114 // implementation file. This means that the pointer cannot be wrapped in a | 124 // implementation file. This means that the pointer cannot be wrapped in a |
115 // scoped_ptr. | 125 // scoped_ptr. |
116 AutofillKeystoneBridgeWrapper* bridge_wrapper_; | 126 AutofillKeystoneBridgeWrapper* bridge_wrapper_; |
117 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 127 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
118 | 128 |
119 base::WeakPtrFactory<ChromeAutofillClient> weak_pointer_factory_; | 129 base::WeakPtrFactory<ChromeAutofillClient> weak_pointer_factory_; |
120 | 130 |
| 131 ScopedObserver<gfx::Screen, gfx::DisplayObserver> screen_observer_; |
| 132 |
121 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient); | 133 DISALLOW_COPY_AND_ASSIGN(ChromeAutofillClient); |
122 }; | 134 }; |
123 | 135 |
124 } // namespace autofill | 136 } // namespace autofill |
125 | 137 |
126 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ | 138 #endif // CHROME_BROWSER_UI_AUTOFILL_CHROME_AUTOFILL_CLIENT_H_ |
OLD | NEW |