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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 13846007: Allow showing pending URL for new tab navigations, but only if safe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 web_contents_->SetUserAgentOverride(override); 795 web_contents_->SetUserAgentOverride(override);
796 } 796 }
797 797
798 const NavigationController& controller = web_contents_->GetController(); 798 const NavigationController& controller = web_contents_->GetController();
799 for (int i = 0; i < controller.GetEntryCount(); ++i) 799 for (int i = 0; i < controller.GetEntryCount(); ++i)
800 controller.GetEntryAtIndex(i)->SetIsOverridingUserAgent(override_used); 800 controller.GetEntryAtIndex(i)->SetIsOverridingUserAgent(override_used);
801 } 801 }
802 802
803 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( 803 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL(
804 JNIEnv* env, jobject) const { 804 JNIEnv* env, jobject) const {
805 return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec()); 805 // The current users of the Java API expect to use the active entry
806 // rather than the visible entry, which is exposed by WebContents::GetURL.
807 content::NavigationEntry* entry =
808 web_contents_->GetController().GetActiveEntry();
809 GURL url = entry ? entry->GetVirtualURL() : GURL::EmptyGURL();
810 return ConvertUTF8ToJavaString(env, url.spec());
806 } 811 }
807 812
808 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle( 813 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle(
809 JNIEnv* env, jobject obj) const { 814 JNIEnv* env, jobject obj) const {
810 return ConvertUTF16ToJavaString(env, GetWebContents()->GetTitle()); 815 return ConvertUTF16ToJavaString(env, GetWebContents()->GetTitle());
811 } 816 }
812 817
813 jboolean ContentViewCoreImpl::IsIncognito(JNIEnv* env, jobject obj) { 818 jboolean ContentViewCoreImpl::IsIncognito(JNIEnv* env, jobject obj) {
814 return GetWebContents()->GetBrowserContext()->IsOffTheRecord(); 819 return GetWebContents()->GetBrowserContext()->IsOffTheRecord();
815 } 820 }
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 reinterpret_cast<WebContents*>(native_web_contents), 1505 reinterpret_cast<WebContents*>(native_web_contents),
1501 reinterpret_cast<ui::WindowAndroid*>(native_window)); 1506 reinterpret_cast<ui::WindowAndroid*>(native_window));
1502 return reinterpret_cast<jint>(view); 1507 return reinterpret_cast<jint>(view);
1503 } 1508 }
1504 1509
1505 bool RegisterContentViewCore(JNIEnv* env) { 1510 bool RegisterContentViewCore(JNIEnv* env) {
1506 return RegisterNativesImpl(env); 1511 return RegisterNativesImpl(env);
1507 } 1512 }
1508 1513
1509 } // namespace content 1514 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698