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