| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 clip_rect_object); | 1520 clip_rect_object); |
| 1521 } | 1521 } |
| 1522 | 1522 |
| 1523 void ContentViewCoreImpl::WebContentsDestroyed() { | 1523 void ContentViewCoreImpl::WebContentsDestroyed() { |
| 1524 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( | 1524 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
| 1525 static_cast<WebContentsImpl*>(web_contents())->GetView()); | 1525 static_cast<WebContentsImpl*>(web_contents())->GetView()); |
| 1526 DCHECK(wcva); | 1526 DCHECK(wcva); |
| 1527 wcva->SetContentViewCore(NULL); | 1527 wcva->SetContentViewCore(NULL); |
| 1528 } | 1528 } |
| 1529 | 1529 |
| 1530 bool ContentViewCoreImpl::PullStart() { | |
| 1531 JNIEnv* env = AttachCurrentThread(); | |
| 1532 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1533 if (!obj.is_null()) | |
| 1534 return Java_ContentViewCore_onOverscrollRefreshStart(env, obj); | |
| 1535 return false; | |
| 1536 } | |
| 1537 | |
| 1538 void ContentViewCoreImpl::PullUpdate(float delta) { | |
| 1539 JNIEnv* env = AttachCurrentThread(); | |
| 1540 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1541 if (!obj.is_null()) | |
| 1542 Java_ContentViewCore_onOverscrollRefreshUpdate(env, obj, delta); | |
| 1543 } | |
| 1544 | |
| 1545 void ContentViewCoreImpl::PullRelease(bool allow_refresh) { | |
| 1546 JNIEnv* env = AttachCurrentThread(); | |
| 1547 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1548 if (!obj.is_null()) { | |
| 1549 Java_ContentViewCore_onOverscrollRefreshRelease(env, obj, allow_refresh); | |
| 1550 } | |
| 1551 } | |
| 1552 | |
| 1553 void ContentViewCoreImpl::PullReset() { | |
| 1554 JNIEnv* env = AttachCurrentThread(); | |
| 1555 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1556 if (!obj.is_null()) | |
| 1557 Java_ContentViewCore_onOverscrollRefreshReset(env, obj); | |
| 1558 } | |
| 1559 | |
| 1560 // This is called for each ContentView. | 1530 // This is called for each ContentView. |
| 1561 jlong Init(JNIEnv* env, | 1531 jlong Init(JNIEnv* env, |
| 1562 const JavaParamRef<jobject>& obj, | 1532 const JavaParamRef<jobject>& obj, |
| 1563 const JavaParamRef<jobject>& jweb_contents, | 1533 const JavaParamRef<jobject>& jweb_contents, |
| 1564 const JavaParamRef<jobject>& jview_android_delegate, | 1534 const JavaParamRef<jobject>& jview_android_delegate, |
| 1565 jlong jwindow_android, | 1535 jlong jwindow_android, |
| 1566 jfloat dipScale, | 1536 jfloat dipScale, |
| 1567 const JavaParamRef<jobject>& retained_objects_set) { | 1537 const JavaParamRef<jobject>& retained_objects_set) { |
| 1568 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 1538 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
| 1569 WebContents::FromJavaWebContents(jweb_contents)); | 1539 WebContents::FromJavaWebContents(jweb_contents)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1596 return ScopedJavaLocalRef<jobject>(); | 1566 return ScopedJavaLocalRef<jobject>(); |
| 1597 | 1567 |
| 1598 return view->GetJavaObject(); | 1568 return view->GetJavaObject(); |
| 1599 } | 1569 } |
| 1600 | 1570 |
| 1601 bool RegisterContentViewCore(JNIEnv* env) { | 1571 bool RegisterContentViewCore(JNIEnv* env) { |
| 1602 return RegisterNativesImpl(env); | 1572 return RegisterNativesImpl(env); |
| 1603 } | 1573 } |
| 1604 | 1574 |
| 1605 } // namespace content | 1575 } // namespace content |
| OLD | NEW |