Index: trunk/src/mojo/services/native_viewport/native_viewport_service.cc |
=================================================================== |
--- trunk/src/mojo/services/native_viewport/native_viewport_service.cc (revision 273734) |
+++ trunk/src/mojo/services/native_viewport/native_viewport_service.cc (working copy) |
@@ -12,7 +12,6 @@ |
#include "mojo/services/native_viewport/native_viewport.h" |
#include "mojo/services/native_viewport/native_viewport.mojom.h" |
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" |
-#include "mojo/services/public/cpp/input_events/input_events_type_converters.h" |
#include "ui/events/event.h" |
namespace mojo { |
@@ -113,10 +112,33 @@ |
if (waiting_for_event_ack_ && IsRateLimitedEventType(ui_event)) |
return false; |
- client()->OnEvent( |
- TypeConverter<EventPtr, ui::Event>::ConvertFrom(*ui_event), |
- base::Bind(&NativeViewportImpl::AckEvent, |
- base::Unretained(this))); |
+ EventPtr event(Event::New()); |
+ event->action = ui_event->type(); |
+ event->flags = ui_event->flags(); |
+ event->time_stamp = ui_event->time_stamp().ToInternalValue(); |
+ |
+ if (ui_event->IsMouseEvent() || ui_event->IsTouchEvent()) { |
+ ui::LocatedEvent* located_event = |
+ static_cast<ui::LocatedEvent*>(ui_event); |
+ event->location = Point::New(); |
+ event->location->x = located_event->location().x(); |
+ event->location->y = located_event->location().y(); |
+ } |
+ |
+ if (ui_event->IsTouchEvent()) { |
+ ui::TouchEvent* touch_event = static_cast<ui::TouchEvent*>(ui_event); |
+ event->touch_data = TouchData::New(); |
+ event->touch_data->pointer_id = touch_event->touch_id(); |
+ } else if (ui_event->IsKeyEvent()) { |
+ ui::KeyEvent* key_event = static_cast<ui::KeyEvent*>(ui_event); |
+ event->key_data = KeyData::New(); |
+ event->key_data->key_code = key_event->key_code(); |
+ event->key_data->is_char = key_event->is_char(); |
+ } |
+ |
+ client()->OnEvent(event.Pass(), |
+ base::Bind(&NativeViewportImpl::AckEvent, |
+ base::Unretained(this))); |
waiting_for_event_ack_ = true; |
return false; |
} |