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

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

Issue 100823010: Wire events through to sample_app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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 | « mojo/services/native_viewport/native_viewport_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_viewport/native_viewport_impl.cc
diff --git a/mojo/services/native_viewport/native_viewport_impl.cc b/mojo/services/native_viewport/native_viewport_impl.cc
index bce78e347ae5efe72618d4914a9973010ee2c14c..777c8d2abd12032148e673853d6679ee1136a783 100644
--- a/mojo/services/native_viewport/native_viewport_impl.cc
+++ b/mojo/services/native_viewport/native_viewport_impl.cc
@@ -47,7 +47,29 @@ void NativeViewportImpl::CreateGLES2ContextIfNeeded() {
gles2_->CreateContext(widget_, native_viewport_->GetSize());
}
-bool NativeViewportImpl::OnEvent(ui::Event* event) {
+bool NativeViewportImpl::OnEvent(ui::Event* ui_event) {
+ AllocationScope scope;
+
+ Event::Builder event;
+ event.set_action(ui_event->type());
+ event.set_time_stamp(ui_event->time_stamp().ToInternalValue());
+
+ if (ui_event->IsMouseEvent() || ui_event->IsTouchEvent()) {
+ ui::LocatedEvent* located_event = static_cast<ui::LocatedEvent*>(ui_event);
+ Point::Builder location;
+ location.set_x(located_event->location().x());
+ location.set_y(located_event->location().y());
+ event.set_location(location.Finish());
+ }
+
+ if (ui_event->IsTouchEvent()) {
+ ui::TouchEvent* touch_event = static_cast<ui::TouchEvent*>(ui_event);
+ TouchData::Builder touch_data;
+ touch_data.set_pointer_id(touch_event->touch_id());
+ event.set_touch_data(touch_data.Finish());
+ }
+
+ client_->HandleEvent(event.Finish());
return false;
}
« no previous file with comments | « mojo/services/native_viewport/native_viewport_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698