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