OLD | NEW |
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" |
11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/browser/ui/chrome_pages.h" | 12 #include "chrome/browser/ui/chrome_pages.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/user_metrics.h" | 15 #include "content/public/browser/user_metrics.h" |
16 #include "extensions/browser/extension_function_registry.h" | 16 #include "extensions/browser/extension_function_registry.h" |
17 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
18 #include "ui/keyboard/keyboard_controller.h" | 18 #include "ui/keyboard/keyboard_controller.h" |
19 #include "ui/keyboard/keyboard_switches.h" | 19 #include "ui/keyboard/keyboard_switches.h" |
20 | 20 |
21 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
22 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 22 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
23 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 23 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
24 #include "chrome/browser/chromeos/login/users/user_manager.h" | 24 #include "components/user_manager/user_manager.h" |
25 #endif // OS_CHROMEOS | 25 #endif // OS_CHROMEOS |
26 | 26 |
27 #if defined(USE_ASH) | 27 #if defined(USE_ASH) |
28 #include "ash/root_window_controller.h" | 28 #include "ash/root_window_controller.h" |
29 #include "ash/shell.h" | 29 #include "ash/shell.h" |
30 #include "ui/aura/window_tree_host.h" | 30 #include "ui/aura/window_tree_host.h" |
31 #include "ui/keyboard/keyboard_util.h" | 31 #include "ui/keyboard/keyboard_util.h" |
32 #endif | 32 #endif |
33 | 33 |
34 #if !defined(USE_ASH) | 34 #if !defined(USE_ASH) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 return false; | 170 return false; |
171 #endif | 171 #endif |
172 } | 172 } |
173 | 173 |
174 bool VirtualKeyboardPrivateOpenSettingsFunction::RunSync() { | 174 bool VirtualKeyboardPrivateOpenSettingsFunction::RunSync() { |
175 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 175 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
176 #if defined(USE_ASH) | 176 #if defined(USE_ASH) |
177 #if defined(OS_CHROMEOS) | 177 #if defined(OS_CHROMEOS) |
178 // Do not try to open language options page if user is not logged in or | 178 // Do not try to open language options page if user is not logged in or |
179 // locked. | 179 // locked. |
180 if (!chromeos::UserManager::Get()->IsUserLoggedIn() || | 180 if (!user_manager::UserManager::Get()->IsUserLoggedIn() || |
181 chromeos::UserAddingScreen::Get()->IsRunning() || | 181 chromeos::UserAddingScreen::Get()->IsRunning() || |
182 (chromeos::ScreenLocker::default_screen_locker() && | 182 (chromeos::ScreenLocker::default_screen_locker() && |
183 chromeos::ScreenLocker::default_screen_locker()->locked())) | 183 chromeos::ScreenLocker::default_screen_locker()->locked())) |
184 return true; | 184 return true; |
185 #endif // OS_CHROMEOS | 185 #endif // OS_CHROMEOS |
186 | 186 |
187 content::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog")); | 187 content::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog")); |
188 chrome::ShowSettingsSubPageForProfile( | 188 chrome::ShowSettingsSubPageForProfile( |
189 ProfileManager::GetActiveUserProfile(), chrome::kLanguageOptionsSubPage); | 189 ProfileManager::GetActiveUserProfile(), chrome::kLanguageOptionsSubPage); |
190 return true; | 190 return true; |
191 #else | 191 #else |
192 error_ = kNotYetImplementedError; | 192 error_ = kNotYetImplementedError; |
193 return false; | 193 return false; |
194 #endif | 194 #endif |
195 } | 195 } |
196 | 196 |
197 InputAPI::InputAPI(content::BrowserContext* context) {} | 197 InputAPI::InputAPI(content::BrowserContext* context) {} |
198 | 198 |
199 InputAPI::~InputAPI() { | 199 InputAPI::~InputAPI() { |
200 } | 200 } |
201 | 201 |
202 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputAPI> > g_factory = | 202 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputAPI> > g_factory = |
203 LAZY_INSTANCE_INITIALIZER; | 203 LAZY_INSTANCE_INITIALIZER; |
204 | 204 |
205 // static | 205 // static |
206 BrowserContextKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { | 206 BrowserContextKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { |
207 return g_factory.Pointer(); | 207 return g_factory.Pointer(); |
208 } | 208 } |
209 | 209 |
210 } // namespace extensions | 210 } // namespace extensions |
OLD | NEW |