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

Unified Diff: ui/events/ozone/evdev/event_converter_evdev_impl.cc

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_converter_evdev_impl.cc
diff --git a/ui/events/ozone/evdev/event_converter_evdev_impl.cc b/ui/events/ozone/evdev/event_converter_evdev_impl.cc
index 352820769d58a8bc41cb005cdbf09993e56c5c9d..2330fc7f23ec9f615faeca432ce2428f34e86bb3 100644
--- a/ui/events/ozone/evdev/event_converter_evdev_impl.cc
+++ b/ui/events/ozone/evdev/event_converter_evdev_impl.cc
@@ -9,6 +9,7 @@
#include "ui/events/event.h"
#include "ui/events/keycodes/dom4/keycode_converter.h"
+#include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h"
#include "ui/events/ozone/evdev/keyboard_util_evdev.h"
namespace ui {
@@ -28,18 +29,14 @@ EventConverterEvdevImpl::EventConverterEvdevImpl(
InputDeviceType type,
const EventDeviceInfo& devinfo,
CursorDelegateEvdev* cursor,
- const KeyEventDispatchCallback& key_callback,
- const MouseMoveEventDispatchCallback& mouse_move_callback,
- const MouseButtonEventDispatchCallback& mouse_button_callback)
+ DeviceEventDispatcherEvdev* dispatcher)
: EventConverterEvdev(fd, path, id, type),
has_keyboard_(devinfo.HasKeyboard()),
has_touchpad_(devinfo.HasTouchpad()),
x_offset_(0),
y_offset_(0),
cursor_(cursor),
- key_callback_(key_callback),
- mouse_move_callback_(mouse_move_callback),
- mouse_button_callback_(mouse_button_callback) {
+ dispatcher_(dispatcher) {
}
EventConverterEvdevImpl::~EventConverterEvdevImpl() {
@@ -120,7 +117,8 @@ void EventConverterEvdevImpl::ConvertKeyEvent(const input_event& input) {
DomCode key_code = KeycodeConverter::NativeKeycodeToDomCode(
EvdevCodeToNativeCode(input.code));
if (!allowed_keys_ || allowed_keys_->count(key_code))
- key_callback_.Run(id_, input.code, input.value != kKeyReleaseValue);
+ dispatcher_->DispatchKeyEvent(id_, input.code,
+ input.value != kKeyReleaseValue);
}
void EventConverterEvdevImpl::ConvertMouseMoveEvent(const input_event& input) {
@@ -140,8 +138,8 @@ void EventConverterEvdevImpl::DispatchMouseButton(const input_event& input) {
if (!cursor_)
return;
- mouse_button_callback_.Run(id_, cursor_->GetLocation(), input.code,
- input.value, /* allow_remap */ true);
+ dispatcher_->DispatchMouseButtonEvent(id_, cursor_->GetLocation(), input.code,
+ input.value, /* allow_remap */ true);
}
void EventConverterEvdevImpl::FlushEvents() {
@@ -150,7 +148,7 @@ void EventConverterEvdevImpl::FlushEvents() {
cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_));
- mouse_move_callback_.Run(id_, cursor_->GetLocation());
+ dispatcher_->DispatchMouseMoveEvent(id_, cursor_->GetLocation());
x_offset_ = 0;
y_offset_ = 0;

Powered by Google App Engine
This is Rietveld 408576698