OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chromeos/status/caps_lock_menu_button.h" | 5 #include "chrome/browser/chromeos/status/caps_lock_menu_button.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
| 9 #include "base/chromeos/chromeos_version.h" |
9 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 11 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
11 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 12 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
12 #include "chrome/browser/chromeos/login/screen_locker.h" | 13 #include "chrome/browser/chromeos/login/screen_locker.h" |
13 #include "chrome/browser/chromeos/status/status_area_bubble.h" | 14 #include "chrome/browser/chromeos/status/status_area_bubble.h" |
14 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" | 15 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" |
15 #include "chrome/browser/chromeos/system/runtime_environment.h" | |
16 #include "chrome/browser/chromeos/view_ids.h" | 16 #include "chrome/browser/chromeos/view_ids.h" |
17 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 UpdateAccessibleName(); | 72 UpdateAccessibleName(); |
73 | 73 |
74 input_method::InputMethodManager* ime_manager = | 74 input_method::InputMethodManager* ime_manager = |
75 input_method::InputMethodManager::GetInstance(); | 75 input_method::InputMethodManager::GetInstance(); |
76 UpdateUIFromCurrentCapsLock(ime_manager->GetXKeyboard()->CapsLockIsEnabled()); | 76 UpdateUIFromCurrentCapsLock(ime_manager->GetXKeyboard()->CapsLockIsEnabled()); |
77 | 77 |
78 // Status bar should be initialized after SystemKeyEventListener on the | 78 // Status bar should be initialized after SystemKeyEventListener on the |
79 // device. SystemKeyEventListener is never initialized on chrome for cros | 79 // device. SystemKeyEventListener is never initialized on chrome for cros |
80 // running on linux. | 80 // running on linux. |
81 DCHECK(SystemKeyEventListener::GetInstance() || | 81 DCHECK(SystemKeyEventListener::GetInstance() || |
82 !system::runtime_environment::IsRunningOnChromeOS()); | 82 !base::chromeos::IsRunningOnChromeOS()); |
83 if (SystemKeyEventListener::GetInstance()) | 83 if (SystemKeyEventListener::GetInstance()) |
84 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); | 84 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); |
85 | 85 |
86 #if defined(USE_ASH) | 86 #if defined(USE_ASH) |
87 if (StatusAreaViewChromeos::IsLoginMode()) { | 87 if (StatusAreaViewChromeos::IsLoginMode()) { |
88 // See comments in InputMethodMenu::InputMethodMenu(). | 88 // See comments in InputMethodMenu::InputMethodMenu(). |
89 registrar_.Add(this, | 89 registrar_.Add(this, |
90 chrome::NOTIFICATION_SESSION_STARTED, | 90 chrome::NOTIFICATION_SESSION_STARTED, |
91 content::NotificationService::AllSources()); | 91 content::NotificationService::AllSources()); |
92 } | 92 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 new StatusAreaBubbleContentView(CreateImageViewWithCapsLockIcon(), | 261 new StatusAreaBubbleContentView(CreateImageViewWithCapsLockIcon(), |
262 GetText()))); | 262 GetText()))); |
263 } | 263 } |
264 | 264 |
265 void CapsLockMenuButton::HideBubble() { | 265 void CapsLockMenuButton::HideBubble() { |
266 bubble_controller_.reset(); | 266 bubble_controller_.reset(); |
267 } | 267 } |
268 | 268 |
269 bool CapsLockMenuButton::HasCapsLock() const { | 269 bool CapsLockMenuButton::HasCapsLock() const { |
270 // A keyboard for Linux usually has Caps Lock. | 270 // A keyboard for Linux usually has Caps Lock. |
271 if (!system::runtime_environment::IsRunningOnChromeOS()) | 271 if (!base::chromeos::IsRunningOnChromeOS()) |
272 return true; | 272 return true; |
273 // On the login screen, Caps Lock is not available. | 273 // On the login screen, Caps Lock is not available. |
274 if (!initialized_prefs_) | 274 if (!initialized_prefs_) |
275 return false; | 275 return false; |
276 | 276 |
277 return remap_search_key_to_.GetValue() == input_method::kCapsLockKey; | 277 return remap_search_key_to_.GetValue() == input_method::kCapsLockKey; |
278 } | 278 } |
279 | 279 |
280 void CapsLockMenuButton::InitializePrefMember() { | 280 void CapsLockMenuButton::InitializePrefMember() { |
281 if (!initialized_prefs_) { | 281 if (!initialized_prefs_) { |
282 PrefService* prefs = GetPrefService(); | 282 PrefService* prefs = GetPrefService(); |
283 if (prefs) { | 283 if (prefs) { |
284 initialized_prefs_ = true; | 284 initialized_prefs_ = true; |
285 remap_search_key_to_.Init( | 285 remap_search_key_to_.Init( |
286 prefs::kLanguageXkbRemapSearchKeyTo, prefs, this); | 286 prefs::kLanguageXkbRemapSearchKeyTo, prefs, this); |
287 } | 287 } |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 } // namespace chromeos | 291 } // namespace chromeos |
OLD | NEW |