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

Side by Side 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: Kept same error checking behavior for aw_contents.cc 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 void ContentViewCoreImpl::WebContentsDestroyed() { 1348 void ContentViewCoreImpl::WebContentsDestroyed() {
1349 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( 1349 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>(
1350 static_cast<WebContentsImpl*>(web_contents())->GetView()); 1350 static_cast<WebContentsImpl*>(web_contents())->GetView());
1351 DCHECK(wcva); 1351 DCHECK(wcva);
1352 wcva->SetContentViewCore(NULL); 1352 wcva->SetContentViewCore(NULL);
1353 } 1353 }
1354 1354
1355 // This is called for each ContentView. 1355 // This is called for each ContentView.
1356 jlong Init(JNIEnv* env, 1356 jlong Init(JNIEnv* env,
1357 jobject obj, 1357 jobject obj,
1358 jlong native_web_contents, 1358 jobject web_contents,
1359 jlong view_android, 1359 jlong view_android,
1360 jlong window_android, 1360 jlong window_android,
1361 jobject retained_objects_set) { 1361 jobject retained_objects_set) {
1362 ContentViewCoreImpl* view = new ContentViewCoreImpl( 1362 ContentViewCoreImpl* view = new ContentViewCoreImpl(
1363 env, obj, 1363 env, obj,
1364 reinterpret_cast<WebContents*>(native_web_contents), 1364 WebContents::FromJavaWebContents(web_contents),
1365 reinterpret_cast<ui::ViewAndroid*>(view_android), 1365 reinterpret_cast<ui::ViewAndroid*>(view_android),
1366 reinterpret_cast<ui::WindowAndroid*>(window_android), 1366 reinterpret_cast<ui::WindowAndroid*>(window_android),
1367 retained_objects_set); 1367 retained_objects_set);
1368 return reinterpret_cast<intptr_t>(view); 1368 return reinterpret_cast<intptr_t>(view);
1369 } 1369 }
1370 1370
1371 static jobject FromWebContentsAndroid(
1372 JNIEnv* env,
1373 jclass clazz,
1374 jobject jweb_contents) {
1375 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents);
1376 if (!web_contents)
1377 return NULL;
1378
1379 ContentViewCore* view = ContentViewCore::FromWebContents(web_contents);
1380 if (!view)
1381 return NULL;
1382
1383 return view->GetJavaObject().Release();
1384 }
1385
1371 bool RegisterContentViewCore(JNIEnv* env) { 1386 bool RegisterContentViewCore(JNIEnv* env) {
1372 return RegisterNativesImpl(env); 1387 return RegisterNativesImpl(env);
1373 } 1388 }
1374 1389
1375 } // namespace content 1390 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698