Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index f868b4f0147d1e7952e6af39a2ce40439e63fc99..5fd29f12512c4cd97d3e5dbdf8bf6b49f29d14b3 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -1355,19 +1355,34 @@ void ContentViewCoreImpl::WebContentsDestroyed() { |
// This is called for each ContentView. |
jlong Init(JNIEnv* env, |
jobject obj, |
- jlong native_web_contents, |
+ jobject web_contents, |
jlong view_android, |
jlong window_android, |
jobject retained_objects_set) { |
ContentViewCoreImpl* view = new ContentViewCoreImpl( |
env, obj, |
- reinterpret_cast<WebContents*>(native_web_contents), |
+ WebContents::FromJavaWebContents(web_contents), |
reinterpret_cast<ui::ViewAndroid*>(view_android), |
reinterpret_cast<ui::WindowAndroid*>(window_android), |
retained_objects_set); |
return reinterpret_cast<intptr_t>(view); |
} |
+static jobject FromWebContentsAndroid( |
+ JNIEnv* env, |
+ jclass clazz, |
+ jobject jweb_contents) { |
+ WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents); |
+ if (!web_contents) |
+ return NULL; |
+ |
+ ContentViewCore* view = ContentViewCore::FromWebContents(web_contents); |
+ if (!view) |
+ return NULL; |
+ |
+ return view->GetJavaObject().Release(); |
+} |
+ |
bool RegisterContentViewCore(JNIEnv* env) { |
return RegisterNativesImpl(env); |
} |