Chromium Code Reviews| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 JNIEnv* env = base::android::AttachCurrentThread(); | 250 JNIEnv* env = base::android::AttachCurrentThread(); |
| 251 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 251 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 252 java_ref_.reset(); | 252 java_ref_.reset(); |
| 253 if (!j_obj.is_null()) { | 253 if (!j_obj.is_null()) { |
| 254 Java_ContentViewCore_onNativeContentViewCoreDestroyed( | 254 Java_ContentViewCore_onNativeContentViewCoreDestroyed( |
| 255 env, j_obj.obj(), reinterpret_cast<intptr_t>(this)); | 255 env, j_obj.obj(), reinterpret_cast<intptr_t>(this)); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 base::android::ScopedJavaLocalRef<jobject> | 259 base::android::ScopedJavaLocalRef<jobject> |
| 260 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, jobject obj) { | 260 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, |
| 261 const JavaParamRef<jobject>& obj) { | |
| 261 return web_contents_->GetJavaWebContents(); | 262 return web_contents_->GetJavaWebContents(); |
| 262 } | 263 } |
| 263 | 264 |
| 264 base::android::ScopedJavaLocalRef<jobject> | 265 base::android::ScopedJavaLocalRef<jobject> |
| 265 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env, jobject obj) { | 266 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env, |
| 267 const JavaParamRef<jobject>& obj) { | |
| 266 if (!window_android_) | 268 if (!window_android_) |
| 267 return ScopedJavaLocalRef<jobject>(); | 269 return ScopedJavaLocalRef<jobject>(); |
| 268 return window_android_->GetJavaObject(); | 270 return window_android_->GetJavaObject(); |
| 269 } | 271 } |
| 270 | 272 |
| 271 void ContentViewCoreImpl::OnJavaContentViewCoreDestroyed(JNIEnv* env, | 273 void ContentViewCoreImpl::OnJavaContentViewCoreDestroyed( |
| 272 jobject obj) { | 274 JNIEnv* env, |
| 275 const JavaParamRef<jobject>& obj) { | |
| 273 DCHECK(env->IsSameObject(java_ref_.get(env).obj(), obj)); | 276 DCHECK(env->IsSameObject(java_ref_.get(env).obj(), obj)); |
| 274 java_ref_.reset(); | 277 java_ref_.reset(); |
| 275 // Java peer has gone, ContentViewCore is not functional and waits to | 278 // Java peer has gone, ContentViewCore is not functional and waits to |
| 276 // be destroyed with WebContents. | 279 // be destroyed with WebContents. |
| 277 // We need to reset WebContentsViewAndroid's reference, otherwise, there | 280 // We need to reset WebContentsViewAndroid's reference, otherwise, there |
| 278 // could have call in when swapping the WebContents, | 281 // could have call in when swapping the WebContents, |
| 279 // see http://crbug.com/383939 . | 282 // see http://crbug.com/383939 . |
| 280 DCHECK(web_contents_); | 283 DCHECK(web_contents_); |
| 281 static_cast<WebContentsViewAndroid*>( | 284 static_cast<WebContentsViewAndroid*>( |
| 282 static_cast<WebContentsImpl*>(web_contents_)->GetView())-> | 285 static_cast<WebContentsImpl*>(web_contents_)->GetView())-> |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 804 } | 807 } |
| 805 | 808 |
| 806 const scoped_refptr<cc::Layer>& ContentViewCoreImpl::GetLayer() const { | 809 const scoped_refptr<cc::Layer>& ContentViewCoreImpl::GetLayer() const { |
| 807 return root_layer_; | 810 return root_layer_; |
| 808 } | 811 } |
| 809 | 812 |
| 810 // ---------------------------------------------------------------------------- | 813 // ---------------------------------------------------------------------------- |
| 811 // Methods called from Java via JNI | 814 // Methods called from Java via JNI |
| 812 // ---------------------------------------------------------------------------- | 815 // ---------------------------------------------------------------------------- |
| 813 | 816 |
| 814 void ContentViewCoreImpl::SelectPopupMenuItems(JNIEnv* env, | 817 void ContentViewCoreImpl::SelectPopupMenuItems( |
| 815 jobject obj, | 818 JNIEnv* env, |
| 816 jlong selectPopupSourceFrame, | 819 const JavaParamRef<jobject>& obj, |
| 817 jintArray indices) { | 820 jlong selectPopupSourceFrame, |
| 821 const JavaParamRef<jintArray>& indices) { | |
| 818 RenderFrameHostImpl* rfhi = | 822 RenderFrameHostImpl* rfhi = |
| 819 reinterpret_cast<RenderFrameHostImpl*>(selectPopupSourceFrame); | 823 reinterpret_cast<RenderFrameHostImpl*>(selectPopupSourceFrame); |
| 820 DCHECK(rfhi); | 824 DCHECK(rfhi); |
| 821 if (indices == NULL) { | 825 if (indices == NULL) { |
| 822 rfhi->DidCancelPopupMenu(); | 826 rfhi->DidCancelPopupMenu(); |
| 823 return; | 827 return; |
| 824 } | 828 } |
| 825 | 829 |
| 826 int selected_count = env->GetArrayLength(indices); | 830 int selected_count = env->GetArrayLength(indices); |
| 827 std::vector<int> selected_indices; | 831 std::vector<int> selected_indices; |
| 828 jint* indices_ptr = env->GetIntArrayElements(indices, NULL); | 832 jint* indices_ptr = env->GetIntArrayElements(indices, NULL); |
| 829 for (int i = 0; i < selected_count; ++i) | 833 for (int i = 0; i < selected_count; ++i) |
| 830 selected_indices.push_back(indices_ptr[i]); | 834 selected_indices.push_back(indices_ptr[i]); |
| 831 env->ReleaseIntArrayElements(indices, indices_ptr, JNI_ABORT); | 835 env->ReleaseIntArrayElements(indices, indices_ptr, JNI_ABORT); |
| 832 rfhi->DidSelectPopupMenuItems(selected_indices); | 836 rfhi->DidSelectPopupMenuItems(selected_indices); |
| 833 } | 837 } |
| 834 | 838 |
| 835 WebContents* ContentViewCoreImpl::GetWebContents() const { | 839 WebContents* ContentViewCoreImpl::GetWebContents() const { |
| 836 return web_contents_; | 840 return web_contents_; |
| 837 } | 841 } |
| 838 | 842 |
| 839 void ContentViewCoreImpl::SetFocus(JNIEnv* env, jobject obj, jboolean focused) { | 843 void ContentViewCoreImpl::SetFocus(JNIEnv* env, |
| 844 const JavaParamRef<jobject>& obj, | |
| 845 jboolean focused) { | |
| 840 SetFocusInternal(focused); | 846 SetFocusInternal(focused); |
| 841 } | 847 } |
| 842 | 848 |
| 843 void ContentViewCoreImpl::SetFocusInternal(bool focused) { | 849 void ContentViewCoreImpl::SetFocusInternal(bool focused) { |
| 844 if (!GetRenderWidgetHostViewAndroid()) | 850 if (!GetRenderWidgetHostViewAndroid()) |
| 845 return; | 851 return; |
| 846 | 852 |
| 847 if (focused) | 853 if (focused) |
| 848 GetRenderWidgetHostViewAndroid()->Focus(); | 854 GetRenderWidgetHostViewAndroid()->Focus(); |
| 849 else | 855 else |
| 850 GetRenderWidgetHostViewAndroid()->Blur(); | 856 GetRenderWidgetHostViewAndroid()->Blur(); |
| 851 } | 857 } |
| 852 | 858 |
| 853 void ContentViewCoreImpl::SendOrientationChangeEvent(JNIEnv* env, | 859 void ContentViewCoreImpl::SendOrientationChangeEvent( |
| 854 jobject obj, | 860 JNIEnv* env, |
| 855 jint orientation) { | 861 const JavaParamRef<jobject>& obj, |
| 862 jint orientation) { | |
| 856 if (device_orientation_ != orientation) { | 863 if (device_orientation_ != orientation) { |
| 857 device_orientation_ = orientation; | 864 device_orientation_ = orientation; |
| 858 SendOrientationChangeEventInternal(); | 865 SendOrientationChangeEventInternal(); |
| 859 } | 866 } |
| 860 } | 867 } |
| 861 | 868 |
| 862 jboolean ContentViewCoreImpl::OnTouchEvent(JNIEnv* env, | 869 jboolean ContentViewCoreImpl::OnTouchEvent( |
| 863 jobject obj, | 870 JNIEnv* env, |
| 864 jobject motion_event, | 871 const JavaParamRef<jobject>& obj, |
| 865 jlong time_ms, | 872 const JavaParamRef<jobject>& motion_event, |
| 866 jint android_action, | 873 jlong time_ms, |
| 867 jint pointer_count, | 874 jint android_action, |
| 868 jint history_size, | 875 jint pointer_count, |
| 869 jint action_index, | 876 jint history_size, |
| 870 jfloat pos_x_0, | 877 jint action_index, |
| 871 jfloat pos_y_0, | 878 jfloat pos_x_0, |
| 872 jfloat pos_x_1, | 879 jfloat pos_y_0, |
| 873 jfloat pos_y_1, | 880 jfloat pos_x_1, |
| 874 jint pointer_id_0, | 881 jfloat pos_y_1, |
| 875 jint pointer_id_1, | 882 jint pointer_id_0, |
| 876 jfloat touch_major_0, | 883 jint pointer_id_1, |
| 877 jfloat touch_major_1, | 884 jfloat touch_major_0, |
| 878 jfloat touch_minor_0, | 885 jfloat touch_major_1, |
| 879 jfloat touch_minor_1, | 886 jfloat touch_minor_0, |
| 880 jfloat orientation_0, | 887 jfloat touch_minor_1, |
| 881 jfloat orientation_1, | 888 jfloat orientation_0, |
| 882 jfloat tilt_0, | 889 jfloat orientation_1, |
| 883 jfloat tilt_1, | 890 jfloat tilt_0, |
| 884 jfloat raw_pos_x, | 891 jfloat tilt_1, |
| 885 jfloat raw_pos_y, | 892 jfloat raw_pos_x, |
| 886 jint android_tool_type_0, | 893 jfloat raw_pos_y, |
| 887 jint android_tool_type_1, | 894 jint android_tool_type_0, |
| 888 jint android_button_state, | 895 jint android_tool_type_1, |
| 889 jint android_meta_state, | 896 jint android_button_state, |
| 890 jboolean is_touch_handle_event) { | 897 jint android_meta_state, |
| 898 jboolean is_touch_handle_event) { | |
| 891 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 899 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 892 // Avoid synthesizing a touch event if it cannot be forwarded. | 900 // Avoid synthesizing a touch event if it cannot be forwarded. |
| 893 if (!rwhv) | 901 if (!rwhv) |
| 894 return false; | 902 return false; |
| 895 | 903 |
| 896 ui::MotionEventAndroid::Pointer pointer0(pointer_id_0, | 904 ui::MotionEventAndroid::Pointer pointer0(pointer_id_0, |
| 897 pos_x_0, | 905 pos_x_0, |
| 898 pos_y_0, | 906 pos_y_0, |
| 899 touch_major_0, | 907 touch_major_0, |
| 900 touch_minor_0, | 908 touch_minor_0, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 925 pointer1); | 933 pointer1); |
| 926 | 934 |
| 927 return is_touch_handle_event ? rwhv->OnTouchHandleEvent(event) | 935 return is_touch_handle_event ? rwhv->OnTouchHandleEvent(event) |
| 928 : rwhv->OnTouchEvent(event); | 936 : rwhv->OnTouchEvent(event); |
| 929 } | 937 } |
| 930 | 938 |
| 931 float ContentViewCoreImpl::GetDpiScale() const { | 939 float ContentViewCoreImpl::GetDpiScale() const { |
| 932 return dpi_scale_; | 940 return dpi_scale_; |
| 933 } | 941 } |
| 934 | 942 |
| 935 jboolean ContentViewCoreImpl::SendMouseMoveEvent(JNIEnv* env, | 943 jboolean ContentViewCoreImpl::SendMouseMoveEvent( |
| 936 jobject obj, | 944 JNIEnv* env, |
| 937 jlong time_ms, | 945 const JavaParamRef<jobject>& obj, |
| 938 jfloat x, | 946 jlong time_ms, |
| 939 jfloat y) { | 947 jfloat x, |
| 948 jfloat y) { | |
| 940 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 949 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 941 if (!rwhv) | 950 if (!rwhv) |
| 942 return false; | 951 return false; |
| 943 | 952 |
| 944 blink::WebMouseEvent event = WebMouseEventBuilder::Build( | 953 blink::WebMouseEvent event = WebMouseEventBuilder::Build( |
| 945 WebInputEvent::MouseMove, | 954 WebInputEvent::MouseMove, |
| 946 blink::WebMouseEvent::ButtonNone, | 955 blink::WebMouseEvent::ButtonNone, |
| 947 time_ms / 1000.0, x / dpi_scale(), y / dpi_scale(), 0, 1); | 956 time_ms / 1000.0, x / dpi_scale(), y / dpi_scale(), 0, 1); |
| 948 | 957 |
| 949 rwhv->SendMouseEvent(event); | 958 rwhv->SendMouseEvent(event); |
| 950 return true; | 959 return true; |
| 951 } | 960 } |
| 952 | 961 |
| 953 jboolean ContentViewCoreImpl::SendMouseWheelEvent(JNIEnv* env, | 962 jboolean ContentViewCoreImpl::SendMouseWheelEvent( |
| 954 jobject obj, | 963 JNIEnv* env, |
| 955 jlong time_ms, | 964 const JavaParamRef<jobject>& obj, |
| 956 jfloat x, | 965 jlong time_ms, |
| 957 jfloat y, | 966 jfloat x, |
| 958 jfloat ticks_x, | 967 jfloat y, |
| 959 jfloat ticks_y, | 968 jfloat ticks_x, |
| 960 jfloat pixels_per_tick) { | 969 jfloat ticks_y, |
| 970 jfloat pixels_per_tick) { | |
| 961 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 971 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 962 if (!rwhv) | 972 if (!rwhv) |
| 963 return false; | 973 return false; |
| 964 | 974 |
| 965 if (!ticks_x && !ticks_y) | 975 if (!ticks_x && !ticks_y) |
| 966 return false; | 976 return false; |
| 967 | 977 |
| 968 blink::WebMouseWheelEvent event = WebMouseWheelEventBuilder::Build( | 978 blink::WebMouseWheelEvent event = WebMouseWheelEventBuilder::Build( |
| 969 ticks_x, ticks_y, pixels_per_tick / dpi_scale(), time_ms / 1000.0, | 979 ticks_x, ticks_y, pixels_per_tick / dpi_scale(), time_ms / 1000.0, |
| 970 x / dpi_scale(), y / dpi_scale()); | 980 x / dpi_scale(), y / dpi_scale()); |
| 971 | 981 |
| 972 rwhv->SendMouseWheelEvent(event); | 982 rwhv->SendMouseWheelEvent(event); |
| 973 return true; | 983 return true; |
| 974 } | 984 } |
| 975 | 985 |
| 976 WebGestureEvent ContentViewCoreImpl::MakeGestureEvent( | 986 WebGestureEvent ContentViewCoreImpl::MakeGestureEvent( |
| 977 WebInputEvent::Type type, int64 time_ms, float x, float y) const { | 987 WebInputEvent::Type type, int64 time_ms, float x, float y) const { |
| 978 return WebGestureEventBuilder::Build( | 988 return WebGestureEventBuilder::Build( |
| 979 type, time_ms / 1000.0, x / dpi_scale(), y / dpi_scale()); | 989 type, time_ms / 1000.0, x / dpi_scale(), y / dpi_scale()); |
| 980 } | 990 } |
| 981 | 991 |
| 982 void ContentViewCoreImpl::SendGestureEvent( | 992 void ContentViewCoreImpl::SendGestureEvent( |
| 983 const blink::WebGestureEvent& event) { | 993 const blink::WebGestureEvent& event) { |
| 984 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 994 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 985 if (rwhv) | 995 if (rwhv) |
| 986 rwhv->SendGestureEvent(event); | 996 rwhv->SendGestureEvent(event); |
| 987 } | 997 } |
| 988 | 998 |
| 989 void ContentViewCoreImpl::ScrollBegin(JNIEnv* env, | 999 void ContentViewCoreImpl::ScrollBegin(JNIEnv* env, |
| 990 jobject obj, | 1000 const JavaParamRef<jobject>& obj, |
| 991 jlong time_ms, | 1001 jlong time_ms, |
| 992 jfloat x, | 1002 jfloat x, |
| 993 jfloat y, | 1003 jfloat y, |
| 994 jfloat hintx, | 1004 jfloat hintx, |
| 995 jfloat hinty, | 1005 jfloat hinty, |
| 996 jboolean target_viewport) { | 1006 jboolean target_viewport) { |
| 997 WebGestureEvent event = MakeGestureEvent( | 1007 WebGestureEvent event = MakeGestureEvent( |
| 998 WebInputEvent::GestureScrollBegin, time_ms, x, y); | 1008 WebInputEvent::GestureScrollBegin, time_ms, x, y); |
| 999 event.data.scrollBegin.deltaXHint = hintx / dpi_scale(); | 1009 event.data.scrollBegin.deltaXHint = hintx / dpi_scale(); |
| 1000 event.data.scrollBegin.deltaYHint = hinty / dpi_scale(); | 1010 event.data.scrollBegin.deltaYHint = hinty / dpi_scale(); |
| 1001 event.data.scrollBegin.targetViewport = target_viewport; | 1011 event.data.scrollBegin.targetViewport = target_viewport; |
| 1002 | 1012 |
| 1003 SendGestureEvent(event); | 1013 SendGestureEvent(event); |
| 1004 } | 1014 } |
| 1005 | 1015 |
| 1006 void ContentViewCoreImpl::ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms) { | 1016 void ContentViewCoreImpl::ScrollEnd(JNIEnv* env, |
| 1017 const JavaParamRef<jobject>& obj, | |
| 1018 jlong time_ms) { | |
| 1007 WebGestureEvent event = MakeGestureEvent( | 1019 WebGestureEvent event = MakeGestureEvent( |
| 1008 WebInputEvent::GestureScrollEnd, time_ms, 0, 0); | 1020 WebInputEvent::GestureScrollEnd, time_ms, 0, 0); |
| 1009 SendGestureEvent(event); | 1021 SendGestureEvent(event); |
| 1010 } | 1022 } |
| 1011 | 1023 |
| 1012 void ContentViewCoreImpl::ScrollBy(JNIEnv* env, jobject obj, jlong time_ms, | 1024 void ContentViewCoreImpl::ScrollBy(JNIEnv* env, |
| 1013 jfloat x, jfloat y, jfloat dx, jfloat dy) { | 1025 const JavaParamRef<jobject>& obj, |
| 1026 jlong time_ms, | |
| 1027 jfloat x, | |
| 1028 jfloat y, | |
| 1029 jfloat dx, | |
| 1030 jfloat dy) { | |
| 1014 WebGestureEvent event = MakeGestureEvent( | 1031 WebGestureEvent event = MakeGestureEvent( |
| 1015 WebInputEvent::GestureScrollUpdate, time_ms, x, y); | 1032 WebInputEvent::GestureScrollUpdate, time_ms, x, y); |
| 1016 event.data.scrollUpdate.deltaX = -dx / dpi_scale(); | 1033 event.data.scrollUpdate.deltaX = -dx / dpi_scale(); |
| 1017 event.data.scrollUpdate.deltaY = -dy / dpi_scale(); | 1034 event.data.scrollUpdate.deltaY = -dy / dpi_scale(); |
| 1018 | 1035 |
| 1019 SendGestureEvent(event); | 1036 SendGestureEvent(event); |
| 1020 } | 1037 } |
| 1021 | 1038 |
| 1022 void ContentViewCoreImpl::FlingStart(JNIEnv* env, | 1039 void ContentViewCoreImpl::FlingStart(JNIEnv* env, |
| 1023 jobject obj, | 1040 const JavaParamRef<jobject>& obj, |
| 1024 jlong time_ms, | 1041 jlong time_ms, |
| 1025 jfloat x, | 1042 jfloat x, |
| 1026 jfloat y, | 1043 jfloat y, |
| 1027 jfloat vx, | 1044 jfloat vx, |
| 1028 jfloat vy, | 1045 jfloat vy, |
| 1029 jboolean target_viewport) { | 1046 jboolean target_viewport) { |
| 1030 WebGestureEvent event = MakeGestureEvent( | 1047 WebGestureEvent event = MakeGestureEvent( |
| 1031 WebInputEvent::GestureFlingStart, time_ms, x, y); | 1048 WebInputEvent::GestureFlingStart, time_ms, x, y); |
| 1032 event.data.flingStart.velocityX = vx / dpi_scale(); | 1049 event.data.flingStart.velocityX = vx / dpi_scale(); |
| 1033 event.data.flingStart.velocityY = vy / dpi_scale(); | 1050 event.data.flingStart.velocityY = vy / dpi_scale(); |
| 1034 event.data.flingStart.targetViewport = target_viewport; | 1051 event.data.flingStart.targetViewport = target_viewport; |
| 1035 | 1052 |
| 1036 SendGestureEvent(event); | 1053 SendGestureEvent(event); |
| 1037 } | 1054 } |
| 1038 | 1055 |
| 1039 void ContentViewCoreImpl::FlingCancel(JNIEnv* env, jobject obj, jlong time_ms) { | 1056 void ContentViewCoreImpl::FlingCancel(JNIEnv* env, |
| 1057 const JavaParamRef<jobject>& obj, | |
| 1058 jlong time_ms) { | |
| 1040 WebGestureEvent event = MakeGestureEvent( | 1059 WebGestureEvent event = MakeGestureEvent( |
| 1041 WebInputEvent::GestureFlingCancel, time_ms, 0, 0); | 1060 WebInputEvent::GestureFlingCancel, time_ms, 0, 0); |
| 1042 event.data.flingCancel.preventBoosting = true; | 1061 event.data.flingCancel.preventBoosting = true; |
| 1043 | 1062 |
| 1044 SendGestureEvent(event); | 1063 SendGestureEvent(event); |
| 1045 } | 1064 } |
| 1046 | 1065 |
| 1047 void ContentViewCoreImpl::SingleTap(JNIEnv* env, jobject obj, jlong time_ms, | 1066 void ContentViewCoreImpl::SingleTap(JNIEnv* env, |
| 1048 jfloat x, jfloat y) { | 1067 const JavaParamRef<jobject>& obj, |
| 1068 jlong time_ms, | |
| 1069 jfloat x, | |
| 1070 jfloat y) { | |
| 1049 // Tap gestures should always be preceded by a TapDown, ensuring consistency | 1071 // Tap gestures should always be preceded by a TapDown, ensuring consistency |
| 1050 // with the touch-based gesture detection pipeline. | 1072 // with the touch-based gesture detection pipeline. |
| 1051 WebGestureEvent tap_down_event = MakeGestureEvent( | 1073 WebGestureEvent tap_down_event = MakeGestureEvent( |
| 1052 WebInputEvent::GestureTapDown, time_ms, x, y); | 1074 WebInputEvent::GestureTapDown, time_ms, x, y); |
| 1053 tap_down_event.data.tap.tapCount = 1; | 1075 tap_down_event.data.tap.tapCount = 1; |
| 1054 SendGestureEvent(tap_down_event); | 1076 SendGestureEvent(tap_down_event); |
| 1055 | 1077 |
| 1056 WebGestureEvent tap_event = MakeGestureEvent( | 1078 WebGestureEvent tap_event = MakeGestureEvent( |
| 1057 WebInputEvent::GestureTap, time_ms, x, y); | 1079 WebInputEvent::GestureTap, time_ms, x, y); |
| 1058 tap_event.data.tap.tapCount = 1; | 1080 tap_event.data.tap.tapCount = 1; |
| 1059 SendGestureEvent(tap_event); | 1081 SendGestureEvent(tap_event); |
| 1060 } | 1082 } |
| 1061 | 1083 |
| 1062 void ContentViewCoreImpl::DoubleTap(JNIEnv* env, jobject obj, jlong time_ms, | 1084 void ContentViewCoreImpl::DoubleTap(JNIEnv* env, |
| 1063 jfloat x, jfloat y) { | 1085 const JavaParamRef<jobject>& obj, |
| 1086 jlong time_ms, | |
| 1087 jfloat x, | |
| 1088 jfloat y) { | |
| 1064 WebGestureEvent event = MakeGestureEvent( | 1089 WebGestureEvent event = MakeGestureEvent( |
| 1065 WebInputEvent::GestureDoubleTap, time_ms, x, y); | 1090 WebInputEvent::GestureDoubleTap, time_ms, x, y); |
| 1066 // Set the tap count to 1 even for DoubleTap, in order to be consistent with | 1091 // Set the tap count to 1 even for DoubleTap, in order to be consistent with |
| 1067 // double tap behavior on a mobile viewport. See crbug.com/234986 for context. | 1092 // double tap behavior on a mobile viewport. See crbug.com/234986 for context. |
| 1068 event.data.tap.tapCount = 1; | 1093 event.data.tap.tapCount = 1; |
| 1069 | 1094 |
| 1070 SendGestureEvent(event); | 1095 SendGestureEvent(event); |
| 1071 } | 1096 } |
| 1072 | 1097 |
| 1073 void ContentViewCoreImpl::LongPress(JNIEnv* env, jobject obj, jlong time_ms, | 1098 void ContentViewCoreImpl::LongPress(JNIEnv* env, |
| 1074 jfloat x, jfloat y) { | 1099 const JavaParamRef<jobject>& obj, |
| 1100 jlong time_ms, | |
| 1101 jfloat x, | |
| 1102 jfloat y) { | |
| 1075 WebGestureEvent event = MakeGestureEvent( | 1103 WebGestureEvent event = MakeGestureEvent( |
| 1076 WebInputEvent::GestureLongPress, time_ms, x, y); | 1104 WebInputEvent::GestureLongPress, time_ms, x, y); |
| 1077 | 1105 |
| 1078 SendGestureEvent(event); | 1106 SendGestureEvent(event); |
| 1079 } | 1107 } |
| 1080 | 1108 |
| 1081 void ContentViewCoreImpl::PinchBegin(JNIEnv* env, jobject obj, jlong time_ms, | 1109 void ContentViewCoreImpl::PinchBegin(JNIEnv* env, |
| 1082 jfloat x, jfloat y) { | 1110 const JavaParamRef<jobject>& obj, |
| 1111 jlong time_ms, | |
| 1112 jfloat x, | |
| 1113 jfloat y) { | |
| 1083 WebGestureEvent event = MakeGestureEvent( | 1114 WebGestureEvent event = MakeGestureEvent( |
| 1084 WebInputEvent::GesturePinchBegin, time_ms, x, y); | 1115 WebInputEvent::GesturePinchBegin, time_ms, x, y); |
| 1085 SendGestureEvent(event); | 1116 SendGestureEvent(event); |
| 1086 } | 1117 } |
| 1087 | 1118 |
| 1088 void ContentViewCoreImpl::PinchEnd(JNIEnv* env, jobject obj, jlong time_ms) { | 1119 void ContentViewCoreImpl::PinchEnd(JNIEnv* env, |
| 1120 const JavaParamRef<jobject>& obj, | |
| 1121 jlong time_ms) { | |
| 1089 WebGestureEvent event = MakeGestureEvent( | 1122 WebGestureEvent event = MakeGestureEvent( |
| 1090 WebInputEvent::GesturePinchEnd, time_ms, 0, 0); | 1123 WebInputEvent::GesturePinchEnd, time_ms, 0, 0); |
| 1091 SendGestureEvent(event); | 1124 SendGestureEvent(event); |
| 1092 } | 1125 } |
| 1093 | 1126 |
| 1094 void ContentViewCoreImpl::PinchBy(JNIEnv* env, jobject obj, jlong time_ms, | 1127 void ContentViewCoreImpl::PinchBy(JNIEnv* env, |
| 1095 jfloat anchor_x, jfloat anchor_y, | 1128 const JavaParamRef<jobject>& obj, |
| 1129 jlong time_ms, | |
| 1130 jfloat anchor_x, | |
| 1131 jfloat anchor_y, | |
| 1096 jfloat delta) { | 1132 jfloat delta) { |
| 1097 WebGestureEvent event = MakeGestureEvent( | 1133 WebGestureEvent event = MakeGestureEvent( |
| 1098 WebInputEvent::GesturePinchUpdate, time_ms, anchor_x, anchor_y); | 1134 WebInputEvent::GesturePinchUpdate, time_ms, anchor_x, anchor_y); |
| 1099 event.data.pinchUpdate.scale = delta; | 1135 event.data.pinchUpdate.scale = delta; |
| 1100 | 1136 |
| 1101 SendGestureEvent(event); | 1137 SendGestureEvent(event); |
| 1102 } | 1138 } |
| 1103 | 1139 |
| 1104 void ContentViewCoreImpl::SelectBetweenCoordinates(JNIEnv* env, jobject obj, | 1140 void ContentViewCoreImpl::SelectBetweenCoordinates( |
| 1105 jfloat x1, jfloat y1, | 1141 JNIEnv* env, |
| 1106 jfloat x2, jfloat y2) { | 1142 const JavaParamRef<jobject>& obj, |
| 1143 jfloat x1, | |
| 1144 jfloat y1, | |
| 1145 jfloat x2, | |
| 1146 jfloat y2) { | |
| 1107 SelectBetweenCoordinates(gfx::PointF(x1 / dpi_scale(), y1 / dpi_scale()), | 1147 SelectBetweenCoordinates(gfx::PointF(x1 / dpi_scale(), y1 / dpi_scale()), |
| 1108 gfx::PointF(x2 / dpi_scale(), y2 / dpi_scale())); | 1148 gfx::PointF(x2 / dpi_scale(), y2 / dpi_scale())); |
| 1109 } | 1149 } |
| 1110 | 1150 |
| 1111 void ContentViewCoreImpl::MoveCaret(JNIEnv* env, jobject obj, | 1151 void ContentViewCoreImpl::MoveCaret(JNIEnv* env, |
| 1112 jfloat x, jfloat y) { | 1152 const JavaParamRef<jobject>& obj, |
| 1153 jfloat x, | |
| 1154 jfloat y) { | |
| 1113 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1155 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1114 if (rwhv) | 1156 if (rwhv) |
| 1115 rwhv->MoveCaret(gfx::Point(x / dpi_scale_, y / dpi_scale_)); | 1157 rwhv->MoveCaret(gfx::Point(x / dpi_scale_, y / dpi_scale_)); |
| 1116 } | 1158 } |
| 1117 | 1159 |
| 1118 void ContentViewCoreImpl::DismissTextHandles(JNIEnv* env, jobject obj) { | 1160 void ContentViewCoreImpl::DismissTextHandles(JNIEnv* env, |
| 1161 const JavaParamRef<jobject>& obj) { | |
| 1119 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1162 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1120 if (rwhv) | 1163 if (rwhv) |
| 1121 rwhv->DismissTextHandles(); | 1164 rwhv->DismissTextHandles(); |
| 1122 } | 1165 } |
| 1123 | 1166 |
| 1124 void ContentViewCoreImpl::SetTextHandlesTemporarilyHidden(JNIEnv* env, | 1167 void ContentViewCoreImpl::SetTextHandlesTemporarilyHidden( |
| 1125 jobject obj, | 1168 JNIEnv* env, |
| 1126 jboolean hidden) { | 1169 const JavaParamRef<jobject>& obj, |
| 1170 jboolean hidden) { | |
| 1127 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1171 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1128 if (rwhv) | 1172 if (rwhv) |
| 1129 rwhv->SetTextHandlesTemporarilyHidden(hidden); | 1173 rwhv->SetTextHandlesTemporarilyHidden(hidden); |
| 1130 } | 1174 } |
| 1131 | 1175 |
| 1132 void ContentViewCoreImpl::ResetGestureDetection(JNIEnv* env, jobject obj) { | 1176 void ContentViewCoreImpl::ResetGestureDetection( |
| 1177 JNIEnv* env, | |
| 1178 const JavaParamRef<jobject>& obj) { | |
| 1133 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1179 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1134 if (rwhv) | 1180 if (rwhv) |
| 1135 rwhv->ResetGestureDetection(); | 1181 rwhv->ResetGestureDetection(); |
| 1136 } | 1182 } |
| 1137 | 1183 |
| 1138 void ContentViewCoreImpl::SetDoubleTapSupportEnabled(JNIEnv* env, | 1184 void ContentViewCoreImpl::SetDoubleTapSupportEnabled( |
| 1139 jobject obj, | 1185 JNIEnv* env, |
| 1140 jboolean enabled) { | 1186 const JavaParamRef<jobject>& obj, |
| 1187 jboolean enabled) { | |
| 1141 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1188 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1142 if (rwhv) | 1189 if (rwhv) |
| 1143 rwhv->SetDoubleTapSupportEnabled(enabled); | 1190 rwhv->SetDoubleTapSupportEnabled(enabled); |
| 1144 } | 1191 } |
| 1145 | 1192 |
| 1146 void ContentViewCoreImpl::SetMultiTouchZoomSupportEnabled(JNIEnv* env, | 1193 void ContentViewCoreImpl::SetMultiTouchZoomSupportEnabled( |
| 1147 jobject obj, | 1194 JNIEnv* env, |
| 1148 jboolean enabled) { | 1195 const JavaParamRef<jobject>& obj, |
| 1196 jboolean enabled) { | |
| 1149 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1197 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1150 if (rwhv) | 1198 if (rwhv) |
| 1151 rwhv->SetMultiTouchZoomSupportEnabled(enabled); | 1199 rwhv->SetMultiTouchZoomSupportEnabled(enabled); |
| 1152 } | 1200 } |
| 1153 | 1201 |
| 1154 void ContentViewCoreImpl::SetAllowJavascriptInterfacesInspection( | 1202 void ContentViewCoreImpl::SetAllowJavascriptInterfacesInspection( |
| 1155 JNIEnv* env, | 1203 JNIEnv* env, |
| 1156 jobject obj, | 1204 const JavaParamRef<jobject>& obj, |
| 1157 jboolean allow) { | 1205 jboolean allow) { |
| 1158 java_bridge_dispatcher_host_->SetAllowObjectContentsInspection(allow); | 1206 java_bridge_dispatcher_host_->SetAllowObjectContentsInspection(allow); |
| 1159 } | 1207 } |
| 1160 | 1208 |
| 1161 void ContentViewCoreImpl::AddJavascriptInterface( | 1209 void ContentViewCoreImpl::AddJavascriptInterface( |
| 1162 JNIEnv* env, | 1210 JNIEnv* env, |
| 1163 jobject /* obj */, | 1211 const JavaParamRef<jobject>& /* obj */, |
| 1164 jobject object, | 1212 const JavaParamRef<jobject>& object, |
| 1165 jstring name, | 1213 const JavaParamRef<jstring>& name, |
| 1166 jclass safe_annotation_clazz) { | 1214 const JavaParamRef<jclass>& safe_annotation_clazz) { |
| 1167 ScopedJavaLocalRef<jobject> scoped_object(env, object); | |
| 1168 ScopedJavaLocalRef<jclass> scoped_clazz(env, safe_annotation_clazz); | |
| 1169 java_bridge_dispatcher_host_->AddNamedObject( | 1215 java_bridge_dispatcher_host_->AddNamedObject( |
| 1170 ConvertJavaStringToUTF8(env, name), scoped_object, scoped_clazz); | 1216 ConvertJavaStringToUTF8(env, name), object, safe_annotation_clazz); |
|
Torne
2015/11/30 11:47:06
manual change: no need to construct ScopedJavaLoca
| |
| 1171 } | 1217 } |
| 1172 | 1218 |
| 1173 void ContentViewCoreImpl::RemoveJavascriptInterface(JNIEnv* env, | 1219 void ContentViewCoreImpl::RemoveJavascriptInterface( |
| 1174 jobject /* obj */, | 1220 JNIEnv* env, |
| 1175 jstring name) { | 1221 const JavaParamRef<jobject>& /* obj */, |
| 1222 const JavaParamRef<jstring>& name) { | |
| 1176 java_bridge_dispatcher_host_->RemoveNamedObject( | 1223 java_bridge_dispatcher_host_->RemoveNamedObject( |
| 1177 ConvertJavaStringToUTF8(env, name)); | 1224 ConvertJavaStringToUTF8(env, name)); |
| 1178 } | 1225 } |
| 1179 | 1226 |
| 1180 void ContentViewCoreImpl::WasResized(JNIEnv* env, jobject obj) { | 1227 void ContentViewCoreImpl::WasResized(JNIEnv* env, |
| 1228 const JavaParamRef<jobject>& obj) { | |
| 1181 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 1229 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 1182 gfx::Size physical_size( | 1230 gfx::Size physical_size( |
| 1183 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), | 1231 Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), |
| 1184 Java_ContentViewCore_getPhysicalBackingHeightPix(env, obj)); | 1232 Java_ContentViewCore_getPhysicalBackingHeightPix(env, obj)); |
| 1185 root_layer_->SetBounds(physical_size); | 1233 root_layer_->SetBounds(physical_size); |
| 1186 | 1234 |
| 1187 if (view) { | 1235 if (view) { |
| 1188 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From( | 1236 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From( |
| 1189 view->GetRenderWidgetHost()); | 1237 view->GetRenderWidgetHost()); |
| 1190 host->SendScreenRects(); | 1238 host->SendScreenRects(); |
| 1191 view->WasResized(); | 1239 view->WasResized(); |
| 1192 } | 1240 } |
| 1193 } | 1241 } |
| 1194 | 1242 |
| 1195 long ContentViewCoreImpl::GetNativeImeAdapter(JNIEnv* env, jobject obj) { | 1243 long ContentViewCoreImpl::GetNativeImeAdapter( |
| 1244 JNIEnv* env, | |
| 1245 const JavaParamRef<jobject>& obj) { | |
| 1196 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); | 1246 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); |
| 1197 if (!rwhva) | 1247 if (!rwhva) |
| 1198 return 0; | 1248 return 0; |
| 1199 return rwhva->GetNativeImeAdapter(); | 1249 return rwhva->GetNativeImeAdapter(); |
| 1200 } | 1250 } |
| 1201 | 1251 |
| 1202 void ContentViewCoreImpl::ForceUpdateImeAdapter(long native_ime_adapter) { | 1252 void ContentViewCoreImpl::ForceUpdateImeAdapter(long native_ime_adapter) { |
| 1203 JNIEnv* env = AttachCurrentThread(); | 1253 JNIEnv* env = AttachCurrentThread(); |
| 1204 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1254 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1205 if (obj.is_null()) | 1255 if (obj.is_null()) |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1231 text_input_flags, | 1281 text_input_flags, |
| 1232 jstring_text.obj(), | 1282 jstring_text.obj(), |
| 1233 selection_start, | 1283 selection_start, |
| 1234 selection_end, | 1284 selection_end, |
| 1235 composition_start, | 1285 composition_start, |
| 1236 composition_end, | 1286 composition_end, |
| 1237 show_ime_if_needed, | 1287 show_ime_if_needed, |
| 1238 is_non_ime_change); | 1288 is_non_ime_change); |
| 1239 } | 1289 } |
| 1240 | 1290 |
| 1241 void ContentViewCoreImpl::SetAccessibilityEnabled(JNIEnv* env, jobject obj, | 1291 void ContentViewCoreImpl::SetAccessibilityEnabled( |
| 1242 bool enabled) { | 1292 JNIEnv* env, |
| 1293 const JavaParamRef<jobject>& obj, | |
| 1294 bool enabled) { | |
| 1243 SetAccessibilityEnabledInternal(enabled); | 1295 SetAccessibilityEnabledInternal(enabled); |
| 1244 } | 1296 } |
| 1245 | 1297 |
| 1246 void ContentViewCoreImpl::SetTextTrackSettings(JNIEnv* env, | 1298 void ContentViewCoreImpl::SetTextTrackSettings( |
| 1247 jobject obj, | 1299 JNIEnv* env, |
| 1248 jboolean textTracksEnabled, | 1300 const JavaParamRef<jobject>& obj, |
| 1249 jstring textTrackBackgroundColor, | 1301 jboolean textTracksEnabled, |
| 1250 jstring textTrackFontFamily, | 1302 const JavaParamRef<jstring>& textTrackBackgroundColor, |
| 1251 jstring textTrackFontStyle, | 1303 const JavaParamRef<jstring>& textTrackFontFamily, |
| 1252 jstring textTrackFontVariant, | 1304 const JavaParamRef<jstring>& textTrackFontStyle, |
| 1253 jstring textTrackTextColor, | 1305 const JavaParamRef<jstring>& textTrackFontVariant, |
| 1254 jstring textTrackTextShadow, | 1306 const JavaParamRef<jstring>& textTrackTextColor, |
| 1255 jstring textTrackTextSize) { | 1307 const JavaParamRef<jstring>& textTrackTextShadow, |
| 1308 const JavaParamRef<jstring>& textTrackTextSize) { | |
| 1256 FrameMsg_TextTrackSettings_Params params; | 1309 FrameMsg_TextTrackSettings_Params params; |
| 1257 params.text_tracks_enabled = textTracksEnabled; | 1310 params.text_tracks_enabled = textTracksEnabled; |
| 1258 params.text_track_background_color = ConvertJavaStringToUTF8( | 1311 params.text_track_background_color = ConvertJavaStringToUTF8( |
| 1259 env, textTrackBackgroundColor); | 1312 env, textTrackBackgroundColor); |
| 1260 params.text_track_font_family = ConvertJavaStringToUTF8( | 1313 params.text_track_font_family = ConvertJavaStringToUTF8( |
| 1261 env, textTrackFontFamily); | 1314 env, textTrackFontFamily); |
| 1262 params.text_track_font_style = ConvertJavaStringToUTF8( | 1315 params.text_track_font_style = ConvertJavaStringToUTF8( |
| 1263 env, textTrackFontStyle); | 1316 env, textTrackFontStyle); |
| 1264 params.text_track_font_variant = ConvertJavaStringToUTF8( | 1317 params.text_track_font_variant = ConvertJavaStringToUTF8( |
| 1265 env, textTrackFontVariant); | 1318 env, textTrackFontVariant); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1304 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1357 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
| 1305 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1358 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1306 if (rwhv) | 1359 if (rwhv) |
| 1307 rwhv->UpdateScreenInfo(GetViewAndroid()); | 1360 rwhv->UpdateScreenInfo(GetViewAndroid()); |
| 1308 | 1361 |
| 1309 static_cast<WebContentsImpl*>(web_contents())-> | 1362 static_cast<WebContentsImpl*>(web_contents())-> |
| 1310 screen_orientation_dispatcher_host()->OnOrientationChange(); | 1363 screen_orientation_dispatcher_host()->OnOrientationChange(); |
| 1311 } | 1364 } |
| 1312 | 1365 |
| 1313 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, | 1366 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, |
| 1314 jobject obj, | 1367 const JavaParamRef<jobject>& obj, |
| 1315 jint x, | 1368 jint x, |
| 1316 jint y, | 1369 jint y, |
| 1317 jint width, | 1370 jint width, |
| 1318 jint height) { | 1371 jint height) { |
| 1319 gfx::Rect rect( | 1372 gfx::Rect rect( |
| 1320 static_cast<int>(x / dpi_scale()), | 1373 static_cast<int>(x / dpi_scale()), |
| 1321 static_cast<int>(y / dpi_scale()), | 1374 static_cast<int>(y / dpi_scale()), |
| 1322 static_cast<int>((width > 0 && width < dpi_scale()) ? | 1375 static_cast<int>((width > 0 && width < dpi_scale()) ? |
| 1323 1 : (int)(width / dpi_scale())), | 1376 1 : (int)(width / dpi_scale())), |
| 1324 static_cast<int>((height > 0 && height < dpi_scale()) ? | 1377 static_cast<int>((height > 0 && height < dpi_scale()) ? |
| 1325 1 : (int)(height / dpi_scale()))); | 1378 1 : (int)(height / dpi_scale()))); |
| 1326 GetWebContents()->Send(new ViewMsg_ExtractSmartClipData( | 1379 GetWebContents()->Send(new ViewMsg_ExtractSmartClipData( |
| 1327 GetWebContents()->GetRoutingID(), rect)); | 1380 GetWebContents()->GetRoutingID(), rect)); |
| 1328 } | 1381 } |
| 1329 | 1382 |
| 1330 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { | 1383 jint ContentViewCoreImpl::GetCurrentRenderProcessId( |
| 1384 JNIEnv* env, | |
| 1385 const JavaParamRef<jobject>& obj) { | |
| 1331 return GetRenderProcessIdFromRenderViewHost( | 1386 return GetRenderProcessIdFromRenderViewHost( |
| 1332 web_contents_->GetRenderViewHost()); | 1387 web_contents_->GetRenderViewHost()); |
| 1333 } | 1388 } |
| 1334 | 1389 |
| 1335 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj, | 1390 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, |
| 1336 jboolean opaque) { | 1391 const JavaParamRef<jobject>& jobj, |
| 1392 jboolean opaque) { | |
| 1337 if (GetRenderWidgetHostViewAndroid()) { | 1393 if (GetRenderWidgetHostViewAndroid()) { |
| 1338 if (opaque) | 1394 if (opaque) |
| 1339 GetRenderWidgetHostViewAndroid()->SetBackgroundColorToDefault(); | 1395 GetRenderWidgetHostViewAndroid()->SetBackgroundColorToDefault(); |
| 1340 else | 1396 else |
| 1341 GetRenderWidgetHostViewAndroid()->SetBackgroundColor(SK_ColorTRANSPARENT); | 1397 GetRenderWidgetHostViewAndroid()->SetBackgroundColor(SK_ColorTRANSPARENT); |
| 1342 } | 1398 } |
| 1343 } | 1399 } |
| 1344 | 1400 |
| 1345 void ContentViewCoreImpl::RequestTextSurroundingSelection( | 1401 void ContentViewCoreImpl::RequestTextSurroundingSelection( |
| 1346 int max_length, | 1402 int max_length, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1454 return ScopedJavaLocalRef<jobject>(); | 1510 return ScopedJavaLocalRef<jobject>(); |
| 1455 | 1511 |
| 1456 return view->GetJavaObject(); | 1512 return view->GetJavaObject(); |
| 1457 } | 1513 } |
| 1458 | 1514 |
| 1459 bool RegisterContentViewCore(JNIEnv* env) { | 1515 bool RegisterContentViewCore(JNIEnv* env) { |
| 1460 return RegisterNativesImpl(env); | 1516 return RegisterNativesImpl(env); |
| 1461 } | 1517 } |
| 1462 | 1518 |
| 1463 } // namespace content | 1519 } // namespace content |
| OLD | NEW |