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

Side by Side Diff: android_webview/native/aw_contents_client_bridge.cc

Issue 1155713005: Use a resource throttle to implement shouldOverrideUrlLoading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix qinmin nit Created 5 years, 5 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "android_webview/native/aw_contents_client_bridge.h" 5 #include "android_webview/native/aw_contents_client_bridge.h"
6 6
7 #include "android_webview/common/devtools_instrumentation.h" 7 #include "android_webview/common/devtools_instrumentation.h"
8 #include "android_webview/native/aw_contents.h" 8 #include "android_webview/native/aw_contents.h"
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 ScopedJavaLocalRef<jstring> jurl( 333 ScopedJavaLocalRef<jstring> jurl(
334 ConvertUTF8ToJavaString(env, origin_url.spec())); 334 ConvertUTF8ToJavaString(env, origin_url.spec()));
335 ScopedJavaLocalRef<jstring> jmessage( 335 ScopedJavaLocalRef<jstring> jmessage(
336 ConvertUTF16ToJavaString(env, message_text)); 336 ConvertUTF16ToJavaString(env, message_text));
337 337
338 devtools_instrumentation::ScopedEmbedderCallbackTask("onJsBeforeUnload"); 338 devtools_instrumentation::ScopedEmbedderCallbackTask("onJsBeforeUnload");
339 Java_AwContentsClientBridge_handleJsBeforeUnload( 339 Java_AwContentsClientBridge_handleJsBeforeUnload(
340 env, obj.obj(), jurl.obj(), jmessage.obj(), callback_id); 340 env, obj.obj(), jurl.obj(), jmessage.obj(), callback_id);
341 } 341 }
342 342
343 bool AwContentsClientBridge::ShouldOverrideUrlLoading(
344 const base::string16& url, bool has_user_gesture, bool is_redirect) {
345 JNIEnv* env = AttachCurrentThread();
346 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
347 if (obj.is_null())
348 return false;
349 ScopedJavaLocalRef<jstring> jurl = ConvertUTF16ToJavaString(env, url);
350 devtools_instrumentation::ScopedEmbedderCallbackTask(
351 "shouldOverrideUrlLoading");
352 return Java_AwContentsClientBridge_shouldOverrideUrlLoading(
353 env, obj.obj(),
354 jurl.obj(), has_user_gesture, is_redirect);
355 }
356
357 void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env, 343 void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env,
358 jobject, 344 jobject,
359 int id, 345 int id,
360 jstring prompt) { 346 jstring prompt) {
361 DCHECK_CURRENTLY_ON(BrowserThread::UI); 347 DCHECK_CURRENTLY_ON(BrowserThread::UI);
362 content::JavaScriptDialogManager::DialogClosedCallback* callback = 348 content::JavaScriptDialogManager::DialogClosedCallback* callback =
363 pending_js_dialog_callbacks_.Lookup(id); 349 pending_js_dialog_callbacks_.Lookup(id);
364 if (!callback) { 350 if (!callback) {
365 LOG(WARNING) << "Unexpected JS dialog confirm. " << id; 351 LOG(WARNING) << "Unexpected JS dialog confirm. " << id;
366 return; 352 return;
(...skipping 26 matching lines...) Expand all
393 pending_client_cert_request_delegates_.Remove(request_id); 379 pending_client_cert_request_delegates_.Remove(request_id);
394 380
395 delete delegate; 381 delete delegate;
396 } 382 }
397 383
398 bool RegisterAwContentsClientBridge(JNIEnv* env) { 384 bool RegisterAwContentsClientBridge(JNIEnv* env) {
399 return RegisterNativesImpl(env); 385 return RegisterNativesImpl(env);
400 } 386 }
401 387
402 } // namespace android_webview 388 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents_client_bridge.h ('k') | android_webview/renderer/aw_content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698