| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/web_contents_observer_proxy.h" | 5 #include "content/browser/android/web_contents_observer_proxy.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 void WebContentsObserverProxy::DocumentAvailableInMainFrame() { | 184 void WebContentsObserverProxy::DocumentAvailableInMainFrame() { |
| 185 JNIEnv* env = AttachCurrentThread(); | 185 JNIEnv* env = AttachCurrentThread(); |
| 186 ScopedJavaLocalRef<jobject> obj(java_observer_); | 186 ScopedJavaLocalRef<jobject> obj(java_observer_); |
| 187 Java_WebContentsObserverProxy_documentAvailableInMainFrame(env, obj); | 187 Java_WebContentsObserverProxy_documentAvailableInMainFrame(env, obj); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void WebContentsObserverProxy::DidStartProvisionalLoadForFrame( | 190 void WebContentsObserverProxy::DidStartProvisionalLoadForFrame( |
| 191 RenderFrameHost* render_frame_host, | 191 RenderFrameHost* render_frame_host, |
| 192 const GURL& validated_url, | 192 const GURL& validated_url, |
| 193 bool is_error_page, | 193 bool is_error_page) { |
| 194 bool is_iframe_srcdoc) { | |
| 195 JNIEnv* env = AttachCurrentThread(); | 194 JNIEnv* env = AttachCurrentThread(); |
| 196 ScopedJavaLocalRef<jobject> obj(java_observer_); | 195 ScopedJavaLocalRef<jobject> obj(java_observer_); |
| 197 ScopedJavaLocalRef<jstring> jstring_url( | 196 ScopedJavaLocalRef<jstring> jstring_url( |
| 198 ConvertUTF8ToJavaString(env, validated_url.spec())); | 197 ConvertUTF8ToJavaString(env, validated_url.spec())); |
| 199 // TODO(dcheng): Does Java really need the parent frame ID? It doesn't appear | 198 // TODO(dcheng): Does Java really need the parent frame ID? It doesn't appear |
| 200 // to be used at all, and it just adds complexity here. | 199 // to be used at all, and it just adds complexity here. |
| 201 Java_WebContentsObserverProxy_didStartProvisionalLoadForFrame( | 200 Java_WebContentsObserverProxy_didStartProvisionalLoadForFrame( |
| 202 env, obj, render_frame_host->GetRoutingID(), | 201 env, obj, render_frame_host->GetRoutingID(), |
| 203 render_frame_host->GetParent() | 202 render_frame_host->GetParent() |
| 204 ? render_frame_host->GetParent()->GetRoutingID() | 203 ? render_frame_host->GetParent()->GetRoutingID() |
| 205 : -1, | 204 : -1, |
| 206 !render_frame_host->GetParent(), jstring_url, is_error_page, | 205 !render_frame_host->GetParent(), jstring_url, is_error_page); |
| 207 is_iframe_srcdoc); | |
| 208 } | 206 } |
| 209 | 207 |
| 210 void WebContentsObserverProxy::DidCommitProvisionalLoadForFrame( | 208 void WebContentsObserverProxy::DidCommitProvisionalLoadForFrame( |
| 211 RenderFrameHost* render_frame_host, | 209 RenderFrameHost* render_frame_host, |
| 212 const GURL& url, | 210 const GURL& url, |
| 213 ui::PageTransition transition_type) { | 211 ui::PageTransition transition_type) { |
| 214 JNIEnv* env = AttachCurrentThread(); | 212 JNIEnv* env = AttachCurrentThread(); |
| 215 ScopedJavaLocalRef<jobject> obj(java_observer_); | 213 ScopedJavaLocalRef<jobject> obj(java_observer_); |
| 216 ScopedJavaLocalRef<jstring> jstring_url( | 214 ScopedJavaLocalRef<jstring> jstring_url( |
| 217 ConvertUTF8ToJavaString(env, url.spec())); | 215 ConvertUTF8ToJavaString(env, url.spec())); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 // a base URL if there has been a loadUrl("javascript:...") after | 330 // a base URL if there has been a loadUrl("javascript:...") after |
| 333 // loadDataWithBaseUrl. | 331 // loadDataWithBaseUrl. |
| 334 *url = base_url_of_last_started_data_url_.possibly_invalid_spec(); | 332 *url = base_url_of_last_started_data_url_.possibly_invalid_spec(); |
| 335 } | 333 } |
| 336 } | 334 } |
| 337 | 335 |
| 338 bool RegisterWebContentsObserverProxy(JNIEnv* env) { | 336 bool RegisterWebContentsObserverProxy(JNIEnv* env) { |
| 339 return RegisterNativesImpl(env); | 337 return RegisterNativesImpl(env); |
| 340 } | 338 } |
| 341 } // namespace content | 339 } // namespace content |
| OLD | NEW |