| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 void WebContentsObserverProxy::DocumentAvailableInMainFrame() { | 185 void WebContentsObserverProxy::DocumentAvailableInMainFrame() { |
| 186 JNIEnv* env = AttachCurrentThread(); | 186 JNIEnv* env = AttachCurrentThread(); |
| 187 ScopedJavaLocalRef<jobject> obj(java_observer_); | 187 ScopedJavaLocalRef<jobject> obj(java_observer_); |
| 188 Java_WebContentsObserverProxy_documentAvailableInMainFrame(env, obj); | 188 Java_WebContentsObserverProxy_documentAvailableInMainFrame(env, obj); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void WebContentsObserverProxy::DidStartProvisionalLoadForFrame( | 191 void WebContentsObserverProxy::DidStartProvisionalLoadForFrame( |
| 192 RenderFrameHost* render_frame_host, | 192 RenderFrameHost* render_frame_host, |
| 193 const GURL& validated_url, | 193 const GURL& validated_url, |
| 194 bool is_error_page) { | 194 bool is_error_page, |
| 195 bool is_iframe_srcdoc) { |
| 195 JNIEnv* env = AttachCurrentThread(); | 196 JNIEnv* env = AttachCurrentThread(); |
| 196 ScopedJavaLocalRef<jobject> obj(java_observer_); | 197 ScopedJavaLocalRef<jobject> obj(java_observer_); |
| 197 ScopedJavaLocalRef<jstring> jstring_url( | 198 ScopedJavaLocalRef<jstring> jstring_url( |
| 198 ConvertUTF8ToJavaString(env, validated_url.spec())); | 199 ConvertUTF8ToJavaString(env, validated_url.spec())); |
| 199 // TODO(dcheng): Does Java really need the parent frame ID? It doesn't appear | 200 // 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. | 201 // to be used at all, and it just adds complexity here. |
| 201 Java_WebContentsObserverProxy_didStartProvisionalLoadForFrame( | 202 Java_WebContentsObserverProxy_didStartProvisionalLoadForFrame( |
| 202 env, obj, render_frame_host->GetRoutingID(), | 203 env, obj, render_frame_host->GetRoutingID(), |
| 203 render_frame_host->GetParent() | 204 render_frame_host->GetParent() |
| 204 ? render_frame_host->GetParent()->GetRoutingID() | 205 ? render_frame_host->GetParent()->GetRoutingID() |
| 205 : -1, | 206 : -1, |
| 206 !render_frame_host->GetParent(), jstring_url, is_error_page); | 207 !render_frame_host->GetParent(), jstring_url, is_error_page, |
| 208 is_iframe_srcdoc); |
| 207 } | 209 } |
| 208 | 210 |
| 209 void WebContentsObserverProxy::DidCommitProvisionalLoadForFrame( | 211 void WebContentsObserverProxy::DidCommitProvisionalLoadForFrame( |
| 210 RenderFrameHost* render_frame_host, | 212 RenderFrameHost* render_frame_host, |
| 211 const GURL& url, | 213 const GURL& url, |
| 212 ui::PageTransition transition_type) { | 214 ui::PageTransition transition_type) { |
| 213 JNIEnv* env = AttachCurrentThread(); | 215 JNIEnv* env = AttachCurrentThread(); |
| 214 ScopedJavaLocalRef<jobject> obj(java_observer_); | 216 ScopedJavaLocalRef<jobject> obj(java_observer_); |
| 215 ScopedJavaLocalRef<jstring> jstring_url( | 217 ScopedJavaLocalRef<jstring> jstring_url( |
| 216 ConvertUTF8ToJavaString(env, url.spec())); | 218 ConvertUTF8ToJavaString(env, url.spec())); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // a base URL if there has been a loadUrl("javascript:...") after | 343 // a base URL if there has been a loadUrl("javascript:...") after |
| 342 // loadDataWithBaseUrl. | 344 // loadDataWithBaseUrl. |
| 343 *url = base_url_of_last_started_data_url_.possibly_invalid_spec(); | 345 *url = base_url_of_last_started_data_url_.possibly_invalid_spec(); |
| 344 } | 346 } |
| 345 } | 347 } |
| 346 | 348 |
| 347 bool RegisterWebContentsObserverProxy(JNIEnv* env) { | 349 bool RegisterWebContentsObserverProxy(JNIEnv* env) { |
| 348 return RegisterNativesImpl(env); | 350 return RegisterNativesImpl(env); |
| 349 } | 351 } |
| 350 } // namespace content | 352 } // namespace content |
| OLD | NEW |