OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_ASH_CAPS_LOCK_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_CAPS_LOCK_HANDLER_H_ |
| 7 |
| 8 #include "ash/caps_lock_delegate.h" |
| 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
| 11 |
| 12 #if defined(OS_CHROMEOS) |
| 13 #include "chrome/browser/chromeos/system_key_event_listener.h" |
| 14 |
| 15 namespace chromeos { |
| 16 namespace input_method { |
| 17 class XKeyboard; |
| 18 } // namespace input_method |
| 19 } // namespace chromeos |
| 20 #endif |
| 21 |
| 22 // A class which toggles Caps Lock state when the hotkey for Caps Lock |
| 23 // is pressed. |
| 24 class CapsLockHandler : public ash::CapsLockDelegate |
| 25 #if defined(OS_CHROMEOS) |
| 26 , public chromeos::SystemKeyEventListener::CapsLockObserver |
| 27 #endif |
| 28 { |
| 29 public: |
| 30 CapsLockHandler() {} |
| 31 #if defined(OS_CHROMEOS) |
| 32 explicit CapsLockHandler(chromeos::input_method::XKeyboard* xkeyboard); |
| 33 #endif |
| 34 virtual ~CapsLockHandler(); |
| 35 |
| 36 // Overridden from ash::CapsLockHandler: |
| 37 virtual bool HandleToggleCapsLock() OVERRIDE; |
| 38 |
| 39 #if defined(OS_CHROMEOS) |
| 40 // Overridden from chromeos::SystemKeyEventListener::CapsLockObserver: |
| 41 virtual void OnCapsLockChange(bool enabled) OVERRIDE; |
| 42 |
| 43 void set_is_running_on_chromeos_for_test(bool is_running_on_chromeos) { |
| 44 is_running_on_chromeos_ = is_running_on_chromeos; |
| 45 } |
| 46 |
| 47 bool caps_lock_is_on_for_test() const { |
| 48 return caps_lock_is_on_; |
| 49 } |
| 50 |
| 51 private: |
| 52 chromeos::input_method::XKeyboard* xkeyboard_; |
| 53 bool is_running_on_chromeos_; |
| 54 bool caps_lock_is_on_; |
| 55 #endif |
| 56 |
| 57 private: |
| 58 DISALLOW_COPY_AND_ASSIGN(CapsLockHandler); |
| 59 }; |
| 60 |
| 61 #endif // CHROME_BROWSER_UI_ASH_CAPS_LOCK_HANDLER_H_ |
OLD | NEW |