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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Different ways to hide the keyboard. | 42 // Different ways to hide the keyboard. |
43 enum HideReason { | 43 enum HideReason { |
44 // System initiated. | 44 // System initiated. |
45 HIDE_REASON_AUTOMATIC, | 45 HIDE_REASON_AUTOMATIC, |
46 // User initiated. | 46 // User initiated. |
47 HIDE_REASON_MANUAL, | 47 HIDE_REASON_MANUAL, |
48 }; | 48 }; |
49 | 49 |
50 // Takes ownership of |proxy|. | 50 // Takes ownership of |proxy|. |
51 explicit KeyboardController(KeyboardControllerProxy* proxy); | 51 explicit KeyboardController(KeyboardControllerProxy* proxy); |
52 virtual ~KeyboardController(); | 52 ~KeyboardController() override; |
53 | 53 |
54 // Returns the container for the keyboard, which is owned by | 54 // Returns the container for the keyboard, which is owned by |
55 // KeyboardController. | 55 // KeyboardController. |
56 aura::Window* GetContainerWindow(); | 56 aura::Window* GetContainerWindow(); |
57 | 57 |
58 // Whether the container window for the keyboard has been initialized. | 58 // Whether the container window for the keyboard has been initialized. |
59 bool keyboard_container_initialized() const { | 59 bool keyboard_container_initialized() const { |
60 return container_.get() != NULL; | 60 return container_.get() != NULL; |
61 } | 61 } |
62 | 62 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 bool ShouldEnableInsets(aura::Window* window); | 108 bool ShouldEnableInsets(aura::Window* window); |
109 | 109 |
110 // Updates insets on web content window | 110 // Updates insets on web content window |
111 void UpdateWindowInsets(aura::Window* window); | 111 void UpdateWindowInsets(aura::Window* window); |
112 | 112 |
113 private: | 113 private: |
114 // For access to Observer methods for simulation. | 114 // For access to Observer methods for simulation. |
115 friend class KeyboardControllerTest; | 115 friend class KeyboardControllerTest; |
116 | 116 |
117 // aura::WindowObserver overrides | 117 // aura::WindowObserver overrides |
118 virtual void OnWindowHierarchyChanged( | 118 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; |
119 const HierarchyChangeParams& params) override; | |
120 | 119 |
121 // InputMethodObserver overrides | 120 // InputMethodObserver overrides |
122 virtual void OnTextInputTypeChanged( | 121 void OnTextInputTypeChanged(const ui::TextInputClient* client) override {} |
123 const ui::TextInputClient* client) override {} | 122 void OnFocus() override {} |
124 virtual void OnFocus() override {} | 123 void OnBlur() override {} |
125 virtual void OnBlur() override {} | 124 void OnCaretBoundsChanged(const ui::TextInputClient* client) override {} |
126 virtual void OnCaretBoundsChanged( | 125 void OnTextInputStateChanged(const ui::TextInputClient* client) override; |
127 const ui::TextInputClient* client) override {} | 126 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override; |
128 virtual void OnTextInputStateChanged( | 127 void OnShowImeIfNeeded() override; |
129 const ui::TextInputClient* client) override; | |
130 virtual void OnInputMethodDestroyed( | |
131 const ui::InputMethod* input_method) override; | |
132 virtual void OnShowImeIfNeeded() override; | |
133 | 128 |
134 // Show virtual keyboard immediately with animation. | 129 // Show virtual keyboard immediately with animation. |
135 void ShowKeyboardInternal(); | 130 void ShowKeyboardInternal(); |
136 | 131 |
137 // Clears any insets on web content windows. | 132 // Clears any insets on web content windows. |
138 void ResetWindowInsets(); | 133 void ResetWindowInsets(); |
139 | 134 |
140 // Returns true if keyboard is scheduled to hide. | 135 // Returns true if keyboard is scheduled to hide. |
141 bool WillHideKeyboard() const; | 136 bool WillHideKeyboard() const; |
142 | 137 |
(...skipping 29 matching lines...) Expand all Loading... |
172 static KeyboardController* instance_; | 167 static KeyboardController* instance_; |
173 | 168 |
174 base::WeakPtrFactory<KeyboardController> weak_factory_; | 169 base::WeakPtrFactory<KeyboardController> weak_factory_; |
175 | 170 |
176 DISALLOW_COPY_AND_ASSIGN(KeyboardController); | 171 DISALLOW_COPY_AND_ASSIGN(KeyboardController); |
177 }; | 172 }; |
178 | 173 |
179 } // namespace keyboard | 174 } // namespace keyboard |
180 | 175 |
181 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ | 176 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ |
OLD | NEW |