Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: ui/keyboard/keyboard_controller.h

Issue 219503003: Make keyboard controller a singleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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.
sadrul 2014/03/31 18:44:10 Mention that the caller does not own the controlle
kevers 2014/04/01 15:57:10 Done.
85 static void ResetInstance(KeyboardController* controller);
86
87 // Retrieve the active keyboard controller.
88 static KeyboardController* GetInstance();
89
84 private: 90 private:
85 // For access to Observer methods for simulation. 91 // For access to Observer methods for simulation.
86 friend class KeyboardControllerTest; 92 friend class KeyboardControllerTest;
87 93
88 // aura::WindowObserver overrides 94 // aura::WindowObserver overrides
89 virtual void OnWindowHierarchyChanged( 95 virtual void OnWindowHierarchyChanged(
90 const HierarchyChangeParams& params) OVERRIDE; 96 const HierarchyChangeParams& params) OVERRIDE;
91 97
92 // InputMethodObserver overrides 98 // InputMethodObserver overrides
93 virtual void OnTextInputTypeChanged( 99 virtual void OnTextInputTypeChanged(
(...skipping 27 matching lines...) Expand all
121 127
122 ui::InputMethod* input_method_; 128 ui::InputMethod* input_method_;
123 bool keyboard_visible_; 129 bool keyboard_visible_;
124 bool lock_keyboard_; 130 bool lock_keyboard_;
125 ui::TextInputType type_; 131 ui::TextInputType type_;
126 132
127 ObserverList<KeyboardControllerObserver> observer_list_; 133 ObserverList<KeyboardControllerObserver> observer_list_;
128 134
129 base::WeakPtrFactory<KeyboardController> weak_factory_; 135 base::WeakPtrFactory<KeyboardController> weak_factory_;
130 136
137 static KeyboardController* instance_;
138
131 DISALLOW_COPY_AND_ASSIGN(KeyboardController); 139 DISALLOW_COPY_AND_ASSIGN(KeyboardController);
132 }; 140 };
133 141
134 } // namespace keyboard 142 } // namespace keyboard
135 143
136 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ 144 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698