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