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

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: Fix root window controller unittets. 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. 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 // Returns true if keyboard is currently visible. 92 // Returns true if keyboard is currently visible.
85 bool keyboard_visible() { return keyboard_visible_; } 93 bool keyboard_visible() { return keyboard_visible_; }
86 94
87 private: 95 private:
88 // For access to Observer methods for simulation. 96 // For access to Observer methods for simulation.
89 friend class KeyboardControllerTest; 97 friend class KeyboardControllerTest;
90 98
91 // aura::WindowObserver overrides 99 // aura::WindowObserver overrides
92 virtual void OnWindowHierarchyChanged( 100 virtual void OnWindowHierarchyChanged(
93 const HierarchyChangeParams& params) OVERRIDE; 101 const HierarchyChangeParams& params) OVERRIDE;
(...skipping 30 matching lines...) Expand all
124 132
125 ui::InputMethod* input_method_; 133 ui::InputMethod* input_method_;
126 bool keyboard_visible_; 134 bool keyboard_visible_;
127 bool lock_keyboard_; 135 bool lock_keyboard_;
128 ui::TextInputType type_; 136 ui::TextInputType type_;
129 137
130 ObserverList<KeyboardControllerObserver> observer_list_; 138 ObserverList<KeyboardControllerObserver> observer_list_;
131 139
132 base::WeakPtrFactory<KeyboardController> weak_factory_; 140 base::WeakPtrFactory<KeyboardController> weak_factory_;
133 141
142 static KeyboardController* instance_;
143
134 DISALLOW_COPY_AND_ASSIGN(KeyboardController); 144 DISALLOW_COPY_AND_ASSIGN(KeyboardController);
135 }; 145 };
136 146
137 } // namespace keyboard 147 } // namespace keyboard
138 148
139 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_ 149 #endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc ('k') | ui/keyboard/keyboard_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698