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
ash / events / prerewritten_event_forwarder.h [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_EVENTS_PREREWRITTEN_EVENT_FORWARDER_H_
#define ASH_EVENTS_PREREWRITTEN_EVENT_FORWARDER_H_
#include "ash/ash_export.h"
#include "base/observer_list.h"
#include "ui/events/event.h"
#include "ui/events/event_rewriter.h"
namespace ash {
// PrerewrittenEventForwarder listens to input events and supplies the raw event
// to clients that want events before any subsequent event rewrites.
class ASH_EXPORT PrerewrittenEventForwarder : public ui::EventRewriter {
public:
class Observer : public base::CheckedObserver {
public:
// Called whenever a key event is pressed/released.
virtual void OnPrerewriteKeyInputEvent(const ui::KeyEvent& event) = 0;
};
PrerewrittenEventForwarder();
PrerewrittenEventForwarder(const PrerewrittenEventForwarder&) = delete;
PrerewrittenEventForwarder& operator=(const PrerewrittenEventForwarder&) =
delete;
~PrerewrittenEventForwarder() override;
// ui::EventRewriter:
ui::EventDispatchDetails RewriteEvent(
const ui::Event& event,
const Continuation continuation) override;
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
private:
base::ObserverList<Observer> observers_;
};
} // namespace ash
#endif // ASH_EVENTS_PREREWRITTEN_EVENT_FORWARDER_H_