| Index: content/browser/android/web_contents_observer_proxy.cc
|
| diff --git a/content/browser/android/web_contents_observer_proxy.cc b/content/browser/android/web_contents_observer_proxy.cc
|
| index e6a4c9dd69fe76a10ee805294bb50b2b84846257..16bcefdb302e2c9f5c909ae4fff9964fe6467d2d 100644
|
| --- a/content/browser/android/web_contents_observer_proxy.cc
|
| +++ b/content/browser/android/web_contents_observer_proxy.cc
|
| @@ -18,6 +18,7 @@
|
| #include "content/public/browser/navigation_entry.h"
|
| #include "content/public/browser/navigation_handle.h"
|
| #include "content/public/common/media_metadata.h"
|
| +#include "jni/NavigationHandle_jni.h"
|
| #include "jni/WebContentsObserverProxy_jni.h"
|
|
|
| using base::android::AttachCurrentThread;
|
| @@ -26,6 +27,32 @@ using base::android::ScopedJavaLocalRef;
|
| using base::android::ConvertUTF8ToJavaString;
|
| using base::android::ConvertUTF16ToJavaString;
|
|
|
| +namespace {
|
| +
|
| +// static
|
| +static base::android::ScopedJavaLocalRef<jobject> CreateJavaNavigationHandle(
|
| + JNIEnv* env,
|
| + content::NavigationHandle* navigation_handle) {
|
| + ScopedJavaLocalRef<jstring> j_url(
|
| + ConvertUTF8ToJavaString(env, navigation_handle->GetURL().spec()));
|
| +
|
| + GURL validated_url(navigation_handle->GetURL());
|
| + if (navigation_handle->GetRenderFrameHost() &&
|
| + navigation_handle->GetRenderFrameHost()->GetProcess()) {
|
| + navigation_handle->GetRenderFrameHost()->GetProcess()->FilterURL(
|
| + false, &validated_url);
|
| + }
|
| +
|
| + ScopedJavaLocalRef<jstring> j_validated_url(
|
| + ConvertUTF8ToJavaString(env, validated_url.spec()));
|
| + return content::Java_NavigationHandle_createNavigationHandle(
|
| + env, j_url, j_validated_url, navigation_handle->IsInMainFrame(),
|
| + navigation_handle->IsSamePage(), navigation_handle->GetPageTransition(),
|
| + navigation_handle->HasCommitted(), navigation_handle->IsErrorPage());
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| namespace content {
|
|
|
| // TODO(dcheng): File a bug. This class incorrectly passes just a frame ID,
|
| @@ -81,17 +108,6 @@ void WebContentsObserverProxy::RenderProcessGone(
|
| Java_WebContentsObserverProxy_renderProcessGone(env, obj, was_oom_protected);
|
| }
|
|
|
| -void WebContentsObserverProxy::DidFinishNavigation(
|
| - NavigationHandle* navigation_handle) {
|
| - JNIEnv* env = AttachCurrentThread();
|
| - ScopedJavaLocalRef<jobject> obj(java_observer_);
|
| - ScopedJavaLocalRef<jstring> jstring_url(
|
| - ConvertUTF8ToJavaString(env, web_contents()->GetVisibleURL().spec()));
|
| - Java_WebContentsObserverProxy_didFinishNavigation(
|
| - env, obj, navigation_handle->IsInMainFrame(),
|
| - navigation_handle->IsErrorPage(), navigation_handle->HasCommitted());
|
| -}
|
| -
|
| void WebContentsObserverProxy::DidStartLoading() {
|
| JNIEnv* env = AttachCurrentThread();
|
| ScopedJavaLocalRef<jobject> obj(java_observer_);
|
| @@ -188,6 +204,38 @@ void WebContentsObserverProxy::DocumentAvailableInMainFrame() {
|
| Java_WebContentsObserverProxy_documentAvailableInMainFrame(env, obj);
|
| }
|
|
|
| +void WebContentsObserverProxy::DidStartNavigation(
|
| + NavigationHandle* navigation_handle) {
|
| + JNIEnv* env = AttachCurrentThread();
|
| + ScopedJavaLocalRef<jobject> obj(java_observer_);
|
| + Java_WebContentsObserverProxy_didStartNavigation(
|
| + env, obj, CreateJavaNavigationHandle(env, navigation_handle));
|
| +}
|
| +
|
| +void WebContentsObserverProxy::DidRedirectNavigation(
|
| + NavigationHandle* navigation_handle) {
|
| + JNIEnv* env = AttachCurrentThread();
|
| + ScopedJavaLocalRef<jobject> obj(java_observer_);
|
| + Java_WebContentsObserverProxy_didRedirectNavigation(
|
| + env, obj, CreateJavaNavigationHandle(env, navigation_handle));
|
| +}
|
| +
|
| +void WebContentsObserverProxy::ReadyToCommitNavigation(
|
| + NavigationHandle* navigation_handle) {
|
| + JNIEnv* env = AttachCurrentThread();
|
| + ScopedJavaLocalRef<jobject> obj(java_observer_);
|
| + Java_WebContentsObserverProxy_readyToCommitNavigation(
|
| + env, obj, CreateJavaNavigationHandle(env, navigation_handle));
|
| +}
|
| +
|
| +void WebContentsObserverProxy::DidFinishNavigation(
|
| + NavigationHandle* navigation_handle) {
|
| + JNIEnv* env = AttachCurrentThread();
|
| + ScopedJavaLocalRef<jobject> obj(java_observer_);
|
| + Java_WebContentsObserverProxy_didFinishNavigation(
|
| + env, obj, CreateJavaNavigationHandle(env, navigation_handle));
|
| +}
|
| +
|
| void WebContentsObserverProxy::DidStartProvisionalLoadForFrame(
|
| RenderFrameHost* render_frame_host,
|
| const GURL& validated_url,
|
|
|