| 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/ui/views/ash/caps_lock_handler.h" | 5 #include "chrome/browser/ui/views/ash/caps_lock_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 | 9 |
| 10 // TODO(yusukes): Support Ash on Windows. | 10 // TODO(yusukes): Support Ash on Windows. |
| 11 #if defined(OS_CHROMEOS) | 11 #if defined(OS_CHROMEOS) |
| 12 #include "base/chromeos/chromeos_version.h" |
| 12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 14 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 14 #include "chrome/browser/chromeos/system/runtime_environment.h" | |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
| 20 CapsLockHandler::CapsLockHandler(chromeos::input_method::XKeyboard* xkeyboard) | 20 CapsLockHandler::CapsLockHandler(chromeos::input_method::XKeyboard* xkeyboard) |
| 21 : xkeyboard_(xkeyboard), | 21 : xkeyboard_(xkeyboard), |
| 22 is_running_on_chromeos_( | 22 is_running_on_chromeos_(base::chromeos::IsRunningOnChromeOS()), |
| 23 chromeos::system::runtime_environment::IsRunningOnChromeOS()), | |
| 24 caps_lock_is_on_(xkeyboard_->CapsLockIsEnabled()) { | 23 caps_lock_is_on_(xkeyboard_->CapsLockIsEnabled()) { |
| 25 chromeos::SystemKeyEventListener* system_event_listener = | 24 chromeos::SystemKeyEventListener* system_event_listener = |
| 26 chromeos::SystemKeyEventListener::GetInstance(); | 25 chromeos::SystemKeyEventListener::GetInstance(); |
| 27 // SystemKeyEventListener should be instantiated when we're running on Chrome | 26 // SystemKeyEventListener should be instantiated when we're running on Chrome |
| 28 // OS. | 27 // OS. |
| 29 DCHECK(!is_running_on_chromeos_ || system_event_listener); | 28 DCHECK(!is_running_on_chromeos_ || system_event_listener); |
| 30 if (system_event_listener) | 29 if (system_event_listener) |
| 31 system_event_listener->AddCapsLockObserver(this); | 30 system_event_listener->AddCapsLockObserver(this); |
| 32 } | 31 } |
| 33 #endif | 32 #endif |
| (...skipping 22 matching lines...) Expand all Loading... |
| 56 NOTIMPLEMENTED(); | 55 NOTIMPLEMENTED(); |
| 57 #endif | 56 #endif |
| 58 return false; | 57 return false; |
| 59 } | 58 } |
| 60 | 59 |
| 61 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 62 void CapsLockHandler::OnCapsLockChange(bool enabled) { | 61 void CapsLockHandler::OnCapsLockChange(bool enabled) { |
| 63 caps_lock_is_on_ = enabled; | 62 caps_lock_is_on_ = enabled; |
| 64 } | 63 } |
| 65 #endif | 64 #endif |
| OLD | NEW |