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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 DCHECK(cancel_event); | 1020 DCHECK(cancel_event); |
1021 if (!gesture_provider_.OnTouchEvent(*cancel_event)) | 1021 if (!gesture_provider_.OnTouchEvent(*cancel_event)) |
1022 return; | 1022 return; |
1023 | 1023 |
1024 rwhv->SendTouchEvent( | 1024 rwhv->SendTouchEvent( |
1025 CreateWebTouchEventFromMotionEvent(*cancel_event, 1.f / dpi_scale())); | 1025 CreateWebTouchEventFromMotionEvent(*cancel_event, 1.f / dpi_scale())); |
1026 } | 1026 } |
1027 | 1027 |
1028 jboolean ContentViewCoreImpl::OnTouchEvent(JNIEnv* env, | 1028 jboolean ContentViewCoreImpl::OnTouchEvent(JNIEnv* env, |
1029 jobject obj, | 1029 jobject obj, |
1030 jobject motion_event) { | 1030 jobject motion_event, |
| 1031 jlong time_ms, |
| 1032 jint android_action, |
| 1033 jint pointer_count, |
| 1034 jint history_size, |
| 1035 jint action_index, |
| 1036 jfloat pos_x_0, |
| 1037 jfloat pos_y_0, |
| 1038 jfloat pos_x_1, |
| 1039 jfloat pos_y_1, |
| 1040 jint pointer_id_0, |
| 1041 jint pointer_id_1, |
| 1042 jfloat touch_major_0, |
| 1043 jfloat touch_major_1) { |
1031 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1044 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1032 if (!rwhv) | 1045 if (!rwhv) |
1033 return false; | 1046 return false; |
1034 | 1047 |
1035 MotionEventAndroid event(env, motion_event, false); | 1048 MotionEventAndroid event(env, |
| 1049 motion_event, |
| 1050 time_ms, |
| 1051 android_action, |
| 1052 pointer_count, |
| 1053 history_size, |
| 1054 action_index, |
| 1055 pos_x_0, |
| 1056 pos_y_0, |
| 1057 pos_x_1, |
| 1058 pos_y_1, |
| 1059 pointer_id_0, |
| 1060 pointer_id_1, |
| 1061 touch_major_0, |
| 1062 touch_major_1); |
1036 | 1063 |
1037 if (!gesture_provider_.OnTouchEvent(event)) | 1064 if (!gesture_provider_.OnTouchEvent(event)) |
1038 return false; | 1065 return false; |
1039 | 1066 |
1040 rwhv->SendTouchEvent(WebTouchEventBuilder::Build(event, 1.f / dpi_scale())); | 1067 rwhv->SendTouchEvent(WebTouchEventBuilder::Build(event, 1.f / dpi_scale())); |
1041 return true; | 1068 return true; |
1042 } | 1069 } |
1043 | 1070 |
1044 float ContentViewCoreImpl::GetDpiScale() const { | 1071 float ContentViewCoreImpl::GetDpiScale() const { |
1045 return dpi_scale_; | 1072 return dpi_scale_; |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1770 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1744 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1771 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1745 return reinterpret_cast<intptr_t>(view); | 1772 return reinterpret_cast<intptr_t>(view); |
1746 } | 1773 } |
1747 | 1774 |
1748 bool RegisterContentViewCore(JNIEnv* env) { | 1775 bool RegisterContentViewCore(JNIEnv* env) { |
1749 return RegisterNativesImpl(env); | 1776 return RegisterNativesImpl(env); |
1750 } | 1777 } |
1751 | 1778 |
1752 } // namespace content | 1779 } // namespace content |
OLD | NEW |