| 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 if (obj.is_null()) | 864 if (obj.is_null()) |
| 865 return gfx::Point(); | 865 return gfx::Point(); |
| 866 std::vector<int> location; | 866 std::vector<int> location; |
| 867 base::android::JavaIntArrayToIntVector( | 867 base::android::JavaIntArrayToIntVector( |
| 868 env, | 868 env, |
| 869 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), | 869 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), |
| 870 &location); | 870 &location); |
| 871 return gfx::Point(location[0], location[1]); | 871 return gfx::Point(location[0], location[1]); |
| 872 } | 872 } |
| 873 | 873 |
| 874 void AwContents::SetMaxContainerViewScrollOffset(gfx::Vector2d new_value) { | |
| 875 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 876 JNIEnv* env = AttachCurrentThread(); | |
| 877 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 878 if (obj.is_null()) | |
| 879 return; | |
| 880 Java_AwContents_setMaxContainerViewScrollOffset( | |
| 881 env, obj.obj(), new_value.x(), new_value.y()); | |
| 882 } | |
| 883 | |
| 884 void AwContents::ScrollContainerViewTo(gfx::Vector2d new_value) { | 874 void AwContents::ScrollContainerViewTo(gfx::Vector2d new_value) { |
| 885 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 875 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 886 JNIEnv* env = AttachCurrentThread(); | 876 JNIEnv* env = AttachCurrentThread(); |
| 887 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 877 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 888 if (obj.is_null()) | 878 if (obj.is_null()) |
| 889 return; | 879 return; |
| 890 Java_AwContents_scrollContainerViewTo( | 880 Java_AwContents_scrollContainerViewTo( |
| 891 env, obj.obj(), new_value.x(), new_value.y()); | 881 env, obj.obj(), new_value.x(), new_value.y()); |
| 892 } | 882 } |
| 893 | 883 |
| 894 bool AwContents::IsFlingActive() const { | 884 bool AwContents::IsFlingActive() const { |
| 895 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 885 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 896 JNIEnv* env = AttachCurrentThread(); | 886 JNIEnv* env = AttachCurrentThread(); |
| 897 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 887 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 898 if (obj.is_null()) | 888 if (obj.is_null()) |
| 899 return false; | 889 return false; |
| 900 return Java_AwContents_isFlingActive(env, obj.obj()); | 890 return Java_AwContents_isFlingActive(env, obj.obj()); |
| 901 } | 891 } |
| 902 | 892 |
| 903 void AwContents::SetPageScaleFactorAndLimits( | 893 void AwContents::UpdateScrollState(gfx::Vector2d max_scroll_offset, |
| 904 float page_scale_factor, | 894 gfx::SizeF contents_size_dip, |
| 905 float min_page_scale_factor, | 895 float page_scale_factor, |
| 906 float max_page_scale_factor) { | 896 float min_page_scale_factor, |
| 897 float max_page_scale_factor) { |
| 907 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 898 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 908 JNIEnv* env = AttachCurrentThread(); | 899 JNIEnv* env = AttachCurrentThread(); |
| 909 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 900 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 910 if (obj.is_null()) | 901 if (obj.is_null()) |
| 911 return; | 902 return; |
| 912 Java_AwContents_setPageScaleFactorAndLimits(env, | 903 Java_AwContents_updateScrollState(env, |
| 913 obj.obj(), | 904 obj.obj(), |
| 914 page_scale_factor, | 905 max_scroll_offset.x(), |
| 915 min_page_scale_factor, | 906 max_scroll_offset.y(), |
| 916 max_page_scale_factor); | 907 contents_size_dip.width(), |
| 917 } | 908 contents_size_dip.height(), |
| 918 | 909 page_scale_factor, |
| 919 void AwContents::SetContentsSize(gfx::SizeF contents_size_dip) { | 910 min_page_scale_factor, |
| 920 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 911 max_page_scale_factor); |
| 921 JNIEnv* env = AttachCurrentThread(); | |
| 922 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 923 if (obj.is_null()) | |
| 924 return; | |
| 925 Java_AwContents_setContentsSize( | |
| 926 env, obj.obj(), contents_size_dip.width(), contents_size_dip.height()); | |
| 927 } | 912 } |
| 928 | 913 |
| 929 void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta) { | 914 void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta) { |
| 930 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 915 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 931 JNIEnv* env = AttachCurrentThread(); | 916 JNIEnv* env = AttachCurrentThread(); |
| 932 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 917 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 933 if (obj.is_null()) | 918 if (obj.is_null()) |
| 934 return; | 919 return; |
| 935 Java_AwContents_didOverscroll( | 920 Java_AwContents_didOverscroll( |
| 936 env, obj.obj(), overscroll_delta.x(), overscroll_delta.y()); | 921 env, obj.obj(), overscroll_delta.x(), overscroll_delta.y()); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 | 1037 |
| 1053 void AwContents::ForceFakeComposite() { | 1038 void AwContents::ForceFakeComposite() { |
| 1054 browser_view_renderer_.ForceFakeCompositeSW(); | 1039 browser_view_renderer_.ForceFakeCompositeSW(); |
| 1055 } | 1040 } |
| 1056 | 1041 |
| 1057 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1042 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
| 1058 g_should_download_favicons = true; | 1043 g_should_download_favicons = true; |
| 1059 } | 1044 } |
| 1060 | 1045 |
| 1061 } // namespace android_webview | 1046 } // namespace android_webview |
| OLD | NEW |