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

Unified Diff: ui/android/view_root.h

Issue 2645353004: ViewRoot class for event forwarding on Android (Closed)
Patch Set: fix tests Created 3 years, 11 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/view_root.h
diff --git a/ui/android/view_root.h b/ui/android/view_root.h
new file mode 100644
index 0000000000000000000000000000000000000000..c6c422eb5afa073a534cfeab7c24c47cc11416b5
--- /dev/null
+++ b/ui/android/view_root.h
@@ -0,0 +1,73 @@
+// 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_VIEW_ROOT_H_
+#define UI_ANDROID_VIEW_ROOT_H_
+
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+#include "ui/android/ui_android_export.h"
+#include "ui/android/view_android.h"
+
+namespace ui {
+
+// ViewRoot is the root of a ViewAndroid tree.
+class UI_ANDROID_EXPORT ViewRoot : public ViewAndroid {
+ public:
+ explicit ViewRoot(jlong window_android_ptr);
+
+ void Destroy(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj);
+
+ // ViewAndroid overrides.
+ WindowAndroid* GetWindowAndroid() const override;
+ ViewAndroid* GetViewRoot() override;
+
+ // Move the give child ViewAndroid to the front of the list
+ // so that it can be the first responder of events.
+ void MoveToFront(ViewAndroid* child);
boliu 2017/01/24 23:47:13 why only on the root?
Jinsuk Kim 2017/01/25 02:34:34 Practically this is necessary only at the top leve
Jinsuk Kim 2017/01/25 08:13:31 On second thought, this should be in ViewAndroid.
+
+ 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);
+
+ private:
+ WindowAndroid* window_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewRoot);
+};
+
+bool RegisterViewRoot(JNIEnv* env);
+
+} // namespace ui
+
+#endif // UI_ANDROID_VIEW_ROOT_H_

Powered by Google App Engine
This is Rietveld 408576698