Index: android_webview/native/aw_contents.cc |
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc |
index 7b429f23f0e51d0726b03870bc7aafd24b83a32e..ef9fd24f07b549dd643577923dcb6e55cf097daa 100644 |
--- a/android_webview/native/aw_contents.cc |
+++ b/android_webview/native/aw_contents.cc |
@@ -15,6 +15,7 @@ |
#include "android_webview/common/aw_hit_test_data.h" |
#include "android_webview/common/renderer_picture_map.h" |
#include "android_webview/native/aw_browser_dependency_factory.h" |
+#include "android_webview/native/aw_contents_client_bridge.h" |
#include "android_webview/native/aw_contents_io_thread_client_impl.h" |
#include "android_webview/native/aw_web_contents_delegate.h" |
#include "android_webview/native/state_serializer.h" |
@@ -176,10 +177,13 @@ AwContents* AwContents::FromID(int render_process_id, int render_view_id) { |
AwContents::AwContents(JNIEnv* env, |
jobject obj, |
- jobject web_contents_delegate) |
+ jobject web_contents_delegate, |
+ jobject contents_client_bridge) |
: java_ref_(env, obj), |
web_contents_delegate_( |
new AwWebContentsDelegate(env, web_contents_delegate)), |
+ contents_client_bridge_( |
+ new AwContentsClientBridge(env, contents_client_bridge)), |
view_visible_(false), |
compositor_visible_(false), |
is_composite_pending_(false), |
@@ -211,7 +215,8 @@ void AwContents::SetWebContents(content::WebContents* web_contents) { |
icon_helper_->SetListener(this); |
web_contents_->SetUserData(kAwContentsUserDataKey, |
new AwContentsUserData(this)); |
- |
+ AwContentsClientBridgeBase::Associate(web_contents_.get(), |
+ contents_client_bridge_.get()); |
web_contents_->SetDelegate(web_contents_delegate_.get()); |
render_view_host_ext_.reset(new AwRenderViewHostExt(web_contents_.get(), |
this)); |
@@ -671,11 +676,14 @@ void AwContents::OnReceivedHttpAuthRequest(const JavaRef<jobject>& handler, |
const std::string& host, |
const std::string& realm) { |
JNIEnv* env = AttachCurrentThread(); |
+ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
+ if (obj.is_null()) |
+ return; |
+ |
ScopedJavaLocalRef<jstring> jhost = ConvertUTF8ToJavaString(env, host); |
ScopedJavaLocalRef<jstring> jrealm = ConvertUTF8ToJavaString(env, realm); |
- Java_AwContents_onReceivedHttpAuthRequest(env, java_ref_.get(env).obj(), |
- handler.obj(), jhost.obj(), |
- jrealm.obj()); |
+ Java_AwContents_onReceivedHttpAuthRequest(env, obj.obj(), handler.obj(), |
+ jhost.obj(), jrealm.obj()); |
joth
2013/02/23 00:30:09
nit: indent to (
|
} |
void AwContents::SetIoThreadClient(JNIEnv* env, jobject obj, jobject client) { |
@@ -717,8 +725,10 @@ void AwContents::AddVisitedLinks(JNIEnv* env, |
static jint Init(JNIEnv* env, |
jobject obj, |
- jobject web_contents_delegate) { |
- AwContents* tab = new AwContents(env, obj, web_contents_delegate); |
+ jobject web_contents_delegate, |
+ jobject contents_client_bridge) { |
+ AwContents* tab = new AwContents(env, obj, web_contents_delegate, |
+ contents_client_bridge); |
joth
2013/02/23 00:30:09
ditto.
|
return reinterpret_cast<jint>(tab); |
} |