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 29 matching lines...) Expand all Loading... |
40 const gfx::PointF& location); | 40 const gfx::PointF& location); |
41 | 41 |
42 private: | 42 private: |
43 // Open device at path & starting processing events (on UI thread). | 43 // Open device at path & starting processing events (on UI thread). |
44 void AttachInputDevice(const base::FilePath& file_path, | 44 void AttachInputDevice(const base::FilePath& file_path, |
45 scoped_ptr<EventConverterEvdev> converter); | 45 scoped_ptr<EventConverterEvdev> converter); |
46 | 46 |
47 // Close device at path (on UI thread). | 47 // Close device at path (on UI thread). |
48 void DetachInputDevice(const base::FilePath& file_path); | 48 void DetachInputDevice(const base::FilePath& file_path); |
49 | 49 |
| 50 void NotifyHotplugEventObserver(const EventConverterEvdev& converter); |
| 51 |
| 52 int NextDeviceId(); |
| 53 |
50 // DeviceEventObserver overrides: | 54 // DeviceEventObserver overrides: |
51 // | 55 // |
52 // Callback for device add (on UI thread). | 56 // Callback for device add (on UI thread). |
53 virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; | 57 virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; |
54 | 58 |
55 // PlatformEventSource: | 59 // PlatformEventSource: |
56 virtual void OnDispatcherListChanged() OVERRIDE; | 60 virtual void OnDispatcherListChanged() OVERRIDE; |
57 | 61 |
58 // Owned per-device event converters (by path). | 62 // Owned per-device event converters (by path). |
59 std::map<base::FilePath, EventConverterEvdev*> converters_; | 63 std::map<base::FilePath, EventConverterEvdev*> converters_; |
60 | 64 |
| 65 // Used to uniquely identify input devices. |
| 66 int last_device_id_; |
| 67 |
61 // Interface for scanning & monitoring input devices. | 68 // Interface for scanning & monitoring input devices. |
62 DeviceManager* device_manager_; // Not owned. | 69 DeviceManager* device_manager_; // Not owned. |
63 | 70 |
64 // Task runner for event dispatch. | 71 // Task runner for event dispatch. |
65 scoped_refptr<base::TaskRunner> ui_task_runner_; | 72 scoped_refptr<base::TaskRunner> ui_task_runner_; |
66 | 73 |
67 // Modifier key state (shift, ctrl, etc). | 74 // Modifier key state (shift, ctrl, etc). |
68 EventModifiersEvdev modifiers_; | 75 EventModifiersEvdev modifiers_; |
69 | 76 |
70 // Cursor movement. | 77 // Cursor movement. |
71 CursorDelegateEvdev* cursor_; | 78 CursorDelegateEvdev* cursor_; |
72 | 79 |
73 // Dispatch callback for events. | 80 // Dispatch callback for events. |
74 EventDispatchCallback dispatch_callback_; | 81 EventDispatchCallback dispatch_callback_; |
75 | 82 |
76 // Support weak pointers for attach & detach callbacks. | 83 // Support weak pointers for attach & detach callbacks. |
77 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; | 84 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; |
78 | 85 |
79 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); | 86 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); |
80 }; | 87 }; |
81 | 88 |
82 } // namespace ui | 89 } // namespace ui |
83 | 90 |
84 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 91 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
OLD | NEW |