summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/options/chromeos/keyboard_handler.h
blob: 8f6501a0e81ca2c0312e51fa9ca299b2739765fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_KEYBOARD_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_KEYBOARD_HANDLER_H_

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "chrome/browser/ui/webui/options/options_ui.h"
#include "components/prefs/pref_member.h"
#include "ui/events/devices/input_device_event_observer.h"

namespace chromeos {
namespace options {

// Customize modifier keys overlay page UI handler.
class KeyboardHandler
    : public ::options::OptionsPageUIHandler,
      public ui::InputDeviceEventObserver {
 public:
  KeyboardHandler();
  ~KeyboardHandler() override;

  // OptionsPageUIHandler implementation.
  void GetLocalizedValues(base::DictionaryValue* localized_strings) override;
  void InitializePage() override;
  void RegisterMessages() override;

  // ui::InputDeviceEventObserver:
  void OnKeyboardDeviceConfigurationChanged() override;

 private:
  // Show the keyboard shortcuts overlay from the options page.
  void HandleShowKeyboardShortcuts(const base::ListValue* args);

  // Shows or hides the CapsLock options based on whether or not there is an
  // external keyboard connected.
  void UpdateCapsLockOptions() const;

  DISALLOW_COPY_AND_ASSIGN(KeyboardHandler);
};

}  // namespace options
}  // namespace chromeos

#endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_KEYBOARD_HANDLER_H_