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

Side by Side Diff: ui/events/ozone/evdev/device_event_dispatcher_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 unified diff | Download patch
« no previous file with comments | « ui/events/ozone/BUILD.gn ('k') | ui/events/ozone/evdev/device_event_dispatcher_evdev.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_DISPATCH_CALLBACK_H_ 5 #ifndef UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ 6 #define UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_
7 7
8 #include "base/callback.h"
9 #include "base/time/time.h" 8 #include "base/time/time.h"
10 #include "ui/events/event_constants.h" 9 #include "ui/events/event_constants.h"
11 #include "ui/gfx/geometry/point_f.h" 10 #include "ui/gfx/geometry/point_f.h"
11 #include "ui/gfx/geometry/vector2d.h"
12 #include "ui/gfx/geometry/vector2d_f.h" 12 #include "ui/gfx/geometry/vector2d_f.h"
13 13
14 namespace base {
15 class TimeDelta;
16 }
17
18 namespace gfx {
19 class PointF;
20 class Vector2d;
21 class Vector2dF;
22 }
23
24 namespace ui { 14 namespace ui {
25 15
26 class Event;
27
28 typedef base::Callback<void(scoped_ptr<Event>)> EventDispatchCallback;
29
30 typedef base::Callback<void(int device_id, unsigned int code, bool down)>
31 KeyEventDispatchCallback;
32
33 typedef base::Callback<void(int device_id, const gfx::PointF& location)>
34 MouseMoveEventDispatchCallback;
35
36 typedef base::Callback<void(int device_id,
37 const gfx::PointF& location,
38 unsigned int button,
39 bool down,
40 bool allow_remap)> MouseButtonEventDispatchCallback;
41
42 typedef base::Callback<void(int device_id,
43 const gfx::PointF& location,
44 const gfx::Vector2d& delta)>
45 MouseWheelEventDispatchCallback;
46
47 struct ScrollEventParams { 16 struct ScrollEventParams {
48 ScrollEventParams(int device_id, 17 ScrollEventParams(int device_id,
49 EventType type, 18 EventType type,
50 const gfx::PointF location, 19 const gfx::PointF location,
51 const gfx::Vector2dF delta, 20 const gfx::Vector2dF delta,
52 const gfx::Vector2dF ordinal_delta, 21 const gfx::Vector2dF ordinal_delta,
53 int finger_count, 22 int finger_count,
54 const base::TimeDelta timestamp); 23 const base::TimeDelta timestamp);
55 ScrollEventParams(const ScrollEventParams& other); 24 ScrollEventParams(const ScrollEventParams& other);
56 ~ScrollEventParams(); 25 ~ScrollEventParams();
57 26
58 int device_id; 27 int device_id;
59 EventType type; 28 EventType type;
60 const gfx::PointF location; 29 const gfx::PointF location;
61 const gfx::Vector2dF delta; 30 const gfx::Vector2dF delta;
62 const gfx::Vector2dF ordinal_delta; 31 const gfx::Vector2dF ordinal_delta;
63 int finger_count; 32 int finger_count;
64 const base::TimeDelta timestamp; 33 const base::TimeDelta timestamp;
65 }; 34 };
66 35
67 typedef base::Callback<void(const ScrollEventParams& params)>
68 ScrollEventDispatchCallback;
69
70 struct TouchEventParams { 36 struct TouchEventParams {
71 TouchEventParams(int device_id, 37 TouchEventParams(int device_id,
72 int touch_id, 38 int touch_id,
73 EventType type, 39 EventType type,
74 const gfx::PointF& location, 40 const gfx::PointF& location,
75 const gfx::Vector2dF& radii, 41 const gfx::Vector2dF& radii,
76 float pressure, 42 float pressure,
77 const base::TimeDelta& timestamp); 43 const base::TimeDelta& timestamp);
78 TouchEventParams(const TouchEventParams& other); 44 TouchEventParams(const TouchEventParams& other);
79 ~TouchEventParams(); 45 ~TouchEventParams();
80 46
81 int device_id; 47 int device_id;
82 int touch_id; 48 int touch_id;
83 EventType type; 49 EventType type;
84 gfx::PointF location; 50 gfx::PointF location;
85 gfx::Vector2dF radii; 51 gfx::Vector2dF radii;
86 float pressure; 52 float pressure;
87 base::TimeDelta timestamp; 53 base::TimeDelta timestamp;
88 }; 54 };
89 55
90 typedef base::Callback<void(const TouchEventParams& params)> 56 // Interface used by device objects for event dispatch.
91 TouchEventDispatchCallback; 57 class DeviceEventDispatcherEvdev {
58 public:
59 DeviceEventDispatcherEvdev() {}
60 virtual ~DeviceEventDispatcherEvdev() {}
92 61
93 } // namspace ui 62 virtual void DispatchKeyEvent(int device_id,
63 unsigned int code,
64 bool down) = 0;
65 virtual void DispatchMouseMoveEvent(int device_id,
66 const gfx::PointF& location) = 0;
67 virtual void DispatchMouseButtonEvent(int device_id,
68 const gfx::PointF& location,
69 unsigned int button,
70 bool down,
71 bool allow_remap) = 0;
72 virtual void DispatchMouseWheelEvent(int device_id,
73 const gfx::PointF& location,
74 const gfx::Vector2d& delta) = 0;
75 virtual void DispatchScrollEvent(const ScrollEventParams& params) = 0;
76 virtual void DispatchTouchEvent(const TouchEventParams& params) = 0;
77 };
94 78
95 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ 79 } // namespace
alexst (slow to review) 2015/01/27 18:50:30 // namspace ui
80
81 #endif // UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/BUILD.gn ('k') | ui/events/ozone/evdev/device_event_dispatcher_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698