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_H_ | 5 #ifndef UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ |
6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ | 6 #define UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/event_types.h" | 9 #include "base/event_types.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 }; | 45 }; |
46 | 46 |
47 // Takes ownership of |proxy|. | 47 // Takes ownership of |proxy|. |
48 explicit KeyboardController(KeyboardControllerProxy* proxy); | 48 explicit KeyboardController(KeyboardControllerProxy* proxy); |
49 virtual ~KeyboardController(); | 49 virtual ~KeyboardController(); |
50 | 50 |
51 // Returns the container for the keyboard, which is owned by | 51 // Returns the container for the keyboard, which is owned by |
52 // KeyboardController. | 52 // KeyboardController. |
53 aura::Window* GetContainerWindow(); | 53 aura::Window* GetContainerWindow(); |
54 | 54 |
| 55 // Whether the container window for the keyboard has been initialized. |
| 56 bool keyboard_container_initialized() const { |
| 57 return container_.get() != NULL; |
| 58 } |
| 59 |
55 // Sets the override content url. This is used by for input view for extension | 60 // Sets the override content url. This is used by for input view for extension |
56 // IMEs. | 61 // IMEs. |
57 void SetOverrideContentUrl(const GURL& url); | 62 void SetOverrideContentUrl(const GURL& url); |
58 | 63 |
59 // Hides virtual keyboard and notifies observer bounds change. | 64 // Hides virtual keyboard and notifies observer bounds change. |
60 // This function should be called with a delay to avoid layout flicker | 65 // This function should be called with a delay to avoid layout flicker |
61 // when the focus of input field quickly change. |automatic| is true when the | 66 // when the focus of input field quickly change. |automatic| is true when the |
62 // call is made by the system rather than initiated by the user. | 67 // call is made by the system rather than initiated by the user. |
63 void HideKeyboard(HideReason reason); | 68 void HideKeyboard(HideReason reason); |
64 | 69 |
(...skipping 20 matching lines...) Expand all Loading... |
85 virtual void OnTextInputTypeChanged( | 90 virtual void OnTextInputTypeChanged( |
86 const ui::TextInputClient* client) OVERRIDE {} | 91 const ui::TextInputClient* client) OVERRIDE {} |
87 virtual void OnFocus() OVERRIDE {} | 92 virtual void OnFocus() OVERRIDE {} |
88 virtual void OnBlur() OVERRIDE {} | 93 virtual void OnBlur() OVERRIDE {} |
89 virtual void OnCaretBoundsChanged( | 94 virtual void OnCaretBoundsChanged( |
90 const ui::TextInputClient* client) OVERRIDE {} | 95 const ui::TextInputClient* client) OVERRIDE {} |
91 virtual void OnTextInputStateChanged( | 96 virtual void OnTextInputStateChanged( |
92 const ui::TextInputClient* client) OVERRIDE; | 97 const ui::TextInputClient* client) OVERRIDE; |
93 virtual void OnInputMethodDestroyed( | 98 virtual void OnInputMethodDestroyed( |
94 const ui::InputMethod* input_method) OVERRIDE; | 99 const ui::InputMethod* input_method) OVERRIDE; |
| 100 virtual void OnShowImeIfNeeded() OVERRIDE; |
95 | 101 |
96 // Returns true if keyboard is scheduled to hide. | 102 // Returns true if keyboard is scheduled to hide. |
97 bool WillHideKeyboard() const; | 103 bool WillHideKeyboard() const; |
98 | 104 |
99 scoped_ptr<KeyboardControllerProxy> proxy_; | 105 scoped_ptr<KeyboardControllerProxy> proxy_; |
100 scoped_ptr<aura::Window> container_; | 106 scoped_ptr<aura::Window> container_; |
101 ui::InputMethod* input_method_; | 107 ui::InputMethod* input_method_; |
102 bool keyboard_visible_; | 108 bool keyboard_visible_; |
103 bool lock_keyboard_; | 109 bool lock_keyboard_; |
104 | 110 |
105 ObserverList<KeyboardControllerObserver> observer_list_; | 111 ObserverList<KeyboardControllerObserver> observer_list_; |
106 | 112 |
107 base::WeakPtrFactory<KeyboardController> weak_factory_; | 113 base::WeakPtrFactory<KeyboardController> weak_factory_; |
108 | 114 |
109 DISALLOW_COPY_AND_ASSIGN(KeyboardController); | 115 DISALLOW_COPY_AND_ASSIGN(KeyboardController); |
110 }; | 116 }; |
111 | 117 |
112 } // namespace keyboard | 118 } // namespace keyboard |
113 | 119 |
114 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ | 120 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ |
OLD | NEW |