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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/device_event_dispatcher_evdev.h
diff --git a/ui/events/ozone/evdev/event_dispatch_callback.h b/ui/events/ozone/evdev/device_event_dispatcher_evdev.h
similarity index 50%
copy from ui/events/ozone/evdev/event_dispatch_callback.h
copy to ui/events/ozone/evdev/device_event_dispatcher_evdev.h
index 077e30dd017bc58d3f12914fe18d18c1e5b276ea..5e132a039ef6d4d0a0e7ef2c0758d4f25de1890d 100644
--- a/ui/events/ozone/evdev/event_dispatch_callback.h
+++ b/ui/events/ozone/evdev/device_event_dispatcher_evdev.h
@@ -1,49 +1,18 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_
-#define UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_
+#ifndef UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_
+#define UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_
-#include "base/callback.h"
#include "base/time/time.h"
#include "ui/events/event_constants.h"
#include "ui/gfx/geometry/point_f.h"
+#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/geometry/vector2d_f.h"
-namespace base {
-class TimeDelta;
-}
-
-namespace gfx {
-class PointF;
-class Vector2d;
-class Vector2dF;
-}
-
namespace ui {
-class Event;
-
-typedef base::Callback<void(scoped_ptr<Event>)> EventDispatchCallback;
-
-typedef base::Callback<void(int device_id, unsigned int code, bool down)>
- KeyEventDispatchCallback;
-
-typedef base::Callback<void(int device_id, const gfx::PointF& location)>
- MouseMoveEventDispatchCallback;
-
-typedef base::Callback<void(int device_id,
- const gfx::PointF& location,
- unsigned int button,
- bool down,
- bool allow_remap)> MouseButtonEventDispatchCallback;
-
-typedef base::Callback<void(int device_id,
- const gfx::PointF& location,
- const gfx::Vector2d& delta)>
- MouseWheelEventDispatchCallback;
-
struct ScrollEventParams {
ScrollEventParams(int device_id,
EventType type,
@@ -64,9 +33,6 @@ struct ScrollEventParams {
const base::TimeDelta timestamp;
};
-typedef base::Callback<void(const ScrollEventParams& params)>
- ScrollEventDispatchCallback;
-
struct TouchEventParams {
TouchEventParams(int device_id,
int touch_id,
@@ -87,9 +53,29 @@ struct TouchEventParams {
base::TimeDelta timestamp;
};
-typedef base::Callback<void(const TouchEventParams& params)>
- TouchEventDispatchCallback;
+// Interface used by device objects for event dispatch.
+class DeviceEventDispatcherEvdev {
+ public:
+ DeviceEventDispatcherEvdev() {}
+ virtual ~DeviceEventDispatcherEvdev() {}
+
+ virtual void DispatchKeyEvent(int device_id,
+ unsigned int code,
+ bool down) = 0;
+ virtual void DispatchMouseMoveEvent(int device_id,
+ const gfx::PointF& location) = 0;
+ virtual void DispatchMouseButtonEvent(int device_id,
+ const gfx::PointF& location,
+ unsigned int button,
+ bool down,
+ bool allow_remap) = 0;
+ virtual void DispatchMouseWheelEvent(int device_id,
+ const gfx::PointF& location,
+ const gfx::Vector2d& delta) = 0;
+ virtual void DispatchScrollEvent(const ScrollEventParams& params) = 0;
+ virtual void DispatchTouchEvent(const TouchEventParams& params) = 0;
+};
-} // namspace ui
+} // namespace
alexst (slow to review) 2015/01/27 18:50:30 // namspace ui
-#endif // UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_
+#endif // UI_EVENTS_OZONE_EVDEV_DEVICE_EVENT_DISPATCHER_H_
« 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