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

Side by Side Diff: chrome/browser/extensions/api/input/input.cc

Issue 219503003: Make keyboard controller a singleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #include "chrome/browser/extensions/api/input/input.h" 5 #include "chrome/browser/extensions/api/input/input.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 bool VirtualKeyboardPrivateHideKeyboardFunction::RunImpl() { 104 bool VirtualKeyboardPrivateHideKeyboardFunction::RunImpl() {
105 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 105 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
106 #if defined(USE_ASH) 106 #if defined(USE_ASH)
107 UMA_HISTOGRAM_ENUMERATION( 107 UMA_HISTOGRAM_ENUMERATION(
108 "VirtualKeyboard.KeyboardControlEvent", 108 "VirtualKeyboard.KeyboardControlEvent",
109 keyboard::KEYBOARD_CONTROL_HIDE_USER, 109 keyboard::KEYBOARD_CONTROL_HIDE_USER,
110 keyboard::KEYBOARD_CONTROL_MAX); 110 keyboard::KEYBOARD_CONTROL_MAX);
111 111
112 // Pass HIDE_REASON_MANUAL since calls to HideKeyboard as part of this API 112 // Pass HIDE_REASON_MANUAL since calls to HideKeyboard as part of this API
113 // would be user generated. 113 // would be user generated.
114 ash::Shell::GetInstance()->keyboard_controller()->HideKeyboard( 114 keyboard::KeyboardController::GetInstance()->HideKeyboard(
115 keyboard::KeyboardController::HIDE_REASON_MANUAL); 115 keyboard::KeyboardController::HIDE_REASON_MANUAL);
116 116
117 return true; 117 return true;
118 #else 118 #else
119 error_ = kNotYetImplementedError; 119 error_ = kNotYetImplementedError;
120 return false; 120 return false;
121 #endif 121 #endif
122 } 122 }
123 123
124 bool VirtualKeyboardPrivateLockKeyboardFunction::RunImpl() { 124 bool VirtualKeyboardPrivateLockKeyboardFunction::RunImpl() {
125 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 125 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
126 #if defined(USE_ASH) 126 #if defined(USE_ASH)
127 bool lock; 127 bool lock;
128 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(0, &lock)); 128 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(0, &lock));
129 ash::Shell::GetInstance()->keyboard_controller()->set_lock_keyboard(lock); 129 keyboard::KeyboardController::GetInstance()->set_lock_keyboard(lock);
130 return true; 130 return true;
131 #else 131 #else
132 error_ = kNotYetImplementedError; 132 error_ = kNotYetImplementedError;
133 return false; 133 return false;
134 #endif 134 #endif
135 } 135 }
136 136
137 bool VirtualKeyboardPrivateKeyboardLoadedFunction::RunImpl() { 137 bool VirtualKeyboardPrivateKeyboardLoadedFunction::RunImpl() {
138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
139 #if defined(USE_ASH) 139 #if defined(USE_ASH)
(...skipping 27 matching lines...) Expand all
167 167
168 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputAPI> > g_factory = 168 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputAPI> > g_factory =
169 LAZY_INSTANCE_INITIALIZER; 169 LAZY_INSTANCE_INITIALIZER;
170 170
171 // static 171 // static
172 BrowserContextKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { 172 BrowserContextKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() {
173 return g_factory.Pointer(); 173 return g_factory.Pointer();
174 } 174 }
175 175
176 } // namespace extensions 176 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698