Chromium Code Reviews| 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..f30bfe84a1b1d81262fb695274614beae259c4d6 100644 |
| --- a/content/browser/android/web_contents_observer_proxy.cc |
| +++ b/content/browser/android/web_contents_observer_proxy.cc |
| @@ -81,17 +81,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 +177,35 @@ void WebContentsObserverProxy::DocumentAvailableInMainFrame() { |
| Java_WebContentsObserverProxy_documentAvailableInMainFrame(env, obj); |
| } |
| +void WebContentsObserverProxy::DidStartNavigation( |
| + NavigationHandle* navigation_handle) { |
| + JNIEnv* env = AttachCurrentThread(); |
| + ScopedJavaLocalRef<jobject> obj(java_observer_); |
| + ScopedJavaLocalRef<jstring> jstring_url( |
| + ConvertUTF8ToJavaString(env, navigation_handle->GetURL().spec())); |
| + Java_WebContentsObserverProxy_didStartNavigation( |
| + env, obj, jstring_url, navigation_handle->IsInMainFrame(), |
| + navigation_handle->IsErrorPage()); |
| +} |
| + |
| +void WebContentsObserverProxy::DidFinishNavigation( |
| + NavigationHandle* navigation_handle) { |
| + JNIEnv* env = AttachCurrentThread(); |
| + ScopedJavaLocalRef<jobject> obj(java_observer_); |
| + ScopedJavaLocalRef<jstring> jstring_url( |
| + ConvertUTF8ToJavaString(env, navigation_handle->GetURL().spec())); |
| + jboolean is_navigation_to_different_page = |
|
Ted C
2016/12/28 20:00:21
I would get rid of both of these computed values a
|
| + navigation_handle->IsInMainFrame() && !navigation_handle->IsSamePage(); |
| + jboolean is_reload = ui::PageTransitionCoreTypeIs( |
| + navigation_handle->GetPageTransition(), ui::PAGE_TRANSITION_RELOAD); |
| + |
| + Java_WebContentsObserverProxy_didFinishNavigation( |
| + env, obj, jstring_url, navigation_handle->IsInMainFrame(), |
| + navigation_handle->IsErrorPage(), navigation_handle->HasCommitted(), |
| + is_navigation_to_different_page, navigation_handle->IsSamePage(), |
| + is_reload); |
| +} |
| + |
| void WebContentsObserverProxy::DidStartProvisionalLoadForFrame( |
| RenderFrameHost* render_frame_host, |
| const GURL& validated_url, |