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 16 matching lines...) Expand all Loading... |
27 public DeviceEventObserver, | 27 public DeviceEventObserver, |
28 public PlatformEventSource { | 28 public PlatformEventSource { |
29 public: | 29 public: |
30 EventFactoryEvdev(CursorDelegateEvdev* cursor, | 30 EventFactoryEvdev(CursorDelegateEvdev* cursor, |
31 DeviceManager* device_manager); | 31 DeviceManager* device_manager); |
32 virtual ~EventFactoryEvdev(); | 32 virtual ~EventFactoryEvdev(); |
33 | 33 |
34 void DispatchUiEvent(Event* event); | 34 void DispatchUiEvent(Event* event); |
35 | 35 |
36 // EventFactoryOzone: | 36 // EventFactoryOzone: |
37 virtual void StartProcessingEvents() OVERRIDE; | |
38 virtual void WarpCursorTo(gfx::AcceleratedWidget widget, | 37 virtual void WarpCursorTo(gfx::AcceleratedWidget widget, |
39 const gfx::PointF& location) OVERRIDE; | 38 const gfx::PointF& location) OVERRIDE; |
40 | 39 |
41 private: | 40 private: |
42 // Open device at path & starting processing events (on UI thread). | 41 // Open device at path & starting processing events (on UI thread). |
43 void AttachInputDevice(const base::FilePath& file_path, | 42 void AttachInputDevice(const base::FilePath& file_path, |
44 scoped_ptr<EventConverterEvdev> converter); | 43 scoped_ptr<EventConverterEvdev> converter); |
45 | 44 |
46 // Close device at path (on UI thread). | 45 // Close device at path (on UI thread). |
47 void DetachInputDevice(const base::FilePath& file_path); | 46 void DetachInputDevice(const base::FilePath& file_path); |
48 | 47 |
49 // DeviceEventObserver overrides: | 48 // DeviceEventObserver overrides: |
50 // | 49 // |
51 // Callback for device add (on UI thread). | 50 // Callback for device add (on UI thread). |
52 virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; | 51 virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; |
53 | 52 |
54 // PlatformEventSource: | 53 // PlatformEventSource: |
55 virtual void OnDispatcherListChanged() OVERRIDE; | 54 virtual void OnDispatcherListChanged() OVERRIDE; |
56 | 55 |
57 // Owned per-device event converters (by path). | 56 // Owned per-device event converters (by path). |
58 std::map<base::FilePath, EventConverterEvdev*> converters_; | 57 std::map<base::FilePath, EventConverterEvdev*> converters_; |
59 | 58 |
60 // Interface for scanning & monitoring input devices. | 59 // Interface for scanning & monitoring input devices. |
61 DeviceManager* device_manager_; // Not owned. | 60 DeviceManager* device_manager_; // Not owned. |
62 | 61 |
63 // True if this was registered with |device_manager_|. This is needed since | |
64 // StartProcessingEvents() is called multiple times (when a | |
65 // WindowTreeHostOzone is created) but we shouldn't register this multiple | |
66 // times. | |
67 // TODO(dnicoara) Remove once event processing is refactored and we no longer | |
68 // rely on WTH for starting event processing. | |
69 bool has_started_processing_events_; | |
70 | |
71 // Task runner for event dispatch. | 62 // Task runner for event dispatch. |
72 scoped_refptr<base::TaskRunner> ui_task_runner_; | 63 scoped_refptr<base::TaskRunner> ui_task_runner_; |
73 | 64 |
74 // Modifier key state (shift, ctrl, etc). | 65 // Modifier key state (shift, ctrl, etc). |
75 EventModifiersEvdev modifiers_; | 66 EventModifiersEvdev modifiers_; |
76 | 67 |
77 // Cursor movement. | 68 // Cursor movement. |
78 CursorDelegateEvdev* cursor_; | 69 CursorDelegateEvdev* cursor_; |
79 | 70 |
80 // Dispatch callback for events. | 71 // Dispatch callback for events. |
81 EventDispatchCallback dispatch_callback_; | 72 EventDispatchCallback dispatch_callback_; |
82 | 73 |
83 // Support weak pointers for attach & detach callbacks. | 74 // Support weak pointers for attach & detach callbacks. |
84 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; | 75 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; |
85 | 76 |
86 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); | 77 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); |
87 }; | 78 }; |
88 | 79 |
89 } // namespace ui | 80 } // namespace ui |
90 | 81 |
91 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 82 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
OLD | NEW |