OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 params.can_load_local_resources = can_load_local_resources; | 787 params.can_load_local_resources = can_load_local_resources; |
788 | 788 |
789 LoadUrl(params); | 789 LoadUrl(params); |
790 } | 790 } |
791 | 791 |
792 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { | 792 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { |
793 return GetRenderProcessIdFromRenderViewHost( | 793 return GetRenderProcessIdFromRenderViewHost( |
794 web_contents_->GetRenderViewHost()); | 794 web_contents_->GetRenderViewHost()); |
795 } | 795 } |
796 | 796 |
797 void ContentViewCoreImpl::SetAllUserAgentOverridesInHistory( | |
798 JNIEnv* env, | |
799 jobject, | |
800 jstring user_agent_override) { | |
801 bool override_used = user_agent_override != NULL; | |
802 if (override_used) { | |
803 std::string override = | |
804 base::android::ConvertJavaStringToUTF8(env, user_agent_override); | |
805 web_contents_->SetUserAgentOverride(override); | |
806 } | |
807 | |
808 const NavigationController& controller = web_contents_->GetController(); | |
809 for (int i = 0; i < controller.GetEntryCount(); ++i) | |
810 controller.GetEntryAtIndex(i)->SetIsOverridingUserAgent(override_used); | |
811 } | |
812 | |
813 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( | 797 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( |
814 JNIEnv* env, jobject) const { | 798 JNIEnv* env, jobject) const { |
815 return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec()); | 799 return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec()); |
816 } | 800 } |
817 | 801 |
818 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle( | 802 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle( |
819 JNIEnv* env, jobject obj) const { | 803 JNIEnv* env, jobject obj) const { |
820 return ConvertUTF16ToJavaString(env, GetWebContents()->GetTitle()); | 804 return ConvertUTF16ToJavaString(env, GetWebContents()->GetTitle()); |
821 } | 805 } |
822 | 806 |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1525 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1542 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1526 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1543 return reinterpret_cast<jint>(view); | 1527 return reinterpret_cast<jint>(view); |
1544 } | 1528 } |
1545 | 1529 |
1546 bool RegisterContentViewCore(JNIEnv* env) { | 1530 bool RegisterContentViewCore(JNIEnv* env) { |
1547 return RegisterNativesImpl(env); | 1531 return RegisterNativesImpl(env); |
1548 } | 1532 } |
1549 | 1533 |
1550 } // namespace content | 1534 } // namespace content |
OLD | NEW |