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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 | 947 |
948 rwhv->SendMouseEvent(event); | 948 rwhv->SendMouseEvent(event); |
949 return true; | 949 return true; |
950 } | 950 } |
951 | 951 |
952 jboolean ContentViewCoreImpl::SendMouseWheelEvent(JNIEnv* env, | 952 jboolean ContentViewCoreImpl::SendMouseWheelEvent(JNIEnv* env, |
953 jobject obj, | 953 jobject obj, |
954 jlong time_ms, | 954 jlong time_ms, |
955 jfloat x, | 955 jfloat x, |
956 jfloat y, | 956 jfloat y, |
957 jfloat vertical_axis) { | 957 jfloat vertical_axis, |
| 958 jfloat horizontal_axis) { |
958 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 959 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
959 if (!rwhv) | 960 if (!rwhv) |
960 return false; | 961 return false; |
961 | 962 |
962 WebMouseWheelEventBuilder::Direction direction; | 963 WebMouseWheelEventBuilder::Direction direction; |
963 if (vertical_axis > 0) { | 964 if (vertical_axis > 0) { |
964 direction = WebMouseWheelEventBuilder::DIRECTION_UP; | 965 direction = WebMouseWheelEventBuilder::DIRECTION_UP; |
965 } else if (vertical_axis < 0) { | 966 } else if (vertical_axis < 0) { |
966 direction = WebMouseWheelEventBuilder::DIRECTION_DOWN; | 967 direction = WebMouseWheelEventBuilder::DIRECTION_DOWN; |
| 968 } else if (horizontal_axis > 0) { |
| 969 direction = WebMouseWheelEventBuilder::DIRECTION_RIGHT; |
| 970 } else if (horizontal_axis < 0) { |
| 971 direction = WebMouseWheelEventBuilder::DIRECTION_LEFT; |
967 } else { | 972 } else { |
968 return false; | 973 return false; |
969 } | 974 } |
970 blink::WebMouseWheelEvent event = WebMouseWheelEventBuilder::Build( | 975 blink::WebMouseWheelEvent event = WebMouseWheelEventBuilder::Build( |
971 direction, time_ms / 1000.0, x / dpi_scale(), y / dpi_scale()); | 976 direction, time_ms / 1000.0, x / dpi_scale(), y / dpi_scale()); |
972 | 977 |
973 rwhv->SendMouseWheelEvent(event); | 978 rwhv->SendMouseWheelEvent(event); |
974 return true; | 979 return true; |
975 } | 980 } |
976 | 981 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1352 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1348 retained_objects_set); | 1353 retained_objects_set); |
1349 return reinterpret_cast<intptr_t>(view); | 1354 return reinterpret_cast<intptr_t>(view); |
1350 } | 1355 } |
1351 | 1356 |
1352 bool RegisterContentViewCore(JNIEnv* env) { | 1357 bool RegisterContentViewCore(JNIEnv* env) { |
1353 return RegisterNativesImpl(env); | 1358 return RegisterNativesImpl(env); |
1354 } | 1359 } |
1355 | 1360 |
1356 } // namespace content | 1361 } // namespace content |
OLD | NEW |