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