| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
| 49 #include "content/public/common/content_client.h" | 49 #include "content/public/common/content_client.h" |
| 50 #include "content/public/common/content_switches.h" | 50 #include "content/public/common/content_switches.h" |
| 51 #include "content/public/common/menu_item.h" | 51 #include "content/public/common/menu_item.h" |
| 52 #include "content/public/common/user_agent.h" | 52 #include "content/public/common/user_agent.h" |
| 53 #include "jni/ContentViewCore_jni.h" | 53 #include "jni/ContentViewCore_jni.h" |
| 54 #include "third_party/WebKit/public/web/WebInputEvent.h" | 54 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 55 #include "ui/android/view_android.h" | 55 #include "ui/android/view_android.h" |
| 56 #include "ui/android/window_android.h" | 56 #include "ui/android/window_android.h" |
| 57 #include "ui/events/android/motion_event_android.h" | 57 #include "ui/events/android/motion_event_android.h" |
| 58 #include "ui/events/blink/blink_event_util.h" |
| 58 #include "ui/gfx/android/java_bitmap.h" | 59 #include "ui/gfx/android/java_bitmap.h" |
| 59 #include "ui/gfx/geometry/point_conversions.h" | 60 #include "ui/gfx/geometry/point_conversions.h" |
| 60 #include "ui/gfx/geometry/size_conversions.h" | 61 #include "ui/gfx/geometry/size_conversions.h" |
| 61 #include "ui/gfx/geometry/size_f.h" | 62 #include "ui/gfx/geometry/size_f.h" |
| 62 | 63 |
| 63 using base::android::AttachCurrentThread; | 64 using base::android::AttachCurrentThread; |
| 64 using base::android::ConvertJavaStringToUTF16; | 65 using base::android::ConvertJavaStringToUTF16; |
| 65 using base::android::ConvertJavaStringToUTF8; | 66 using base::android::ConvertJavaStringToUTF8; |
| 66 using base::android::ConvertUTF16ToJavaString; | 67 using base::android::ConvertUTF16ToJavaString; |
| 67 using base::android::ConvertUTF8ToJavaString; | 68 using base::android::ConvertUTF8ToJavaString; |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 | 975 |
| 975 float ContentViewCoreImpl::GetDpiScale() const { | 976 float ContentViewCoreImpl::GetDpiScale() const { |
| 976 return dpi_scale_; | 977 return dpi_scale_; |
| 977 } | 978 } |
| 978 | 979 |
| 979 jboolean ContentViewCoreImpl::SendMouseMoveEvent( | 980 jboolean ContentViewCoreImpl::SendMouseMoveEvent( |
| 980 JNIEnv* env, | 981 JNIEnv* env, |
| 981 const JavaParamRef<jobject>& obj, | 982 const JavaParamRef<jobject>& obj, |
| 982 jlong time_ms, | 983 jlong time_ms, |
| 983 jfloat x, | 984 jfloat x, |
| 984 jfloat y) { | 985 jfloat y, |
| 986 jint tool_type) { |
| 985 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 987 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 986 if (!rwhv) | 988 if (!rwhv) |
| 987 return false; | 989 return false; |
| 988 | 990 |
| 989 blink::WebMouseEvent event = WebMouseEventBuilder::Build( | 991 blink::WebMouseEvent event = WebMouseEventBuilder::Build( |
| 990 WebInputEvent::MouseMove, | 992 WebInputEvent::MouseMove, |
| 991 blink::WebMouseEvent::ButtonNone, | 993 blink::WebMouseEvent::ButtonNone, |
| 992 time_ms / 1000.0, x / dpi_scale(), y / dpi_scale(), 0, 1); | 994 time_ms / 1000.0, x / dpi_scale(), y / dpi_scale(), 0, 1, |
| 995 ui::ToWebPointerType(static_cast<ui::MotionEvent::ToolType>(tool_type))); |
| 993 | 996 |
| 994 rwhv->SendMouseEvent(event); | 997 rwhv->SendMouseEvent(event); |
| 995 return true; | 998 return true; |
| 996 } | 999 } |
| 997 | 1000 |
| 998 jboolean ContentViewCoreImpl::SendMouseWheelEvent( | 1001 jboolean ContentViewCoreImpl::SendMouseWheelEvent( |
| 999 JNIEnv* env, | 1002 JNIEnv* env, |
| 1000 const JavaParamRef<jobject>& obj, | 1003 const JavaParamRef<jobject>& obj, |
| 1001 jlong time_ms, | 1004 jlong time_ms, |
| 1002 jfloat x, | 1005 jfloat x, |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 return ScopedJavaLocalRef<jobject>(); | 1540 return ScopedJavaLocalRef<jobject>(); |
| 1538 | 1541 |
| 1539 return view->GetJavaObject(); | 1542 return view->GetJavaObject(); |
| 1540 } | 1543 } |
| 1541 | 1544 |
| 1542 bool RegisterContentViewCore(JNIEnv* env) { | 1545 bool RegisterContentViewCore(JNIEnv* env) { |
| 1543 return RegisterNativesImpl(env); | 1546 return RegisterNativesImpl(env); |
| 1544 } | 1547 } |
| 1545 | 1548 |
| 1546 } // namespace content | 1549 } // namespace content |
| OLD | NEW |