OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver, | 35 class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver, |
36 public PlatformEventSource { | 36 public PlatformEventSource { |
37 public: | 37 public: |
38 EventFactoryEvdev(CursorDelegateEvdev* cursor, | 38 EventFactoryEvdev(CursorDelegateEvdev* cursor, |
39 DeviceManager* device_manager); | 39 DeviceManager* device_manager); |
40 virtual ~EventFactoryEvdev(); | 40 virtual ~EventFactoryEvdev(); |
41 | 41 |
42 void WarpCursorTo(gfx::AcceleratedWidget widget, | 42 void WarpCursorTo(gfx::AcceleratedWidget widget, |
43 const gfx::PointF& location); | 43 const gfx::PointF& location); |
44 | 44 |
| 45 protected: |
| 46 // DeviceEventObserver overrides: |
| 47 // |
| 48 // Callback for device add (on UI thread). |
| 49 virtual void OnDeviceEvent(const DeviceEvent& event) override; |
| 50 |
| 51 // PlatformEventSource: |
| 52 virtual void OnDispatcherListChanged() override; |
| 53 |
45 private: | 54 private: |
46 // Post a task to dispatch an event. | 55 // Post a task to dispatch an event. |
47 void PostUiEvent(scoped_ptr<Event> event); | 56 void PostUiEvent(scoped_ptr<Event> event); |
48 | 57 |
49 // Dispatch event via PlatformEventSource. | 58 // Dispatch event via PlatformEventSource. |
50 void DispatchUiEventTask(scoped_ptr<Event> event); | 59 void DispatchUiEventTask(scoped_ptr<Event> event); |
51 | 60 |
52 // Open device at path & starting processing events (on UI thread). | 61 // Open device at path & starting processing events (on UI thread). |
53 void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter); | 62 void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter); |
54 | 63 |
55 // Close device at path (on UI thread). | 64 // Close device at path (on UI thread). |
56 void DetachInputDevice(const base::FilePath& file_path); | 65 void DetachInputDevice(const base::FilePath& file_path); |
57 | 66 |
58 void NotifyHotplugEventObserver(const EventConverterEvdev& converter); | 67 void NotifyHotplugEventObserver(const EventConverterEvdev& converter); |
59 | 68 |
60 int NextDeviceId(); | 69 int NextDeviceId(); |
61 | 70 |
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 // Owned per-device event converters (by path). |
71 std::map<base::FilePath, EventConverterEvdev*> converters_; | 72 std::map<base::FilePath, EventConverterEvdev*> converters_; |
72 | 73 |
73 // Used to uniquely identify input devices. | 74 // Used to uniquely identify input devices. |
74 int last_device_id_; | 75 int last_device_id_; |
75 | 76 |
76 // Interface for scanning & monitoring input devices. | 77 // Interface for scanning & monitoring input devices. |
77 DeviceManager* device_manager_; // Not owned. | 78 DeviceManager* device_manager_; // Not owned. |
78 | 79 |
79 // Task runner for event dispatch. | 80 // Task runner for event dispatch. |
(...skipping 18 matching lines...) Expand all Loading... |
98 | 99 |
99 // Support weak pointers for attach & detach callbacks. | 100 // Support weak pointers for attach & detach callbacks. |
100 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; | 101 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; |
101 | 102 |
102 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); | 103 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); |
103 }; | 104 }; |
104 | 105 |
105 } // namespace ui | 106 } // namespace ui |
106 | 107 |
107 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 108 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
OLD | NEW |