| 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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 jint load_url_type, | 842 jint load_url_type, |
| 843 jint transition_type, | 843 jint transition_type, |
| 844 jstring j_referrer_url, | 844 jstring j_referrer_url, |
| 845 jint referrer_policy, | 845 jint referrer_policy, |
| 846 jint ua_override_option, | 846 jint ua_override_option, |
| 847 jstring extra_headers, | 847 jstring extra_headers, |
| 848 jbyteArray post_data, | 848 jbyteArray post_data, |
| 849 jstring base_url_for_data_url, | 849 jstring base_url_for_data_url, |
| 850 jstring virtual_url_for_data_url, | 850 jstring virtual_url_for_data_url, |
| 851 jboolean can_load_local_resources, | 851 jboolean can_load_local_resources, |
| 852 jboolean is_renderer_initiated) { | 852 jboolean is_renderer_initiated, |
| 853 jstring virtual_url_for_transition) { |
| 853 DCHECK(url); | 854 DCHECK(url); |
| 854 NavigationController::LoadURLParams params( | 855 NavigationController::LoadURLParams params( |
| 855 GURL(ConvertJavaStringToUTF8(env, url))); | 856 GURL(ConvertJavaStringToUTF8(env, url))); |
| 856 | 857 |
| 857 params.load_type = static_cast<NavigationController::LoadURLType>( | 858 params.load_type = static_cast<NavigationController::LoadURLType>( |
| 858 load_url_type); | 859 load_url_type); |
| 859 params.transition_type = PageTransitionFromInt(transition_type); | 860 params.transition_type = PageTransitionFromInt(transition_type); |
| 860 params.override_user_agent = | 861 params.override_user_agent = |
| 861 static_cast<NavigationController::UserAgentOverrideOption>( | 862 static_cast<NavigationController::UserAgentOverrideOption>( |
| 862 ua_override_option); | 863 ua_override_option); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 881 GURL(ConvertJavaStringToUTF8(env, virtual_url_for_data_url)); | 882 GURL(ConvertJavaStringToUTF8(env, virtual_url_for_data_url)); |
| 882 } | 883 } |
| 883 | 884 |
| 884 params.can_load_local_resources = can_load_local_resources; | 885 params.can_load_local_resources = can_load_local_resources; |
| 885 if (j_referrer_url) { | 886 if (j_referrer_url) { |
| 886 params.referrer = content::Referrer( | 887 params.referrer = content::Referrer( |
| 887 GURL(ConvertJavaStringToUTF8(env, j_referrer_url)), | 888 GURL(ConvertJavaStringToUTF8(env, j_referrer_url)), |
| 888 static_cast<blink::WebReferrerPolicy>(referrer_policy)); | 889 static_cast<blink::WebReferrerPolicy>(referrer_policy)); |
| 889 } | 890 } |
| 890 | 891 |
| 892 if (virtual_url_for_transition) { |
| 893 params.virtual_url_for_transition = |
| 894 GURL(ConvertJavaStringToUTF8(env, virtual_url_for_transition)); |
| 895 } |
| 896 |
| 891 params.is_renderer_initiated = is_renderer_initiated; | 897 params.is_renderer_initiated = is_renderer_initiated; |
| 892 | 898 |
| 893 LoadUrl(params); | 899 LoadUrl(params); |
| 894 } | 900 } |
| 895 | 901 |
| 896 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( | 902 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( |
| 897 JNIEnv* env, jobject) const { | 903 JNIEnv* env, jobject) const { |
| 898 return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec()); | 904 return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec()); |
| 899 } | 905 } |
| 900 | 906 |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 if (!focused_frame) | 1646 if (!focused_frame) |
| 1641 return; | 1647 return; |
| 1642 if (GetRenderWidgetHostViewAndroid()) { | 1648 if (GetRenderWidgetHostViewAndroid()) { |
| 1643 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback( | 1649 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback( |
| 1644 callback); | 1650 callback); |
| 1645 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( | 1651 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( |
| 1646 focused_frame->GetRoutingID(), max_length)); | 1652 focused_frame->GetRoutingID(), max_length)); |
| 1647 } | 1653 } |
| 1648 } | 1654 } |
| 1649 | 1655 |
| 1650 void ContentViewCoreImpl::DidDeferAfterResponseStarted() { | 1656 void ContentViewCoreImpl::DidDeferAfterResponseStarted( |
| 1657 const GURL& transition_url) { |
| 1651 JNIEnv* env = AttachCurrentThread(); | 1658 JNIEnv* env = AttachCurrentThread(); |
| 1652 ScopedJavaLocalRef<jobject> obj(java_ref_.get(env)); | 1659 ScopedJavaLocalRef<jobject> obj(java_ref_.get(env)); |
| 1653 if (obj.is_null()) | 1660 if (obj.is_null()) |
| 1654 return; | 1661 return; |
| 1655 Java_ContentViewCore_didDeferAfterResponseStarted(env, obj.obj()); | 1662 |
| 1663 ScopedJavaLocalRef<jstring> jstring_token( |
| 1664 ConvertUTF8ToJavaString(env, transition_url.spec())); |
| 1665 |
| 1666 Java_ContentViewCore_didDeferAfterResponseStarted(env, |
| 1667 obj.obj(), |
| 1668 jstring_token.obj()); |
| 1656 } | 1669 } |
| 1657 | 1670 |
| 1658 bool ContentViewCoreImpl::WillHandleDeferAfterResponseStarted() { | 1671 bool ContentViewCoreImpl::WillHandleDeferAfterResponseStarted() { |
| 1659 JNIEnv* env = AttachCurrentThread(); | 1672 JNIEnv* env = AttachCurrentThread(); |
| 1660 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1673 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1661 if (obj.is_null()) | 1674 if (obj.is_null()) |
| 1662 return false; | 1675 return false; |
| 1663 | 1676 |
| 1664 return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env, | 1677 return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env, |
| 1665 obj.obj()); | 1678 obj.obj()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1712 reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 1700 retained_objects_set); | 1713 retained_objects_set); |
| 1701 return reinterpret_cast<intptr_t>(view); | 1714 return reinterpret_cast<intptr_t>(view); |
| 1702 } | 1715 } |
| 1703 | 1716 |
| 1704 bool RegisterContentViewCore(JNIEnv* env) { | 1717 bool RegisterContentViewCore(JNIEnv* env) { |
| 1705 return RegisterNativesImpl(env); | 1718 return RegisterNativesImpl(env); |
| 1706 } | 1719 } |
| 1707 | 1720 |
| 1708 } // namespace content | 1721 } // namespace content |
| OLD | NEW |