Chromium Code Reviews| 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_VIEWS_AURA_CAPS_LOCK_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_AURA_CAPS_LOCK_HANDLER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "ash/caps_lock_delegate.h" | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 | |
| 13 #if defined(OS_CHROMEOS) | |
| 14 #include "chrome/browser/chromeos/system_key_event_listener.h" | |
| 15 | |
| 16 namespace chromeos { | |
| 17 namespace input_method { | |
| 18 class XKeyboard; | |
| 19 } // namespace input_method | |
| 20 } // namespace chromeos | |
| 21 #endif | |
| 22 | |
| 23 // A class which toggles Caps Lock state when the hot key for Caps Lock | |
|
Daniel Erat
2012/01/23 16:42:43
nit: s/hot key/hotkey/
Yusuke Sato
2012/01/24 09:03:19
Done.
| |
| 24 // is pressed. | |
| 25 class CapsLockHandler | |
| 26 : public ash::CapsLockDelegate | |
|
Daniel Erat
2012/01/23 16:42:43
this probably should be on the previous line, like
Yusuke Sato
2012/01/24 09:03:19
Done.
| |
| 27 #if defined(OS_CHROMEOS) | |
| 28 , public chromeos::SystemKeyEventListener::CapsLockObserver | |
| 29 #endif | |
| 30 { | |
| 31 public: | |
| 32 CapsLockHandler(); | |
| 33 #if defined(OS_CHROMEOS) | |
| 34 explicit CapsLockHandler(chromeos::input_method::XKeyboard* xkeyboard); | |
| 35 #endif | |
| 36 virtual ~CapsLockHandler(); | |
| 37 | |
| 38 // Overridden from ash::CapsLockHandler: | |
| 39 virtual bool HandleToggleCapsLock() OVERRIDE; | |
| 40 | |
| 41 #if defined(OS_CHROMEOS) | |
| 42 // Overridden from chromeos::SystemKeyEventListener::CapsLockObserver: | |
| 43 virtual void OnCapsLockChange(bool enabled) OVERRIDE; | |
| 44 #endif | |
| 45 | |
| 46 void set_is_running_on_chromeos_for_test(bool is_running_on_chromeos) { | |
| 47 is_running_on_chromeos_ = is_running_on_chromeos; | |
| 48 } | |
| 49 | |
| 50 bool caps_lock_is_on_for_test() const { | |
| 51 return caps_lock_is_on_; | |
| 52 } | |
| 53 | |
| 54 private: | |
| 55 #if defined(OS_CHROMEOS) | |
| 56 chromeos::input_method::XKeyboard* xkeyboard_; | |
| 57 #endif | |
| 58 bool is_running_on_chromeos_; | |
| 59 bool caps_lock_is_on_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(CapsLockHandler); | |
| 62 }; | |
| 63 | |
| 64 #endif // CHROME_BROWSER_UI_VIEWS_AURA_CAPS_LOCK_HANDLER_H_ | |
| OLD | NEW |