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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 LoadUrl(params); | 793 LoadUrl(params); |
794 } | 794 } |
795 | 795 |
796 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { | 796 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { |
797 return GetRenderProcessIdFromRenderViewHost( | 797 return GetRenderProcessIdFromRenderViewHost( |
798 web_contents_->GetRenderViewHost()); | 798 web_contents_->GetRenderViewHost()); |
799 } | 799 } |
800 | 800 |
801 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( | 801 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( |
802 JNIEnv* env, jobject) const { | 802 JNIEnv* env, jobject) const { |
803 return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec()); | 803 // The current users of the Java API expect to use the active entry |
| 804 // rather than the visible entry, which is exposed by WebContents::GetURL. |
| 805 content::NavigationEntry* entry = |
| 806 web_contents_->GetController().GetActiveEntry(); |
| 807 GURL url = entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); |
| 808 return ConvertUTF8ToJavaString(env, url.spec()); |
804 } | 809 } |
805 | 810 |
806 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle( | 811 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle( |
807 JNIEnv* env, jobject obj) const { | 812 JNIEnv* env, jobject obj) const { |
808 return ConvertUTF16ToJavaString(env, GetWebContents()->GetTitle()); | 813 return ConvertUTF16ToJavaString(env, GetWebContents()->GetTitle()); |
809 } | 814 } |
810 | 815 |
811 jboolean ContentViewCoreImpl::IsIncognito(JNIEnv* env, jobject obj) { | 816 jboolean ContentViewCoreImpl::IsIncognito(JNIEnv* env, jobject obj) { |
812 return GetWebContents()->GetBrowserContext()->IsOffTheRecord(); | 817 return GetWebContents()->GetBrowserContext()->IsOffTheRecord(); |
813 } | 818 } |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1568 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1564 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1569 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1565 return reinterpret_cast<jint>(view); | 1570 return reinterpret_cast<jint>(view); |
1566 } | 1571 } |
1567 | 1572 |
1568 bool RegisterContentViewCore(JNIEnv* env) { | 1573 bool RegisterContentViewCore(JNIEnv* env) { |
1569 return RegisterNativesImpl(env); | 1574 return RegisterNativesImpl(env); |
1570 } | 1575 } |
1571 | 1576 |
1572 } // namespace content | 1577 } // namespace content |
OLD | NEW |