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.
5 #ifndef CHROME_BROWSER_UI_ASH_CAPS_LOCK_DELEGATE_CHROMEOS_H_
6 #define CHROME_BROWSER_UI_ASH_CAPS_LOCK_DELEGATE_CHROMEOS_H_
8 #include "ash/caps_lock_delegate.h"
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/chromeos/system_key_event_listener.h"
14 namespace input_method
{
16 } // namespace input_method
17 } // namespace chromeos
19 // A class which toggles Caps Lock state when the hotkey for Caps Lock
21 class CapsLockDelegate
22 : public ash::CapsLockDelegate
,
23 public chromeos::SystemKeyEventListener::CapsLockObserver
{
25 explicit CapsLockDelegate(chromeos::input_method::XKeyboard
* xkeyboard
);
26 virtual ~CapsLockDelegate();
28 // Overridden from ash::CapsLockDelegate:
29 virtual bool IsCapsLockEnabled() const OVERRIDE
;
30 virtual void SetCapsLockEnabled(bool enabled
) OVERRIDE
;
31 virtual void ToggleCapsLock() OVERRIDE
;
33 // Overridden from chromeos::SystemKeyEventListener::CapsLockObserver:
34 virtual void OnCapsLockChange(bool enabled
) OVERRIDE
;
36 void set_is_running_on_chromeos_for_test(bool is_running_on_chromeos
) {
37 is_running_on_chromeos_
= is_running_on_chromeos
;
40 bool caps_lock_is_on_for_test() const { return caps_lock_is_on_
; }
43 chromeos::input_method::XKeyboard
* xkeyboard_
;
44 bool is_running_on_chromeos_
;
45 bool caps_lock_is_on_
;
47 DISALLOW_COPY_AND_ASSIGN(CapsLockDelegate
);
50 #endif // CHROME_BROWSER_UI_ASH_CAPS_LOCK_DELEGATE_CHROMEOS_H_