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 hotkey for Caps Lock | |
24 // is pressed. | |
25 class CapsLockHandler : public ash::CapsLockDelegate | |
26 #if defined(OS_CHROMEOS) | |
27 , public chromeos::SystemKeyEventListener::CapsLockObserver | |
28 #endif | |
29 { | |
30 public: | |
31 CapsLockHandler() {} | |
32 #if defined(OS_CHROMEOS) | |
33 explicit CapsLockHandler(chromeos::input_method::XKeyboard* xkeyboard); | |
34 #endif | |
35 virtual ~CapsLockHandler(); | |
36 | |
37 // Overridden from ash::CapsLockHandler: | |
38 virtual bool HandleToggleCapsLock() OVERRIDE; | |
39 | |
40 #if defined(OS_CHROMEOS) | |
41 // Overridden from chromeos::SystemKeyEventListener::CapsLockObserver: | |
42 virtual void OnCapsLockChange(bool enabled) OVERRIDE; | |
43 | |
44 void set_is_running_on_chromeos_for_test(bool is_running_on_chromeos) { | |
45 is_running_on_chromeos_ = is_running_on_chromeos; | |
46 } | |
47 | |
48 bool caps_lock_is_on_for_test() const { | |
49 return caps_lock_is_on_; | |
50 } | |
51 | |
52 private: | |
53 chromeos::input_method::XKeyboard* xkeyboard_; | |
54 bool is_running_on_chromeos_; | |
55 bool caps_lock_is_on_; | |
56 #endif | |
57 | |
58 private: | |
59 DISALLOW_COPY_AND_ASSIGN(CapsLockHandler); | |
60 }; | |
61 | |
62 #endif // CHROME_BROWSER_UI_VIEWS_AURA_CAPS_LOCK_HANDLER_H_ | |
OLD | NEW |