Index: android_webview/native/aw_contents.cc |
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc |
index 64cd9a97e2cd90a849c6f7d0039a87ee3764b8d6..3638e4ec346bfe3918517a3f8d63c8ed552d40ad 100644 |
--- a/android_webview/native/aw_contents.cc |
+++ b/android_webview/native/aw_contents.cc |
@@ -283,10 +283,14 @@ AwContents::~AwContents() { |
} |
} |
-jlong AwContents::GetWebContents(JNIEnv* env, jobject obj) { |
+base::android::ScopedJavaLocalRef<jobject> |
+AwContents::GetWebContents(JNIEnv* env, jobject obj) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DCHECK(web_contents_); |
- return reinterpret_cast<intptr_t>(web_contents_.get()); |
+ if (!web_contents_) |
+ return base::android::ScopedJavaLocalRef<jobject>(); |
+ |
+ return web_contents_->GetJavaWebContents(); |
} |
void AwContents::Destroy(JNIEnv* env, jobject obj) { |