| 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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 if (obj.is_null()) | 997 if (obj.is_null()) |
| 998 return gfx::Point(); | 998 return gfx::Point(); |
| 999 std::vector<int> location; | 999 std::vector<int> location; |
| 1000 base::android::JavaIntArrayToIntVector( | 1000 base::android::JavaIntArrayToIntVector( |
| 1001 env, | 1001 env, |
| 1002 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), | 1002 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), |
| 1003 &location); | 1003 &location); |
| 1004 return gfx::Point(location[0], location[1]); | 1004 return gfx::Point(location[0], location[1]); |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 void AwContents::ScrollContainerViewTo(gfx::Vector2d new_value) { | 1007 void AwContents::ScrollContainerViewTo(const gfx::Vector2d& new_value) { |
| 1008 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1008 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1009 JNIEnv* env = AttachCurrentThread(); | 1009 JNIEnv* env = AttachCurrentThread(); |
| 1010 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1010 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1011 if (obj.is_null()) | 1011 if (obj.is_null()) |
| 1012 return; | 1012 return; |
| 1013 Java_AwContents_scrollContainerViewTo( | 1013 Java_AwContents_scrollContainerViewTo( |
| 1014 env, obj.obj(), new_value.x(), new_value.y()); | 1014 env, obj.obj(), new_value.x(), new_value.y()); |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 void AwContents::UpdateScrollState(gfx::Vector2d max_scroll_offset, | 1017 void AwContents::UpdateScrollState(const gfx::Vector2d& max_scroll_offset, |
| 1018 gfx::SizeF contents_size_dip, | 1018 const gfx::SizeF& contents_size_dip, |
| 1019 float page_scale_factor, | 1019 float page_scale_factor, |
| 1020 float min_page_scale_factor, | 1020 float min_page_scale_factor, |
| 1021 float max_page_scale_factor) { | 1021 float max_page_scale_factor) { |
| 1022 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1022 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1023 JNIEnv* env = AttachCurrentThread(); | 1023 JNIEnv* env = AttachCurrentThread(); |
| 1024 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1024 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1025 if (obj.is_null()) | 1025 if (obj.is_null()) |
| 1026 return; | 1026 return; |
| 1027 Java_AwContents_updateScrollState(env, | 1027 Java_AwContents_updateScrollState(env, |
| 1028 obj.obj(), | 1028 obj.obj(), |
| 1029 max_scroll_offset.x(), | 1029 max_scroll_offset.x(), |
| 1030 max_scroll_offset.y(), | 1030 max_scroll_offset.y(), |
| 1031 contents_size_dip.width(), | 1031 contents_size_dip.width(), |
| 1032 contents_size_dip.height(), | 1032 contents_size_dip.height(), |
| 1033 page_scale_factor, | 1033 page_scale_factor, |
| 1034 min_page_scale_factor, | 1034 min_page_scale_factor, |
| 1035 max_page_scale_factor); | 1035 max_page_scale_factor); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta, | 1038 void AwContents::DidOverscroll(const gfx::Vector2d& overscroll_delta, |
| 1039 gfx::Vector2dF overscroll_velocity) { | 1039 const gfx::Vector2dF& overscroll_velocity) { |
| 1040 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1040 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1041 JNIEnv* env = AttachCurrentThread(); | 1041 JNIEnv* env = AttachCurrentThread(); |
| 1042 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1042 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1043 if (obj.is_null()) | 1043 if (obj.is_null()) |
| 1044 return; | 1044 return; |
| 1045 Java_AwContents_didOverscroll(env, obj.obj(), overscroll_delta.x(), | 1045 Java_AwContents_didOverscroll(env, obj.obj(), overscroll_delta.x(), |
| 1046 overscroll_delta.y(), overscroll_velocity.x(), | 1046 overscroll_delta.y(), overscroll_velocity.x(), |
| 1047 overscroll_velocity.y()); | 1047 overscroll_velocity.y()); |
| 1048 } | 1048 } |
| 1049 | 1049 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 1222 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 1223 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); | 1223 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 void SetShouldDownloadFavicons(JNIEnv* env, | 1226 void SetShouldDownloadFavicons(JNIEnv* env, |
| 1227 const JavaParamRef<jclass>& jclazz) { | 1227 const JavaParamRef<jclass>& jclazz) { |
| 1228 g_should_download_favicons = true; | 1228 g_should_download_favicons = true; |
| 1229 } | 1229 } |
| 1230 | 1230 |
| 1231 } // namespace android_webview | 1231 } // namespace android_webview |
| OLD | NEW |