Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1215)

Side by Side Diff: content/browser/android/web_contents_observer_proxy.cc

Issue 1155713005: Use a resource throttle to implement shouldOverrideUrlLoading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add flag showing that shouldOverrideUrl cancelled the navigation Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString( 88 ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString(
89 env, web_contents()->GetLastCommittedURL().spec())); 89 env, web_contents()->GetLastCommittedURL().spec()));
90 Java_WebContentsObserverProxy_didStopLoading(env, obj.obj(), 90 Java_WebContentsObserverProxy_didStopLoading(env, obj.obj(),
91 jstring_url.obj()); 91 jstring_url.obj());
92 } 92 }
93 93
94 void WebContentsObserverProxy::DidFailProvisionalLoad( 94 void WebContentsObserverProxy::DidFailProvisionalLoad(
95 RenderFrameHost* render_frame_host, 95 RenderFrameHost* render_frame_host,
96 const GURL& validated_url, 96 const GURL& validated_url,
97 int error_code, 97 int error_code,
98 const base::string16& error_description) { 98 const base::string16& error_description,
99 bool was_ignored_by_handler) {
99 DidFailLoadInternal(true, !render_frame_host->GetParent(), error_code, 100 DidFailLoadInternal(true, !render_frame_host->GetParent(), error_code,
100 error_description, validated_url); 101 error_description, validated_url, was_ignored_by_handler);
101 } 102 }
102 103
103 void WebContentsObserverProxy::DidFailLoad( 104 void WebContentsObserverProxy::DidFailLoad(
104 RenderFrameHost* render_frame_host, 105 RenderFrameHost* render_frame_host,
105 const GURL& validated_url, 106 const GURL& validated_url,
106 int error_code, 107 int error_code,
107 const base::string16& error_description) { 108 const base::string16& error_description,
109 bool was_ignored_by_handler) {
108 DidFailLoadInternal(false, !render_frame_host->GetParent(), error_code, 110 DidFailLoadInternal(false, !render_frame_host->GetParent(), error_code,
109 error_description, validated_url); 111 error_description, validated_url, was_ignored_by_handler);
110 } 112 }
111 113
112 void WebContentsObserverProxy::DidNavigateMainFrame( 114 void WebContentsObserverProxy::DidNavigateMainFrame(
113 const LoadCommittedDetails& details, 115 const LoadCommittedDetails& details,
114 const FrameNavigateParams& params) { 116 const FrameNavigateParams& params) {
115 JNIEnv* env = AttachCurrentThread(); 117 JNIEnv* env = AttachCurrentThread();
116 ScopedJavaLocalRef<jobject> obj(java_observer_); 118 ScopedJavaLocalRef<jobject> obj(java_observer_);
117 ScopedJavaLocalRef<jstring> jstring_url( 119 ScopedJavaLocalRef<jstring> jstring_url(
118 ConvertUTF8ToJavaString(env, params.url.spec())); 120 ConvertUTF8ToJavaString(env, params.url.spec()));
119 ScopedJavaLocalRef<jstring> jstring_base_url( 121 ScopedJavaLocalRef<jstring> jstring_base_url(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 JNIEnv* env = AttachCurrentThread(); 248 JNIEnv* env = AttachCurrentThread();
247 ScopedJavaLocalRef<jobject> obj(java_observer_); 249 ScopedJavaLocalRef<jobject> obj(java_observer_);
248 Java_WebContentsObserverProxy_didChangeThemeColor(env, obj.obj(), color); 250 Java_WebContentsObserverProxy_didChangeThemeColor(env, obj.obj(), color);
249 } 251 }
250 252
251 void WebContentsObserverProxy::DidFailLoadInternal( 253 void WebContentsObserverProxy::DidFailLoadInternal(
252 bool is_provisional_load, 254 bool is_provisional_load,
253 bool is_main_frame, 255 bool is_main_frame,
254 int error_code, 256 int error_code,
255 const base::string16& description, 257 const base::string16& description,
256 const GURL& url) { 258 const GURL& url,
259 bool was_ignored_by_handler) {
257 JNIEnv* env = AttachCurrentThread(); 260 JNIEnv* env = AttachCurrentThread();
258 ScopedJavaLocalRef<jobject> obj(java_observer_); 261 ScopedJavaLocalRef<jobject> obj(java_observer_);
259 ScopedJavaLocalRef<jstring> jstring_error_description( 262 ScopedJavaLocalRef<jstring> jstring_error_description(
260 ConvertUTF16ToJavaString(env, description)); 263 ConvertUTF16ToJavaString(env, description));
261 ScopedJavaLocalRef<jstring> jstring_url( 264 ScopedJavaLocalRef<jstring> jstring_url(
262 ConvertUTF8ToJavaString(env, url.spec())); 265 ConvertUTF8ToJavaString(env, url.spec()));
263 266
264 Java_WebContentsObserverProxy_didFailLoad( 267 Java_WebContentsObserverProxy_didFailLoad(
265 env, obj.obj(), is_provisional_load, is_main_frame, error_code, 268 env, obj.obj(), is_provisional_load, is_main_frame, error_code,
266 jstring_error_description.obj(), jstring_url.obj()); 269 jstring_error_description.obj(), jstring_url.obj(),
270 was_ignored_by_handler);
267 } 271 }
268 272
269 void WebContentsObserverProxy::DidFirstVisuallyNonEmptyPaint() { 273 void WebContentsObserverProxy::DidFirstVisuallyNonEmptyPaint() {
270 JNIEnv* env = AttachCurrentThread(); 274 JNIEnv* env = AttachCurrentThread();
271 ScopedJavaLocalRef<jobject> obj(java_observer_); 275 ScopedJavaLocalRef<jobject> obj(java_observer_);
272 Java_WebContentsObserverProxy_didFirstVisuallyNonEmptyPaint(env, obj.obj()); 276 Java_WebContentsObserverProxy_didFirstVisuallyNonEmptyPaint(env, obj.obj());
273 } 277 }
274 278
275 void WebContentsObserverProxy::DidStartNavigationToPendingEntry( 279 void WebContentsObserverProxy::DidStartNavigationToPendingEntry(
276 const GURL& url, 280 const GURL& url,
277 NavigationController::ReloadType reload_type) { 281 NavigationController::ReloadType reload_type) {
278 JNIEnv* env = AttachCurrentThread(); 282 JNIEnv* env = AttachCurrentThread();
279 ScopedJavaLocalRef<jobject> obj(java_observer_); 283 ScopedJavaLocalRef<jobject> obj(java_observer_);
280 ScopedJavaLocalRef<jstring> jstring_url( 284 ScopedJavaLocalRef<jstring> jstring_url(
281 ConvertUTF8ToJavaString(env, url.spec())); 285 ConvertUTF8ToJavaString(env, url.spec()));
282 286
283 Java_WebContentsObserverProxy_didStartNavigationToPendingEntry( 287 Java_WebContentsObserverProxy_didStartNavigationToPendingEntry(
284 env, obj.obj(), jstring_url.obj()); 288 env, obj.obj(), jstring_url.obj());
285 } 289 }
286 290
287 bool RegisterWebContentsObserverProxy(JNIEnv* env) { 291 bool RegisterWebContentsObserverProxy(JNIEnv* env) {
288 return RegisterNativesImpl(env); 292 return RegisterNativesImpl(env);
289 } 293 }
290 } // namespace content 294 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698