| 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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
| 10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 if (obj.is_null()) | 793 if (obj.is_null()) |
| 794 return gfx::Point(); | 794 return gfx::Point(); |
| 795 std::vector<int> location; | 795 std::vector<int> location; |
| 796 base::android::JavaIntArrayToIntVector( | 796 base::android::JavaIntArrayToIntVector( |
| 797 env, | 797 env, |
| 798 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), | 798 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), |
| 799 &location); | 799 &location); |
| 800 return gfx::Point(location[0], location[1]); | 800 return gfx::Point(location[0], location[1]); |
| 801 } | 801 } |
| 802 | 802 |
| 803 void AwContents::SetMaxContainerViewScrollOffset(gfx::Vector2d new_value) { |
| 804 JNIEnv* env = AttachCurrentThread(); |
| 805 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 806 if (obj.is_null()) |
| 807 return; |
| 808 Java_AwContents_setMaxContainerViewScrollOffset( |
| 809 env, obj.obj(), new_value.x(), new_value.y()); |
| 810 } |
| 811 |
| 803 void AwContents::ScrollContainerViewTo(gfx::Vector2d new_value) { | 812 void AwContents::ScrollContainerViewTo(gfx::Vector2d new_value) { |
| 804 JNIEnv* env = AttachCurrentThread(); | 813 JNIEnv* env = AttachCurrentThread(); |
| 805 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 814 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 806 if (obj.is_null()) | 815 if (obj.is_null()) |
| 807 return; | 816 return; |
| 808 Java_AwContents_scrollContainerViewTo( | 817 Java_AwContents_scrollContainerViewTo( |
| 809 env, obj.obj(), new_value.x(), new_value.y()); | 818 env, obj.obj(), new_value.x(), new_value.y()); |
| 810 } | 819 } |
| 811 | 820 |
| 821 void AwContents::SetPageScaleFactor(float page_scale_factor) { |
| 822 JNIEnv* env = AttachCurrentThread(); |
| 823 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 824 if (obj.is_null()) |
| 825 return; |
| 826 Java_AwContents_setPageScaleFactor(env, obj.obj(), page_scale_factor); |
| 827 } |
| 828 |
| 829 void AwContents::SetContentsSize(gfx::SizeF contents_size_dip) { |
| 830 JNIEnv* env = AttachCurrentThread(); |
| 831 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 832 if (obj.is_null()) |
| 833 return; |
| 834 Java_AwContents_setContentsSize( |
| 835 env, obj.obj(), contents_size_dip.width(), contents_size_dip.height()); |
| 836 } |
| 812 | 837 |
| 813 void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta) { | 838 void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta) { |
| 814 JNIEnv* env = AttachCurrentThread(); | 839 JNIEnv* env = AttachCurrentThread(); |
| 815 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 840 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 816 if (obj.is_null()) | 841 if (obj.is_null()) |
| 817 return; | 842 return; |
| 818 Java_AwContents_didOverscroll( | 843 Java_AwContents_didOverscroll( |
| 819 env, obj.obj(), overscroll_delta.x(), overscroll_delta.y()); | 844 env, obj.obj(), overscroll_delta.x(), overscroll_delta.y()); |
| 820 } | 845 } |
| 821 | 846 |
| 822 void AwContents::SetDipScale(JNIEnv* env, jobject obj, jfloat dip_scale) { | 847 void AwContents::SetDipScale(JNIEnv* env, jobject obj, jfloat dip_scale) { |
| 823 browser_view_renderer_->SetDipScale(dip_scale); | 848 browser_view_renderer_->SetDipScale(dip_scale); |
| 824 } | 849 } |
| 825 | 850 |
| 826 void AwContents::SetDisplayedPageScaleFactor(JNIEnv* env, | |
| 827 jobject obj, | |
| 828 jfloat page_scale_factor) { | |
| 829 browser_view_renderer_->SetPageScaleFactor(page_scale_factor); | |
| 830 } | |
| 831 | |
| 832 void AwContents::SetFixedLayoutSize(JNIEnv* env, | 851 void AwContents::SetFixedLayoutSize(JNIEnv* env, |
| 833 jobject obj, | 852 jobject obj, |
| 834 jint width_dip, | 853 jint width_dip, |
| 835 jint height_dip) { | 854 jint height_dip) { |
| 836 render_view_host_ext_->SetFixedLayoutSize(gfx::Size(width_dip, height_dip)); | 855 render_view_host_ext_->SetFixedLayoutSize(gfx::Size(width_dip, height_dip)); |
| 837 } | 856 } |
| 838 | 857 |
| 839 void AwContents::ScrollTo(JNIEnv* env, jobject obj, jint xPix, jint yPix) { | 858 void AwContents::ScrollTo(JNIEnv* env, jobject obj, jint x, jint y) { |
| 840 browser_view_renderer_->ScrollTo(gfx::Vector2d(xPix, yPix)); | 859 browser_view_renderer_->ScrollTo(gfx::Vector2d(x, y)); |
| 841 } | 860 } |
| 842 | 861 |
| 843 void AwContents::OnWebLayoutPageScaleFactorChanged(float page_scale_factor) { | 862 void AwContents::OnWebLayoutPageScaleFactorChanged(float page_scale_factor) { |
| 844 JNIEnv* env = AttachCurrentThread(); | 863 JNIEnv* env = AttachCurrentThread(); |
| 845 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 864 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 846 if (obj.is_null()) | 865 if (obj.is_null()) |
| 847 return; | 866 return; |
| 848 Java_AwContents_onWebLayoutPageScaleFactorChanged(env, obj.obj(), | 867 Java_AwContents_onWebLayoutPageScaleFactorChanged(env, obj.obj(), |
| 849 page_scale_factor); | 868 page_scale_factor); |
| 850 } | 869 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 873 browser_view_renderer_->EnableOnNewPicture(enabled); | 892 browser_view_renderer_->EnableOnNewPicture(enabled); |
| 874 } | 893 } |
| 875 | 894 |
| 876 void AwContents::SetJsOnlineProperty(JNIEnv* env, | 895 void AwContents::SetJsOnlineProperty(JNIEnv* env, |
| 877 jobject obj, | 896 jobject obj, |
| 878 jboolean network_up) { | 897 jboolean network_up) { |
| 879 render_view_host_ext_->SetJsOnlineProperty(network_up); | 898 render_view_host_ext_->SetJsOnlineProperty(network_up); |
| 880 } | 899 } |
| 881 | 900 |
| 882 } // namespace android_webview | 901 } // namespace android_webview |
| OLD | NEW |