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

Unified Diff: ui/events/ozone/evdev/event_factory_evdev.h

Issue 869613003: [PATCH 5/11] ozone: evdev: Replace dispatch callbacks with an interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates for events_unittests 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/ozone/evdev/event_factory_evdev.h
diff --git a/ui/events/ozone/evdev/event_factory_evdev.h b/ui/events/ozone/evdev/event_factory_evdev.h
index 07122ee9ab048aedbccf4c2a3f6b92424847a415..c0bf6333551df994ff96ca99007c30b19cd69cdb 100644
--- a/ui/events/ozone/evdev/event_factory_evdev.h
+++ b/ui/events/ozone/evdev/event_factory_evdev.h
@@ -14,6 +14,7 @@
#include "base/memory/ref_counted.h"
#include "base/task_runner.h"
#include "ui/events/ozone/device/device_event_observer.h"
+#include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h"
#include "ui/events/ozone/evdev/event_converter_evdev.h"
#include "ui/events/ozone/evdev/event_device_info.h"
#include "ui/events/ozone/evdev/event_modifiers_evdev.h"
@@ -45,14 +46,19 @@ class GesturePropertyProvider;
#endif
// Ozone events implementation for the Linux input subsystem ("evdev").
-class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver,
- public PlatformEventSource {
+class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev
+ : public DeviceEventObserver,
+ public PlatformEventSource,
+ public DeviceEventDispatcherEvdev {
public:
EventFactoryEvdev(CursorDelegateEvdev* cursor,
DeviceManager* device_manager,
KeyboardLayoutEngine* keyboard_layout_engine);
~EventFactoryEvdev() override;
+ // Initialize. Must be called with a valid message loop.
+ void Init();
+
// Get a list of device ids that matches a device type. Return true if the
// list is not empty. |device_ids| can be NULL.
bool GetDeviceIdsByType(const EventDeviceType type,
@@ -78,19 +84,20 @@ class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver,
InputController* input_controller() { return &input_controller_; }
- // Post events to UI.
- void PostKeyEvent(int device_id, unsigned int code, bool down);
- void PostMouseMoveEvent(int device_id, const gfx::PointF& location);
- void PostMouseButtonEvent(int device_id,
- const gfx::PointF& location,
- unsigned int button,
- bool down,
- bool allow_remap);
- void PostMouseWheelEvent(int device_id,
- const gfx::PointF& location,
- const gfx::Vector2d& delta);
- void PostScrollEvent(const ScrollEventParams& params);
- void PostTouchEvent(const TouchEventParams& params);
+ // DeviceEventDispatchEvdev:
+ void DispatchKeyEvent(int device_id, unsigned int code, bool down) override;
+ void DispatchMouseMoveEvent(int device_id,
+ const gfx::PointF& location) override;
+ void DispatchMouseButtonEvent(int device_id,
+ const gfx::PointF& location,
+ unsigned int button,
+ bool down,
+ bool allow_remap) override;
+ void DispatchMouseWheelEvent(int device_id,
+ const gfx::PointF& location,
+ const gfx::Vector2d& delta) override;
+ void DispatchScrollEvent(const ScrollEventParams& params) override;
+ void DispatchTouchEvent(const TouchEventParams& params) override;
protected:
// DeviceEventObserver overrides:
@@ -156,6 +163,9 @@ class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver,
// Object for controlling input devices.
InputControllerEvdev input_controller_;
+ // Whether we've set up the device factory & done initial scan.
+ bool initialized_;
+
// Support weak pointers for attach & detach callbacks.
base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698