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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 env, obj.obj(), jtext.obj(), jhtml.obj(), clip_rect_object.obj()); | 1403 env, obj.obj(), jtext.obj(), jhtml.obj(), clip_rect_object.obj()); |
1404 } | 1404 } |
1405 | 1405 |
1406 void ContentViewCoreImpl::WebContentsDestroyed() { | 1406 void ContentViewCoreImpl::WebContentsDestroyed() { |
1407 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( | 1407 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
1408 static_cast<WebContentsImpl*>(web_contents())->GetView()); | 1408 static_cast<WebContentsImpl*>(web_contents())->GetView()); |
1409 DCHECK(wcva); | 1409 DCHECK(wcva); |
1410 wcva->SetContentViewCore(NULL); | 1410 wcva->SetContentViewCore(NULL); |
1411 } | 1411 } |
1412 | 1412 |
| 1413 bool ContentViewCoreImpl::PullStart() { |
| 1414 JNIEnv* env = AttachCurrentThread(); |
| 1415 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1416 if (!obj.is_null()) |
| 1417 return Java_ContentViewCore_onOverscrollRefreshStart(env, obj.obj()); |
| 1418 return false; |
| 1419 } |
| 1420 |
| 1421 void ContentViewCoreImpl::PullUpdate(float delta) { |
| 1422 JNIEnv* env = AttachCurrentThread(); |
| 1423 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1424 if (!obj.is_null()) |
| 1425 Java_ContentViewCore_onOverscrollRefreshUpdate(env, obj.obj(), delta); |
| 1426 } |
| 1427 |
| 1428 void ContentViewCoreImpl::PullRelease(bool allow_refresh) { |
| 1429 JNIEnv* env = AttachCurrentThread(); |
| 1430 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1431 if (!obj.is_null()) { |
| 1432 Java_ContentViewCore_onOverscrollRefreshRelease(env, obj.obj(), |
| 1433 allow_refresh); |
| 1434 } |
| 1435 } |
| 1436 |
| 1437 void ContentViewCoreImpl::PullReset() { |
| 1438 JNIEnv* env = AttachCurrentThread(); |
| 1439 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1440 if (!obj.is_null()) |
| 1441 Java_ContentViewCore_onOverscrollRefreshReset(env, obj.obj()); |
| 1442 } |
| 1443 |
1413 // This is called for each ContentView. | 1444 // This is called for each ContentView. |
1414 jlong Init(JNIEnv* env, | 1445 jlong Init(JNIEnv* env, |
1415 jobject obj, | 1446 jobject obj, |
1416 jobject web_contents, | 1447 jobject web_contents, |
1417 jobject view_android_delegate, | 1448 jobject view_android_delegate, |
1418 jlong window_android, | 1449 jlong window_android, |
1419 jobject retained_objects_set) { | 1450 jobject retained_objects_set) { |
1420 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1451 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
1421 env, obj, WebContents::FromJavaWebContents(web_contents), | 1452 env, obj, WebContents::FromJavaWebContents(web_contents), |
1422 view_android_delegate, | 1453 view_android_delegate, |
(...skipping 15 matching lines...) Expand all Loading... |
1438 return NULL; | 1469 return NULL; |
1439 | 1470 |
1440 return view->GetJavaObject().Release(); | 1471 return view->GetJavaObject().Release(); |
1441 } | 1472 } |
1442 | 1473 |
1443 bool RegisterContentViewCore(JNIEnv* env) { | 1474 bool RegisterContentViewCore(JNIEnv* env) { |
1444 return RegisterNativesImpl(env); | 1475 return RegisterNativesImpl(env); |
1445 } | 1476 } |
1446 | 1477 |
1447 } // namespace content | 1478 } // namespace content |
OLD | NEW |