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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 virtual void AddObserver(KeyboardControllerObserver* observer); | 74 virtual void AddObserver(KeyboardControllerObserver* observer); |
75 virtual void RemoveObserver(KeyboardControllerObserver* observer); | 75 virtual void RemoveObserver(KeyboardControllerObserver* observer); |
76 | 76 |
77 KeyboardControllerProxy* proxy() { return proxy_.get(); } | 77 KeyboardControllerProxy* proxy() { return proxy_.get(); } |
78 | 78 |
79 void set_lock_keyboard(bool lock) { lock_keyboard_ = lock; } | 79 void set_lock_keyboard(bool lock) { lock_keyboard_ = lock; } |
80 | 80 |
81 // Force the keyboard to show up if not showing and lock the keyboard. | 81 // Force the keyboard to show up if not showing and lock the keyboard. |
82 void ShowAndLockKeyboard(); | 82 void ShowAndLockKeyboard(); |
83 | 83 |
| 84 // Sets the active keyboard controller. KeyboardController takes ownership of |
| 85 // the instance. Calling ResetIntance with a new instance destroys the |
| 86 // previous one. May be called with NULL to clear the instance. |
| 87 static void ResetInstance(KeyboardController* controller); |
| 88 |
| 89 // Retrieve the active keyboard controller. |
| 90 static KeyboardController* GetInstance(); |
| 91 |
84 private: | 92 private: |
85 // For access to Observer methods for simulation. | 93 // For access to Observer methods for simulation. |
86 friend class KeyboardControllerTest; | 94 friend class KeyboardControllerTest; |
87 | 95 |
88 // aura::WindowObserver overrides | 96 // aura::WindowObserver overrides |
89 virtual void OnWindowHierarchyChanged( | 97 virtual void OnWindowHierarchyChanged( |
90 const HierarchyChangeParams& params) OVERRIDE; | 98 const HierarchyChangeParams& params) OVERRIDE; |
91 | 99 |
92 // InputMethodObserver overrides | 100 // InputMethodObserver overrides |
93 virtual void OnTextInputTypeChanged( | 101 virtual void OnTextInputTypeChanged( |
(...skipping 27 matching lines...) Expand all Loading... |
121 | 129 |
122 ui::InputMethod* input_method_; | 130 ui::InputMethod* input_method_; |
123 bool keyboard_visible_; | 131 bool keyboard_visible_; |
124 bool lock_keyboard_; | 132 bool lock_keyboard_; |
125 ui::TextInputType type_; | 133 ui::TextInputType type_; |
126 | 134 |
127 ObserverList<KeyboardControllerObserver> observer_list_; | 135 ObserverList<KeyboardControllerObserver> observer_list_; |
128 | 136 |
129 base::WeakPtrFactory<KeyboardController> weak_factory_; | 137 base::WeakPtrFactory<KeyboardController> weak_factory_; |
130 | 138 |
| 139 static KeyboardController* instance_; |
| 140 |
131 DISALLOW_COPY_AND_ASSIGN(KeyboardController); | 141 DISALLOW_COPY_AND_ASSIGN(KeyboardController); |
132 }; | 142 }; |
133 | 143 |
134 } // namespace keyboard | 144 } // namespace keyboard |
135 | 145 |
136 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ | 146 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ |
OLD | NEW |