OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ | 5 #ifndef UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ |
6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ | 6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/public/common/media_stream_request.h" | 9 #include "content/public/common/media_stream_request.h" |
10 #include "ui/aura/window_observer.h" | 10 #include "ui/aura/window_observer.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 namespace ui { | 25 namespace ui { |
26 class InputMethod; | 26 class InputMethod; |
27 } | 27 } |
28 namespace wm { | 28 namespace wm { |
29 class Shadow; | 29 class Shadow; |
30 } | 30 } |
31 | 31 |
32 namespace keyboard { | 32 namespace keyboard { |
33 | 33 |
| 34 class KeyboardController; |
| 35 |
34 // A proxy used by the KeyboardController to get access to the virtual | 36 // A proxy used by the KeyboardController to get access to the virtual |
35 // keyboard window. | 37 // keyboard window. |
36 class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver { | 38 class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver { |
37 public: | 39 public: |
38 class TestApi { | 40 class TestApi { |
39 public: | 41 public: |
40 explicit TestApi(KeyboardControllerProxy* proxy) : proxy_(proxy) {} | 42 explicit TestApi(KeyboardControllerProxy* proxy) : proxy_(proxy) {} |
41 | 43 |
42 const content::WebContents* keyboard_contents() { | 44 const content::WebContents* keyboard_contents() { |
43 return proxy_->keyboard_contents_.get(); | 45 return proxy_->keyboard_contents_.get(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // different. The URL can be different if user switch from password field to | 96 // different. The URL can be different if user switch from password field to |
95 // any other type input field. | 97 // any other type input field. |
96 // At password field, the system virtual keyboard is forced to load even if | 98 // At password field, the system virtual keyboard is forced to load even if |
97 // the current IME provides a customized virtual keyboard. This is needed to | 99 // the current IME provides a customized virtual keyboard. This is needed to |
98 // prevent IME virtual keyboard logging user's password. Once user switch to | 100 // prevent IME virtual keyboard logging user's password. Once user switch to |
99 // other input fields, the virtual keyboard should switch back to the IME | 101 // other input fields, the virtual keyboard should switch back to the IME |
100 // provided keyboard, or keep using the system virtual keyboard if IME doesn't | 102 // provided keyboard, or keep using the system virtual keyboard if IME doesn't |
101 // provide one. | 103 // provide one. |
102 virtual void ReloadKeyboardIfNeeded(); | 104 virtual void ReloadKeyboardIfNeeded(); |
103 | 105 |
| 106 // KeyboardController owns KeyboardControllerProxy so KeyboardControllerProxy |
| 107 // or its subclasses should not take ownership of the |controller|. |
| 108 // |controller| can be null when KeyboardController is destroying. |
| 109 virtual void SetController(KeyboardController* controller) {} |
| 110 |
104 protected: | 111 protected: |
105 // The implementation can choose to setup the WebContents before the virtual | 112 // The implementation can choose to setup the WebContents before the virtual |
106 // keyboard page is loaded (e.g. install a WebContentsObserver). | 113 // keyboard page is loaded (e.g. install a WebContentsObserver). |
107 // SetupWebContents() is called right after creating the WebContents, before | 114 // SetupWebContents() is called right after creating the WebContents, before |
108 // loading the keyboard page. | 115 // loading the keyboard page. |
109 virtual void SetupWebContents(content::WebContents* contents); | 116 virtual void SetupWebContents(content::WebContents* contents); |
110 | 117 |
111 // aura::WindowObserver overrides: | 118 // aura::WindowObserver overrides: |
112 void OnWindowBoundsChanged(aura::Window* window, | 119 void OnWindowBoundsChanged(aura::Window* window, |
113 const gfx::Rect& old_bounds, | 120 const gfx::Rect& old_bounds, |
(...skipping 19 matching lines...) Expand all Loading... |
133 | 140 |
134 scoped_ptr<content::WebContents> keyboard_contents_; | 141 scoped_ptr<content::WebContents> keyboard_contents_; |
135 scoped_ptr<wm::Shadow> shadow_; | 142 scoped_ptr<wm::Shadow> shadow_; |
136 | 143 |
137 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy); | 144 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy); |
138 }; | 145 }; |
139 | 146 |
140 } // namespace keyboard | 147 } // namespace keyboard |
141 | 148 |
142 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ | 149 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ |
OLD | NEW |