OLD | NEW |
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 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 | 1443 |
1444 void ContentViewCoreImpl::PullReset() { | 1444 void ContentViewCoreImpl::PullReset() { |
1445 JNIEnv* env = AttachCurrentThread(); | 1445 JNIEnv* env = AttachCurrentThread(); |
1446 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1446 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
1447 if (!obj.is_null()) | 1447 if (!obj.is_null()) |
1448 Java_ContentViewCore_onOverscrollRefreshReset(env, obj.obj()); | 1448 Java_ContentViewCore_onOverscrollRefreshReset(env, obj.obj()); |
1449 } | 1449 } |
1450 | 1450 |
1451 // This is called for each ContentView. | 1451 // This is called for each ContentView. |
1452 jlong Init(JNIEnv* env, | 1452 jlong Init(JNIEnv* env, |
1453 jobject obj, | 1453 const JavaParamRef<jobject>& obj, |
1454 jobject web_contents, | 1454 const JavaParamRef<jobject>& web_contents, |
1455 jobject view_android_delegate, | 1455 const JavaParamRef<jobject>& view_android_delegate, |
1456 jlong window_android, | 1456 jlong window_android, |
1457 jobject retained_objects_set) { | 1457 const JavaParamRef<jobject>& retained_objects_set) { |
1458 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1458 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
1459 env, obj, WebContents::FromJavaWebContents(web_contents), | 1459 env, obj, WebContents::FromJavaWebContents(web_contents), |
1460 view_android_delegate, | 1460 view_android_delegate, |
1461 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1461 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1462 retained_objects_set); | 1462 retained_objects_set); |
1463 return reinterpret_cast<intptr_t>(view); | 1463 return reinterpret_cast<intptr_t>(view); |
1464 } | 1464 } |
1465 | 1465 |
1466 static ScopedJavaLocalRef<jobject> | 1466 static ScopedJavaLocalRef<jobject> FromWebContentsAndroid( |
1467 FromWebContentsAndroid(JNIEnv* env, jclass clazz, jobject jweb_contents) { | 1467 JNIEnv* env, |
| 1468 const JavaParamRef<jclass>& clazz, |
| 1469 const JavaParamRef<jobject>& jweb_contents) { |
1468 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents); | 1470 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents); |
1469 if (!web_contents) | 1471 if (!web_contents) |
1470 return ScopedJavaLocalRef<jobject>(); | 1472 return ScopedJavaLocalRef<jobject>(); |
1471 | 1473 |
1472 ContentViewCore* view = ContentViewCore::FromWebContents(web_contents); | 1474 ContentViewCore* view = ContentViewCore::FromWebContents(web_contents); |
1473 if (!view) | 1475 if (!view) |
1474 return ScopedJavaLocalRef<jobject>(); | 1476 return ScopedJavaLocalRef<jobject>(); |
1475 | 1477 |
1476 return view->GetJavaObject(); | 1478 return view->GetJavaObject(); |
1477 } | 1479 } |
1478 | 1480 |
1479 bool RegisterContentViewCore(JNIEnv* env) { | 1481 bool RegisterContentViewCore(JNIEnv* env) { |
1480 return RegisterNativesImpl(env); | 1482 return RegisterNativesImpl(env); |
1481 } | 1483 } |
1482 | 1484 |
1483 } // namespace content | 1485 } // namespace content |
OLD | NEW |