Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: ui/events/ozone/evdev/event_factory_evdev.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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.
4
5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_
7
8 #include "base/callback.h"
9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/task_runner.h"
13 #include "ui/events/ozone/device/device_event_observer.h"
14 #include "ui/events/ozone/evdev/event_converter_evdev.h"
15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h"
16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
17 #include "ui/events/ozone/evdev/keyboard_evdev.h"
18 #include "ui/events/platform/platform_event_source.h"
19 #include "ui/gfx/native_widget_types.h"
20
21 namespace gfx {
22 class PointF;
23 } // namespace gfx
24
25 namespace ui {
26
27 class CursorDelegateEvdev;
28 class DeviceManager;
29
30 #if defined(USE_EVDEV_GESTURES)
31 class GesturePropertyProvider;
32 #endif
33
34 // Ozone events implementation for the Linux input subsystem ("evdev").
35 class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver,
36 public PlatformEventSource {
37 public:
38 EventFactoryEvdev(CursorDelegateEvdev* cursor,
39 DeviceManager* device_manager);
40 virtual ~EventFactoryEvdev();
41
42 void WarpCursorTo(gfx::AcceleratedWidget widget,
43 const gfx::PointF& location);
44
45 private:
46 // Post a task to dispatch an event.
47 void PostUiEvent(scoped_ptr<Event> event);
48
49 // Dispatch event via PlatformEventSource.
50 void DispatchUiEventTask(scoped_ptr<Event> event);
51
52 // Open device at path & starting processing events (on UI thread).
53 void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter);
54
55 // Close device at path (on UI thread).
56 void DetachInputDevice(const base::FilePath& file_path);
57
58 void NotifyHotplugEventObserver(const EventConverterEvdev& converter);
59
60 int NextDeviceId();
61
62 // DeviceEventObserver overrides:
63 //
64 // Callback for device add (on UI thread).
65 virtual void OnDeviceEvent(const DeviceEvent& event) override;
66
67 // PlatformEventSource:
68 virtual void OnDispatcherListChanged() override;
69
70 // Owned per-device event converters (by path).
71 std::map<base::FilePath, EventConverterEvdev*> converters_;
72
73 // Used to uniquely identify input devices.
74 int last_device_id_;
75
76 // Interface for scanning & monitoring input devices.
77 DeviceManager* device_manager_; // Not owned.
78
79 // Task runner for event dispatch.
80 scoped_refptr<base::TaskRunner> ui_task_runner_;
81
82 // Dispatch callback for events.
83 EventDispatchCallback dispatch_callback_;
84
85 // Modifier key state (shift, ctrl, etc).
86 EventModifiersEvdev modifiers_;
87
88 // Keyboard state.
89 KeyboardEvdev keyboard_;
90
91 // Cursor movement.
92 CursorDelegateEvdev* cursor_;
93
94 #if defined(USE_EVDEV_GESTURES)
95 // Gesture library property provider (used by touchpads/mice).
96 scoped_ptr<GesturePropertyProvider> gesture_property_provider_;
97 #endif
98
99 // Support weak pointers for attach & detach callbacks.
100 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_;
101
102 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev);
103 };
104
105 } // namespace ui
106
107 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_dispatch_callback.h ('k') | ui/events/ozone/evdev/event_factory_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698