| Index: android_webview/native/aw_contents.cc
|
| diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
|
| index ac2cba3456c2441bc6bb8d99685348bc309221c5..ce1927b043191968333fe210bc39b8a946df127d 100644
|
| --- a/android_webview/native/aw_contents.cc
|
| +++ b/android_webview/native/aw_contents.cc
|
| @@ -37,7 +37,6 @@
|
| #include "components/autofill/content/browser/autofill_driver_impl.h"
|
| #include "components/autofill/core/browser/autofill_manager.h"
|
| #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
|
| -#include "components/navigation_interception/intercept_navigation_delegate.h"
|
| #include "content/public/browser/android/content_view_core.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/cert_store.h"
|
| @@ -70,7 +69,6 @@ using base::android::ConvertUTF8ToJavaString;
|
| using base::android::JavaRef;
|
| using base::android::ScopedJavaGlobalRef;
|
| using base::android::ScopedJavaLocalRef;
|
| -using navigation_interception::InterceptNavigationDelegate;
|
| using content::BrowserThread;
|
| using content::ContentViewCore;
|
| using content::WebContents;
|
| @@ -201,8 +199,7 @@ void AwContents::SetJavaPeers(JNIEnv* env,
|
| jobject aw_contents,
|
| jobject web_contents_delegate,
|
| jobject contents_client_bridge,
|
| - jobject io_thread_client,
|
| - jobject intercept_navigation_delegate) {
|
| + jobject io_thread_client) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| // The |aw_content| param is technically spurious as it duplicates |obj| but
|
| // is passed over anyway to make the binding more explicit.
|
| @@ -222,12 +219,6 @@ void AwContents::SetJavaPeers(JNIEnv* env,
|
| int child_id = web_contents_->GetRenderProcessHost()->GetID();
|
| int route_id = web_contents_->GetRoutingID();
|
| AwResourceDispatcherHostDelegate::OnIoThreadClientReady(child_id, route_id);
|
| -
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - InterceptNavigationDelegate::Associate(
|
| - web_contents_.get(),
|
| - make_scoped_ptr(new InterceptNavigationDelegate(
|
| - env, intercept_navigation_delegate)));
|
| }
|
|
|
| void AwContents::SetSaveFormData(bool enabled) {
|
| @@ -304,8 +295,11 @@ jint AwContents::GetWebContents(JNIEnv* env, jobject obj) {
|
| }
|
|
|
| void AwContents::Destroy(JNIEnv* env, jobject obj) {
|
| - delete this;
|
| -
|
| + java_ref_.reset();
|
| + // We do not delete AwContents immediately. Some applications try to delete
|
| + // Webview in ShouldOverrideUrlLoading callback, which is a sync IPC from
|
| + // Webkit.
|
| + BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this);
|
| // When the last WebView is destroyed free all discardable memory allocated by
|
| // Chromium, because the app process may continue to run for a long time
|
| // without ever using another WebView.
|
| @@ -859,6 +853,16 @@ void AwContents::OnWebLayoutContentsSizeChanged(
|
| env, obj.obj(), contents_size.width(), contents_size.height());
|
| }
|
|
|
| +bool AwContents::OnShouldOverrideUrlLoading(const base::string16& url) {
|
| + JNIEnv* env = AttachCurrentThread();
|
| + ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
|
| + if (obj.is_null())
|
| + return false;
|
| + ScopedJavaLocalRef<jstring> jurl = ConvertUTF16ToJavaString(env, url);
|
| + return Java_AwContents_onShouldOverrideUrlLoading(env, obj.obj(),
|
| + jurl.obj());
|
| +}
|
| +
|
| jint AwContents::CapturePicture(JNIEnv* env,
|
| jobject obj,
|
| int width,
|
|
|