summaryrefslogtreecommitdiff
path: root/chromium/ui/ozone/public/platform_keyboard_hook.h
blob: e584c1d963550c4e6da26293eb3bd94e1ded26d3 (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
// Copyright 2021 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 UI_OZONE_PUBLIC_PLATFORM_KEYBOARD_HOOK_H_
#define UI_OZONE_PUBLIC_PLATFORM_KEYBOARD_HOOK_H_

#include "base/callback.h"
#include "base/component_export.h"
#include "base/containers/flat_set.h"
#include "third_party/abseil-cpp/absl/types/optional.h"

namespace ui {

enum class DomCode;
class KeyEvent;

// Supported hook types.
enum class PlatformKeyboardHookTypes { kModifier, kMedia };

// Interface for Ozone implementations of KeyboardHook.
class COMPONENT_EXPORT(OZONE_BASE) PlatformKeyboardHook {
 public:
  using KeyEventCallback = base::RepeatingCallback<void(KeyEvent* event)>;

  PlatformKeyboardHook();
  PlatformKeyboardHook(const PlatformKeyboardHook&) = delete;
  PlatformKeyboardHook& operator=(const PlatformKeyboardHook&) = delete;
  virtual ~PlatformKeyboardHook();

  // KeyboardHook:
  virtual bool IsKeyLocked(DomCode dom_code) const = 0;
};

}  // namespace ui
#endif  // UI_OZONE_PUBLIC_PLATFORM_KEYBOARD_HOOK_H_