| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/android/view_root.h" | |
| 6 | |
| 7 #include "jni/ViewRoot_jni.h" | |
| 8 | |
| 9 namespace ui { | |
| 10 | |
| 11 using base::android::JavaParamRef; | |
| 12 | |
| 13 ViewRoot::ViewRoot(jlong window_android_ptr) { | |
| 14 WindowAndroid* window_android = | |
| 15 reinterpret_cast<WindowAndroid*>(window_android_ptr); | |
| 16 window_ = window_android; | |
| 17 | |
| 18 // ViewRoot simply accepts all events and lets the hit testing | |
| 19 // start from its children. | |
| 20 SetLayout(0, 0, 0, 0, true); | |
| 21 } | |
| 22 | |
| 23 ViewAndroid* ViewRoot::GetViewRoot() { | |
| 24 return this; | |
| 25 } | |
| 26 | |
| 27 WindowAndroid* ViewRoot::GetWindowAndroid() const { | |
| 28 return window_; | |
| 29 } | |
| 30 | |
| 31 void ViewRoot::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { | |
| 32 delete this; | |
| 33 } | |
| 34 | |
| 35 jboolean ViewRoot::OnTouchEvent(JNIEnv* env, | |
| 36 const JavaParamRef<jobject>& obj, | |
| 37 const JavaParamRef<jobject>& motion_event, | |
| 38 jlong time_ms, | |
| 39 jint android_action, | |
| 40 jint pointer_count, | |
| 41 jint history_size, | |
| 42 jint action_index, | |
| 43 jfloat pos_x_0, | |
| 44 jfloat pos_y_0, | |
| 45 jfloat pos_x_1, | |
| 46 jfloat pos_y_1, | |
| 47 jint pointer_id_0, | |
| 48 jint pointer_id_1, | |
| 49 jfloat touch_major_0, | |
| 50 jfloat touch_major_1, | |
| 51 jfloat touch_minor_0, | |
| 52 jfloat touch_minor_1, | |
| 53 jfloat orientation_0, | |
| 54 jfloat orientation_1, | |
| 55 jfloat tilt_0, | |
| 56 jfloat tilt_1, | |
| 57 jfloat raw_pos_x, | |
| 58 jfloat raw_pos_y, | |
| 59 jint android_tool_type_0, | |
| 60 jint android_tool_type_1, | |
| 61 jint android_button_state, | |
| 62 jint android_meta_state, | |
| 63 jboolean is_touch_handle_event) { | |
| 64 MotionEventData event(GetDipScale(), | |
| 65 motion_event.obj(), | |
| 66 time_ms, | |
| 67 android_action, | |
| 68 pointer_count, | |
| 69 history_size, | |
| 70 action_index, | |
| 71 pos_x_0, | |
| 72 pos_y_0, | |
| 73 pos_x_1, | |
| 74 pos_y_1, | |
| 75 pointer_id_0, | |
| 76 pointer_id_1, | |
| 77 touch_major_0, | |
| 78 touch_major_1, | |
| 79 touch_minor_0, | |
| 80 touch_minor_1, | |
| 81 orientation_0, | |
| 82 orientation_1, | |
| 83 tilt_0, | |
| 84 tilt_1, | |
| 85 raw_pos_x, | |
| 86 raw_pos_y, | |
| 87 android_tool_type_0, | |
| 88 android_tool_type_1, | |
| 89 android_button_state, | |
| 90 android_meta_state, | |
| 91 is_touch_handle_event); | |
| 92 return OnTouchEventInternal(event); | |
| 93 } | |
| 94 | |
| 95 // static | |
| 96 jlong Init(JNIEnv* env, | |
| 97 const JavaParamRef<jobject>& obj, | |
| 98 jlong window_android_ptr) { | |
| 99 return reinterpret_cast<intptr_t>(new ViewRoot(window_android_ptr)); | |
| 100 } | |
| 101 | |
| 102 bool RegisterViewRoot(JNIEnv* env) { | |
| 103 return RegisterNativesImpl(env); | |
| 104 } | |
| 105 | |
| 106 } // namespace ui | |
| OLD | NEW |