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

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

Issue 63493002: Wires up MotionEvents for mojo_shell_apk on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 1 month 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_android.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_android.cc
diff --git a/mojo/services/native_viewport/native_viewport_android.cc b/mojo/services/native_viewport/native_viewport_android.cc
index fbb02f5f008f2d23087668df619f794c84f41f95..4340c4e95f5ae5ec64f0b5877312f4fd90937c1e 100644
--- a/mojo/services/native_viewport/native_viewport_android.cc
+++ b/mojo/services/native_viewport/native_viewport_android.cc
@@ -7,6 +7,8 @@
#include <android/native_window_jni.h>
#include "mojo/services/native_viewport/android/mojo_viewport.h"
#include "mojo/shell/context.h"
+#include "ui/events/event.h"
+#include "ui/gfx/point.h"
namespace mojo {
namespace services {
@@ -14,6 +16,7 @@ namespace services {
NativeViewportAndroid::NativeViewportAndroid(NativeViewportDelegate* delegate)
: delegate_(delegate),
window_(NULL),
+ id_generator_(0),
weak_factory_(this) {
}
@@ -38,6 +41,20 @@ void NativeViewportAndroid::OnResized(const gfx::Size& size) {
delegate_->OnResized(size);
}
+void NativeViewportAndroid::OnTouchEvent(int pointer_id,
+ ui::EventType action,
+ float x, float y,
+ int64 time_ms) {
+ gfx::Point location(static_cast<int>(x), static_cast<int>(y));
+ ui::TouchEvent event(action, location,
+ id_generator_.GetGeneratedID(pointer_id),
+ base::TimeDelta::FromMilliseconds(time_ms));
+ // TODO(beng): handle multiple touch-points.
+ delegate_->OnEvent(&event);
+ if (action == ui::ET_TOUCH_RELEASED)
+ id_generator_.ReleaseNumber(pointer_id);
+}
+
void NativeViewportAndroid::ReleaseWindow() {
ANativeWindow_release(window_);
window_ = NULL;
« no previous file with comments | « mojo/services/native_viewport/native_viewport_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698