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

Unified Diff: ui/android/event_handler.h

Issue 2708613002: Add EventForwarder for routing touch events (Closed)
Patch Set: unittests Created 3 years, 10 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/android/event_handler.h
diff --git a/ui/android/event_handler.h b/ui/android/event_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..92ff03bb57d654bfade7b11a992fbe7b95fd4c09
--- /dev/null
+++ b/ui/android/event_handler.h
@@ -0,0 +1,82 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_ANDROID_EVENT_HANDLER_H_
+#define UI_ANDROID_EVENT_HANDLER_H_
+
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+#include "ui/android/ui_android_export.h"
+
+namespace ui {
+
+class ViewAndroid;
+
+class UI_ANDROID_EXPORT EventHandler {
+ public:
+ EventHandler();
Khushal 2017/03/02 21:46:15 Not used?
Jinsuk Kim 2017/03/03 06:29:21 Removed.
+ base::android::ScopedJavaLocalRef<jobject> CreateJavaObject();
Khushal 2017/03/02 21:46:15 Should this class cache the java object instead of
Jinsuk Kim 2017/03/03 06:29:21 Done.
+
+ static EventHandler* Create(ViewAndroid* view);
Khushal 2017/03/02 21:46:15 nit: Do we need this Create method? We don't do an
boliu 2017/03/02 22:02:16 should return unique_ptr for passing ownership
Khushal 2017/03/02 22:08:59 Agreed. That was just a general comment if for som
Jinsuk Kim 2017/03/03 06:29:21 Turned the ctor public. ViewAndroid is the owner a
Jinsuk Kim 2017/03/03 06:29:21 Removed the method.
Jinsuk Kim 2017/03/03 06:29:21 Acknowledged.
+
+ jboolean OnTouchEvent(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ const base::android::JavaParamRef<jobject>& motion_event,
+ jlong time_ms,
+ jint android_action,
+ jint pointer_count,
+ jint history_size,
+ jint action_index,
+ jfloat pos_x_0,
+ jfloat pos_y_0,
+ jfloat pos_x_1,
+ jfloat pos_y_1,
+ jint pointer_id_0,
+ jint pointer_id_1,
+ jfloat touch_major_0,
+ jfloat touch_major_1,
+ jfloat touch_minor_0,
+ jfloat touch_minor_1,
+ jfloat orientation_0,
+ jfloat orientation_1,
+ jfloat tilt_0,
+ jfloat tilt_1,
+ jfloat raw_pos_x,
+ jfloat raw_pos_y,
+ jint android_tool_type_0,
+ jint android_tool_type_1,
+ jint android_button_state,
+ jint android_meta_state,
+ jboolean is_touch_handle_event);
+
+ void OnMouseEvent(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jlong time_ms,
+ jint android_action,
+ jfloat x,
+ jfloat y,
+ jint pointer_id,
+ jfloat pressure,
+ jfloat orientation,
+ jfloat tilt,
+ jint android_changed_button,
+ jint android_button_state,
+ jint android_meta_state,
+ jint tool_type);
+
+ private:
+ explicit EventHandler(ViewAndroid* view);
+
+ ViewAndroid* const view_;
+
+ DISALLOW_COPY_AND_ASSIGN(EventHandler);
+};
+
+bool RegisterEventHandler(JNIEnv* env);
+
+} // namespace ui
+
+#endif // UI_ANDROID_EVENT_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698