| 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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 void AwContents::FocusFirstNode(JNIEnv* env, jobject obj) { | 917 void AwContents::FocusFirstNode(JNIEnv* env, jobject obj) { |
| 918 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 918 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 919 web_contents_->FocusThroughTabTraversal(false); | 919 web_contents_->FocusThroughTabTraversal(false); |
| 920 } | 920 } |
| 921 | 921 |
| 922 void AwContents::SetBackgroundColor(JNIEnv* env, jobject obj, jint color) { | 922 void AwContents::SetBackgroundColor(JNIEnv* env, jobject obj, jint color) { |
| 923 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 923 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 924 render_view_host_ext_->SetBackgroundColor(color); | 924 render_view_host_ext_->SetBackgroundColor(color); |
| 925 } | 925 } |
| 926 | 926 |
| 927 void AwContents::OnComputeScroll(JNIEnv* env, |
| 928 jobject obj, |
| 929 jlong animation_time_millis) { |
| 930 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 931 browser_view_renderer_.OnComputeScroll( |
| 932 base::TimeTicks() + |
| 933 base::TimeDelta::FromMilliseconds(animation_time_millis)); |
| 934 } |
| 935 |
| 927 jlong AwContents::ReleasePopupAwContents(JNIEnv* env, jobject obj) { | 936 jlong AwContents::ReleasePopupAwContents(JNIEnv* env, jobject obj) { |
| 928 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 937 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 929 return reinterpret_cast<intptr_t>(pending_contents_.release()); | 938 return reinterpret_cast<intptr_t>(pending_contents_.release()); |
| 930 } | 939 } |
| 931 | 940 |
| 932 gfx::Point AwContents::GetLocationOnScreen() { | 941 gfx::Point AwContents::GetLocationOnScreen() { |
| 933 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 942 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 934 JNIEnv* env = AttachCurrentThread(); | 943 JNIEnv* env = AttachCurrentThread(); |
| 935 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 944 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 936 if (obj.is_null()) | 945 if (obj.is_null()) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 obj.obj(), | 985 obj.obj(), |
| 977 max_scroll_offset.x(), | 986 max_scroll_offset.x(), |
| 978 max_scroll_offset.y(), | 987 max_scroll_offset.y(), |
| 979 contents_size_dip.width(), | 988 contents_size_dip.width(), |
| 980 contents_size_dip.height(), | 989 contents_size_dip.height(), |
| 981 page_scale_factor, | 990 page_scale_factor, |
| 982 min_page_scale_factor, | 991 min_page_scale_factor, |
| 983 max_page_scale_factor); | 992 max_page_scale_factor); |
| 984 } | 993 } |
| 985 | 994 |
| 986 void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta) { | 995 void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta, |
| 996 gfx::Vector2dF overscroll_velocity, |
| 997 bool first_overscroll_x, |
| 998 bool first_overscroll_y) { |
| 987 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 999 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 988 JNIEnv* env = AttachCurrentThread(); | 1000 JNIEnv* env = AttachCurrentThread(); |
| 989 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1001 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 990 if (obj.is_null()) | 1002 if (obj.is_null()) |
| 991 return; | 1003 return; |
| 992 Java_AwContents_didOverscroll( | 1004 Java_AwContents_didOverscroll(env, obj.obj(), overscroll_delta.x(), |
| 993 env, obj.obj(), overscroll_delta.x(), overscroll_delta.y()); | 1005 overscroll_delta.y(), overscroll_velocity.x(), |
| 1006 overscroll_velocity.y(), first_overscroll_x, |
| 1007 first_overscroll_y); |
| 994 } | 1008 } |
| 995 | 1009 |
| 996 void AwContents::SetDipScale(JNIEnv* env, jobject obj, jfloat dip_scale) { | 1010 void AwContents::SetDipScale(JNIEnv* env, jobject obj, jfloat dip_scale) { |
| 997 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1011 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 998 SetDipScaleInternal(dip_scale); | 1012 SetDipScaleInternal(dip_scale); |
| 999 } | 1013 } |
| 1000 | 1014 |
| 1001 void AwContents::SetDipScaleInternal(float dip_scale) { | 1015 void AwContents::SetDipScaleInternal(float dip_scale) { |
| 1002 browser_view_renderer_.SetDipScale(dip_scale); | 1016 browser_view_renderer_.SetDipScale(dip_scale); |
| 1003 } | 1017 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 | 1163 |
| 1150 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, | 1164 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, |
| 1151 GetMessagePortMessageFilter()); | 1165 GetMessagePortMessageFilter()); |
| 1152 } | 1166 } |
| 1153 | 1167 |
| 1154 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1168 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
| 1155 g_should_download_favicons = true; | 1169 g_should_download_favicons = true; |
| 1156 } | 1170 } |
| 1157 | 1171 |
| 1158 } // namespace android_webview | 1172 } // namespace android_webview |
| OLD | NEW |