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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
17 #include "cc/layers/solid_color_layer.h" | 17 #include "cc/layers/solid_color_layer.h" |
18 #include "cc/output/begin_frame_args.h" | 18 #include "cc/output/begin_frame_args.h" |
19 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 19 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
20 #include "content/browser/android/gesture_event_type.h" | 20 #include "content/browser/android/gesture_event_type.h" |
21 #include "content/browser/android/interstitial_page_delegate_android.h" | 21 #include "content/browser/android/interstitial_page_delegate_android.h" |
22 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" | 22 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" |
23 #include "content/browser/android/load_url_params.h" | 23 #include "content/browser/android/load_url_params.h" |
24 #include "content/browser/frame_host/interstitial_page_impl.h" | 24 #include "content/browser/frame_host/interstitial_page_impl.h" |
25 #include "content/browser/geolocation/geolocation_service_context.h" | 25 #include "content/browser/geolocation/geolocation_service_context.h" |
26 #include "content/browser/media/media_web_contents_observer.h" | 26 #include "content/browser/media/media_web_contents_observer.h" |
27 #include "content/browser/renderer_host/compositor_impl_android.h" | 27 #include "content/browser/renderer_host/compositor_impl_android.h" |
28 #include "content/browser/renderer_host/input/motion_event_android.h" | |
29 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 28 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
30 #include "content/browser/renderer_host/input/web_input_event_util.h" | 29 #include "content/browser/renderer_host/input/web_input_event_util.h" |
31 #include "content/browser/renderer_host/render_view_host_impl.h" | 30 #include "content/browser/renderer_host/render_view_host_impl.h" |
32 #include "content/browser/renderer_host/render_widget_host_impl.h" | 31 #include "content/browser/renderer_host/render_widget_host_impl.h" |
33 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 32 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
34 #include "content/browser/web_contents/web_contents_view_android.h" | 33 #include "content/browser/web_contents/web_contents_view_android.h" |
35 #include "content/common/frame_messages.h" | 34 #include "content/common/frame_messages.h" |
36 #include "content/common/input/web_input_event_traits.h" | 35 #include "content/common/input/web_input_event_traits.h" |
37 #include "content/common/input_messages.h" | 36 #include "content/common/input_messages.h" |
38 #include "content/common/view_messages.h" | 37 #include "content/common/view_messages.h" |
39 #include "content/public/browser/android/compositor.h" | 38 #include "content/public/browser/android/compositor.h" |
40 #include "content/public/browser/browser_context.h" | 39 #include "content/public/browser/browser_context.h" |
41 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
42 #include "content/public/browser/favicon_status.h" | 41 #include "content/public/browser/favicon_status.h" |
43 #include "content/public/browser/render_frame_host.h" | 42 #include "content/public/browser/render_frame_host.h" |
44 #include "content/public/browser/screen_orientation_dispatcher_host.h" | 43 #include "content/public/browser/screen_orientation_dispatcher_host.h" |
45 #include "content/public/browser/ssl_host_state_delegate.h" | 44 #include "content/public/browser/ssl_host_state_delegate.h" |
46 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
47 #include "content/public/common/content_client.h" | 46 #include "content/public/common/content_client.h" |
48 #include "content/public/common/content_switches.h" | 47 #include "content/public/common/content_switches.h" |
49 #include "content/public/common/menu_item.h" | 48 #include "content/public/common/menu_item.h" |
50 #include "content/public/common/user_agent.h" | 49 #include "content/public/common/user_agent.h" |
51 #include "jni/ContentViewCore_jni.h" | 50 #include "jni/ContentViewCore_jni.h" |
52 #include "third_party/WebKit/public/web/WebInputEvent.h" | 51 #include "third_party/WebKit/public/web/WebInputEvent.h" |
53 #include "ui/android/view_android.h" | 52 #include "ui/android/view_android.h" |
54 #include "ui/android/window_android.h" | 53 #include "ui/android/window_android.h" |
| 54 #include "ui/events/android/motion_event_android.h" |
55 #include "ui/gfx/android/java_bitmap.h" | 55 #include "ui/gfx/android/java_bitmap.h" |
56 #include "ui/gfx/geometry/point_conversions.h" | 56 #include "ui/gfx/geometry/point_conversions.h" |
57 #include "ui/gfx/geometry/size_conversions.h" | 57 #include "ui/gfx/geometry/size_conversions.h" |
58 #include "ui/gfx/geometry/size_f.h" | 58 #include "ui/gfx/geometry/size_f.h" |
59 | 59 |
60 using base::android::AttachCurrentThread; | 60 using base::android::AttachCurrentThread; |
61 using base::android::ConvertJavaStringToUTF16; | 61 using base::android::ConvertJavaStringToUTF16; |
62 using base::android::ConvertJavaStringToUTF8; | 62 using base::android::ConvertJavaStringToUTF8; |
63 using base::android::ConvertUTF16ToJavaString; | 63 using base::android::ConvertUTF16ToJavaString; |
64 using base::android::ConvertUTF8ToJavaString; | 64 using base::android::ConvertUTF8ToJavaString; |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 jint android_tool_type_0, | 882 jint android_tool_type_0, |
883 jint android_tool_type_1, | 883 jint android_tool_type_1, |
884 jint android_button_state, | 884 jint android_button_state, |
885 jint android_meta_state, | 885 jint android_meta_state, |
886 jboolean is_touch_handle_event) { | 886 jboolean is_touch_handle_event) { |
887 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 887 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
888 // Avoid synthesizing a touch event if it cannot be forwarded. | 888 // Avoid synthesizing a touch event if it cannot be forwarded. |
889 if (!rwhv) | 889 if (!rwhv) |
890 return false; | 890 return false; |
891 | 891 |
892 MotionEventAndroid::Pointer pointer0(pointer_id_0, | 892 ui::MotionEventAndroid::Pointer pointer0(pointer_id_0, |
893 pos_x_0, | 893 pos_x_0, |
894 pos_y_0, | 894 pos_y_0, |
895 touch_major_0, | 895 touch_major_0, |
896 touch_minor_0, | 896 touch_minor_0, |
897 orientation_0, | 897 orientation_0, |
898 android_tool_type_0); | 898 android_tool_type_0); |
899 MotionEventAndroid::Pointer pointer1(pointer_id_1, | 899 ui::MotionEventAndroid::Pointer pointer1(pointer_id_1, |
900 pos_x_1, | 900 pos_x_1, |
901 pos_y_1, | 901 pos_y_1, |
902 touch_major_1, | 902 touch_major_1, |
903 touch_minor_1, | 903 touch_minor_1, |
904 orientation_1, | 904 orientation_1, |
905 android_tool_type_1); | 905 android_tool_type_1); |
906 MotionEventAndroid event(1.f / dpi_scale(), | 906 ui::MotionEventAndroid event(1.f / dpi_scale(), |
907 env, | 907 env, |
908 motion_event, | 908 motion_event, |
909 time_ms, | 909 time_ms, |
910 android_action, | 910 android_action, |
911 pointer_count, | 911 pointer_count, |
912 history_size, | 912 history_size, |
913 action_index, | 913 action_index, |
914 android_button_state, | 914 android_button_state, |
915 android_meta_state, | 915 android_meta_state, |
916 raw_pos_x - pos_x_0, | 916 raw_pos_x - pos_x_0, |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 return ScopedJavaLocalRef<jobject>(); | 1448 return ScopedJavaLocalRef<jobject>(); |
1449 | 1449 |
1450 return view->GetJavaObject(); | 1450 return view->GetJavaObject(); |
1451 } | 1451 } |
1452 | 1452 |
1453 bool RegisterContentViewCore(JNIEnv* env) { | 1453 bool RegisterContentViewCore(JNIEnv* env) { |
1454 return RegisterNativesImpl(env); | 1454 return RegisterNativesImpl(env); |
1455 } | 1455 } |
1456 | 1456 |
1457 } // namespace content | 1457 } // namespace content |
OLD | NEW |