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/chromeos/login/lock/screen_locker.h" | |
12 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
11 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/browser/ui/chrome_pages.h" | 14 #include "chrome/browser/ui/chrome_pages.h" |
13 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
14 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
16 #include "extensions/browser/extension_function_registry.h" | 18 #include "extensions/browser/extension_function_registry.h" |
17 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
18 #include "ui/keyboard/keyboard_controller.h" | 20 #include "ui/keyboard/keyboard_controller.h" |
19 #include "ui/keyboard/keyboard_switches.h" | 21 #include "ui/keyboard/keyboard_switches.h" |
20 | 22 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 return true; | 163 return true; |
162 #else | 164 #else |
163 error_ = kNotYetImplementedError; | 165 error_ = kNotYetImplementedError; |
164 return false; | 166 return false; |
165 #endif | 167 #endif |
166 } | 168 } |
167 | 169 |
168 bool VirtualKeyboardPrivateOpenSettingsFunction::RunSync() { | 170 bool VirtualKeyboardPrivateOpenSettingsFunction::RunSync() { |
169 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 171 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
170 #if defined(USE_ASH) | 172 #if defined(USE_ASH) |
173 // Do not try to open language options page if user is not logged in or | |
174 // locked. | |
175 bool locked = chromeos::ScreenLocker::default_screen_locker() && | |
176 chromeos::ScreenLocker::default_screen_locker()->locked(); | |
177 if (!chromeos::UserManager::Get()->IsUserLoggedIn() || locked) | |
178 return true; | |
Shu Chen
2014/07/23 02:57:39
nits: avoid getting lock state when user is not lo
bshe
2014/07/23 02:59:49
Done.
| |
179 | |
171 content::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog")); | 180 content::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog")); |
172 chrome::ShowSettingsSubPageForProfile( | 181 chrome::ShowSettingsSubPageForProfile( |
173 ProfileManager::GetActiveUserProfile(), chrome::kLanguageOptionsSubPage); | 182 ProfileManager::GetActiveUserProfile(), chrome::kLanguageOptionsSubPage); |
174 return true; | 183 return true; |
175 #else | 184 #else |
176 error_ = kNotYetImplementedError; | 185 error_ = kNotYetImplementedError; |
177 return false; | 186 return false; |
178 #endif | 187 #endif |
179 } | 188 } |
180 | 189 |
181 InputAPI::InputAPI(content::BrowserContext* context) {} | 190 InputAPI::InputAPI(content::BrowserContext* context) {} |
182 | 191 |
183 InputAPI::~InputAPI() { | 192 InputAPI::~InputAPI() { |
184 } | 193 } |
185 | 194 |
186 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputAPI> > g_factory = | 195 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputAPI> > g_factory = |
187 LAZY_INSTANCE_INITIALIZER; | 196 LAZY_INSTANCE_INITIALIZER; |
188 | 197 |
189 // static | 198 // static |
190 BrowserContextKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { | 199 BrowserContextKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { |
191 return g_factory.Pointer(); | 200 return g_factory.Pointer(); |
192 } | 201 } |
193 | 202 |
194 } // namespace extensions | 203 } // namespace extensions |
OLD | NEW |