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
48
49
50
51
52
53
54
55
56
57
58
59
60
content / public / browser / native_event_processor_observer_mac.h [blame]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_NATIVE_EVENT_PROCESSOR_OBSERVER_MAC_H_
#define CONTENT_PUBLIC_BROWSER_NATIVE_EVENT_PROCESSOR_OBSERVER_MAC_H_
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/observer_list.h"
#include "content/common/content_export.h"
#if __OBJC__
@class NSEvent;
#endif // __OBJC__
namespace content {
class NativeEventProcessorObserver {
public:
// Called right before a native event is run.
virtual void WillRunNativeEvent(const void* opaque_identifier) = 0;
// Called right after a native event is run.
virtual void DidRunNativeEvent(const void* opaque_identifier) = 0;
};
#if __OBJC__
// The constructor sends a WillRunNativeEvent callback to each observer.
// The destructor sends a DidRunNativeEvent callback to each observer.
class CONTENT_EXPORT ScopedNotifyNativeEventProcessorObserver {
public:
ScopedNotifyNativeEventProcessorObserver(
base::ObserverList<NativeEventProcessorObserver>::Unchecked*
observer_list,
NSEvent* event);
ScopedNotifyNativeEventProcessorObserver(
const ScopedNotifyNativeEventProcessorObserver&) = delete;
ScopedNotifyNativeEventProcessorObserver& operator=(
const ScopedNotifyNativeEventProcessorObserver&) = delete;
~ScopedNotifyNativeEventProcessorObserver();
private:
raw_ptr<base::ObserverList<NativeEventProcessorObserver>::Unchecked>
observer_list_;
// This field is not a raw_ptr<> because it was filtered by the rewriter
// for: #union
RAW_PTR_EXCLUSION NSEvent* __strong event_;
};
#endif // __OBJC__
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_NATIVE_EVENT_PROCESSOR_OBSERVER_MAC_H_