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

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 831523005: Remove most native WebContents references from Java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698