Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 14283005: Allow showing pending URL for new tab navigations, but only if safe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/android/content_view_core_impl.cc
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 4138ad98991dcb9bb5266d1a28422e392f317761..e8fbdf5e6df0863622294e81684ad7c8e19bccb1 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -800,7 +800,12 @@ jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) {
ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL(
JNIEnv* env, jobject) const {
- return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec());
+ // The current users of the Java API expect to use the active entry
+ // rather than the visible entry, which is exposed by WebContents::GetURL.
+ content::NavigationEntry* entry =
+ web_contents_->GetController().GetActiveEntry();
+ GURL url = entry ? entry->GetVirtualURL() : GURL::EmptyGURL();
+ return ConvertUTF8ToJavaString(env, url.spec());
}
ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle(

Powered by Google App Engine
This is Rietveld 408576698