| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 raw_pos_y - pos_y_0, | 959 raw_pos_y - pos_y_0, |
| 960 &pointer0, | 960 &pointer0, |
| 961 &pointer1); | 961 &pointer1); |
| 962 | 962 |
| 963 RecordToolTypeForActionDown(event); | 963 RecordToolTypeForActionDown(event); |
| 964 | 964 |
| 965 return is_touch_handle_event ? rwhv->OnTouchHandleEvent(event) | 965 return is_touch_handle_event ? rwhv->OnTouchHandleEvent(event) |
| 966 : rwhv->OnTouchEvent(event); | 966 : rwhv->OnTouchEvent(event); |
| 967 } | 967 } |
| 968 | 968 |
| 969 jboolean ContentViewCoreImpl::SendMouseEvent( | 969 jboolean ContentViewCoreImpl::SendMouseEvent(JNIEnv* env, |
| 970 JNIEnv* env, | 970 const JavaParamRef<jobject>& obj, |
| 971 const JavaParamRef<jobject>& obj, | 971 jlong time_ms, |
| 972 jlong time_ms, | 972 jint android_action, |
| 973 jint android_action, | 973 jfloat x, |
| 974 jfloat x, | 974 jfloat y, |
| 975 jfloat y, | 975 jint pointer_id, |
| 976 jint pointer_id, | 976 jfloat pressure, |
| 977 jfloat pressure, | 977 jfloat orientation, |
| 978 jfloat orientation, | 978 jfloat tilt, |
| 979 jfloat tilt, | 979 jint android_action_button, |
| 980 jint android_changed_button, | 980 jint android_button_state, |
| 981 jint android_button_state, | 981 jint android_meta_state, |
| 982 jint android_meta_state, | 982 jint android_tool_type) { |
| 983 jint android_tool_type) { | |
| 984 | |
| 985 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 983 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 986 if (!rwhv) | 984 if (!rwhv) |
| 987 return false; | 985 return false; |
| 988 | 986 |
| 989 // Construct a motion_event object minimally, only to convert the raw | 987 // Construct a motion_event object minimally, only to convert the raw |
| 990 // parameters to ui::MotionEvent values. Since we used only the cached values | 988 // parameters to ui::MotionEvent values. Since we used only the cached values |
| 991 // at index=0, it is okay to even pass a null event to the constructor. | 989 // at index=0, it is okay to even pass a null event to the constructor. |
| 992 MotionEventAndroid::Pointer pointer0( | 990 MotionEventAndroid::Pointer pointer0( |
| 993 pointer_id, x, y, 0.0f /* touch_major */, 0.0f /* touch_minor */, | 991 pointer_id, x, y, 0.0f /* touch_major */, 0.0f /* touch_minor */, |
| 994 orientation, tilt, android_tool_type); | 992 orientation, tilt, android_tool_type); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1005 android_meta_state, | 1003 android_meta_state, |
| 1006 0 /* raw_offset_x_pixels */, | 1004 0 /* raw_offset_x_pixels */, |
| 1007 0 /* raw_offset_y_pixels */, | 1005 0 /* raw_offset_y_pixels */, |
| 1008 &pointer0, | 1006 &pointer0, |
| 1009 nullptr); | 1007 nullptr); |
| 1010 | 1008 |
| 1011 RecordToolTypeForActionDown(motion_event); | 1009 RecordToolTypeForActionDown(motion_event); |
| 1012 | 1010 |
| 1013 // Note: This relies on identical button enum values in MotionEvent and | 1011 // Note: This relies on identical button enum values in MotionEvent and |
| 1014 // MotionEventAndroid. | 1012 // MotionEventAndroid. |
| 1015 rwhv->SendMouseEvent(motion_event, android_changed_button); | 1013 rwhv->SendMouseEvent(motion_event, android_action_button); |
| 1016 | 1014 |
| 1017 return true; | 1015 return true; |
| 1018 } | 1016 } |
| 1019 | 1017 |
| 1020 jboolean ContentViewCoreImpl::SendMouseWheelEvent( | 1018 jboolean ContentViewCoreImpl::SendMouseWheelEvent( |
| 1021 JNIEnv* env, | 1019 JNIEnv* env, |
| 1022 const JavaParamRef<jobject>& obj, | 1020 const JavaParamRef<jobject>& obj, |
| 1023 jlong time_ms, | 1021 jlong time_ms, |
| 1024 jfloat x, | 1022 jfloat x, |
| 1025 jfloat y, | 1023 jfloat y, |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 return ScopedJavaLocalRef<jobject>(); | 1549 return ScopedJavaLocalRef<jobject>(); |
| 1552 | 1550 |
| 1553 return view->GetJavaObject(); | 1551 return view->GetJavaObject(); |
| 1554 } | 1552 } |
| 1555 | 1553 |
| 1556 bool RegisterContentViewCore(JNIEnv* env) { | 1554 bool RegisterContentViewCore(JNIEnv* env) { |
| 1557 return RegisterNativesImpl(env); | 1555 return RegisterNativesImpl(env); |
| 1558 } | 1556 } |
| 1559 | 1557 |
| 1560 } // namespace content | 1558 } // namespace content |
| OLD | NEW |