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

Unified Diff: mojo/services/native_viewport/native_viewport_service.cc

Issue 300863003: Wire input events through the ViewManagerClient interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: , Created 6 years, 7 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: mojo/services/native_viewport/native_viewport_service.cc
diff --git a/mojo/services/native_viewport/native_viewport_service.cc b/mojo/services/native_viewport/native_viewport_service.cc
index 96d9ec50ca42bc12ecd19b55e71278971e0b8fdc..0ac59e40433e1c97d33c2db08ac66a2879d95db2 100644
--- a/mojo/services/native_viewport/native_viewport_service.cc
+++ b/mojo/services/native_viewport/native_viewport_service.cc
@@ -12,6 +12,7 @@
#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 {
@@ -115,33 +116,10 @@ class NativeViewportImpl
if (waiting_for_event_ack_ && IsRateLimitedEventType(ui_event))
return false;
- 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)));
+ client()->OnEvent(
+ TypeConverter<EventPtr, ui::Event>::ConvertFrom(*ui_event),
+ base::Bind(&NativeViewportImpl::AckEvent,
+ base::Unretained(this)));
waiting_for_event_ack_ = true;
return false;
}
« no previous file with comments | « mojo/services/native_viewport/DEPS ('k') | mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698