| 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 } | 763 } |
| 764 | 764 |
| 765 void ContentViewCoreImpl::LoadUrl( | 765 void ContentViewCoreImpl::LoadUrl( |
| 766 JNIEnv* env, jobject obj, | 766 JNIEnv* env, jobject obj, |
| 767 jstring url, | 767 jstring url, |
| 768 jint load_url_type, | 768 jint load_url_type, |
| 769 jint transition_type, | 769 jint transition_type, |
| 770 jint ua_override_option, | 770 jint ua_override_option, |
| 771 jstring extra_headers, | 771 jstring extra_headers, |
| 772 jbyteArray post_data, | 772 jbyteArray post_data, |
| 773 jstring data_for_data_url, |
| 773 jstring base_url_for_data_url, | 774 jstring base_url_for_data_url, |
| 774 jstring virtual_url_for_data_url, | 775 jstring virtual_url_for_data_url, |
| 775 jboolean can_load_local_resources) { | 776 jboolean can_load_local_resources) { |
| 776 DCHECK(url); | 777 DCHECK(url); |
| 777 NavigationController::LoadURLParams params( | 778 NavigationController::LoadURLParams params( |
| 778 GURL(ConvertJavaStringToUTF8(env, url))); | 779 GURL(ConvertJavaStringToUTF8(env, url))); |
| 779 | 780 |
| 780 params.load_type = static_cast<NavigationController::LoadURLType>( | 781 params.load_type = static_cast<NavigationController::LoadURLType>( |
| 781 load_url_type); | 782 load_url_type); |
| 782 params.transition_type = PageTransitionFromInt(transition_type); | 783 params.transition_type = PageTransitionFromInt(transition_type); |
| 783 params.override_user_agent = | 784 params.override_user_agent = |
| 784 static_cast<NavigationController::UserAgentOverrideOption>( | 785 static_cast<NavigationController::UserAgentOverrideOption>( |
| 785 ua_override_option); | 786 ua_override_option); |
| 786 | 787 |
| 787 if (extra_headers) | 788 if (extra_headers) |
| 788 params.extra_headers = ConvertJavaStringToUTF8(env, extra_headers); | 789 params.extra_headers = ConvertJavaStringToUTF8(env, extra_headers); |
| 789 | 790 |
| 790 if (post_data) { | 791 if (post_data) { |
| 791 std::vector<uint8> http_body_vector; | 792 std::vector<uint8> http_body_vector; |
| 792 base::android::JavaByteArrayToByteVector(env, post_data, &http_body_vector); | 793 base::android::JavaByteArrayToByteVector(env, post_data, &http_body_vector); |
| 793 params.browser_initiated_post_data = | 794 params.browser_initiated_post_data = |
| 794 base::RefCountedBytes::TakeVector(&http_body_vector); | 795 base::RefCountedBytes::TakeVector(&http_body_vector); |
| 795 } | 796 } |
| 796 | 797 |
| 798 if (data_for_data_url) { |
| 799 DCHECK_EQ(NavigationController::LOAD_TYPE_DATA, params.load_type); |
| 800 std::string data; |
| 801 ConvertJavaStringToUTF8(env, data_for_data_url, &data); |
| 802 params.data_for_data_url = base::RefCountedString::TakeString(&data); |
| 803 } |
| 804 |
| 797 if (base_url_for_data_url) { | 805 if (base_url_for_data_url) { |
| 798 params.base_url_for_data_url = | 806 params.base_url_for_data_url = |
| 799 GURL(ConvertJavaStringToUTF8(env, base_url_for_data_url)); | 807 GURL(ConvertJavaStringToUTF8(env, base_url_for_data_url)); |
| 800 } | 808 } |
| 801 | 809 |
| 802 if (virtual_url_for_data_url) { | 810 if (virtual_url_for_data_url) { |
| 803 params.virtual_url_for_data_url = | 811 params.virtual_url_for_data_url = |
| 804 GURL(ConvertJavaStringToUTF8(env, virtual_url_for_data_url)); | 812 GURL(ConvertJavaStringToUTF8(env, virtual_url_for_data_url)); |
| 805 } | 813 } |
| 806 | 814 |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1644 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1637 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1645 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1638 return reinterpret_cast<intptr_t>(view); | 1646 return reinterpret_cast<intptr_t>(view); |
| 1639 } | 1647 } |
| 1640 | 1648 |
| 1641 bool RegisterContentViewCore(JNIEnv* env) { | 1649 bool RegisterContentViewCore(JNIEnv* env) { |
| 1642 return RegisterNativesImpl(env); | 1650 return RegisterNativesImpl(env); |
| 1643 } | 1651 } |
| 1644 | 1652 |
| 1645 } // namespace content | 1653 } // namespace content |
| OLD | NEW |