| 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 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 clip_rect_object); | 1541 clip_rect_object); |
| 1542 } | 1542 } |
| 1543 | 1543 |
| 1544 void ContentViewCoreImpl::WebContentsDestroyed() { | 1544 void ContentViewCoreImpl::WebContentsDestroyed() { |
| 1545 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( | 1545 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
| 1546 static_cast<WebContentsImpl*>(web_contents())->GetView()); | 1546 static_cast<WebContentsImpl*>(web_contents())->GetView()); |
| 1547 DCHECK(wcva); | 1547 DCHECK(wcva); |
| 1548 wcva->SetContentViewCore(NULL); | 1548 wcva->SetContentViewCore(NULL); |
| 1549 } | 1549 } |
| 1550 | 1550 |
| 1551 bool ContentViewCoreImpl::PullStart() { | |
| 1552 JNIEnv* env = AttachCurrentThread(); | |
| 1553 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1554 if (!obj.is_null()) | |
| 1555 return Java_ContentViewCore_onOverscrollRefreshStart(env, obj); | |
| 1556 return false; | |
| 1557 } | |
| 1558 | |
| 1559 void ContentViewCoreImpl::PullUpdate(float delta) { | |
| 1560 JNIEnv* env = AttachCurrentThread(); | |
| 1561 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1562 if (!obj.is_null()) | |
| 1563 Java_ContentViewCore_onOverscrollRefreshUpdate(env, obj, delta); | |
| 1564 } | |
| 1565 | |
| 1566 void ContentViewCoreImpl::PullRelease(bool allow_refresh) { | |
| 1567 JNIEnv* env = AttachCurrentThread(); | |
| 1568 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1569 if (!obj.is_null()) { | |
| 1570 Java_ContentViewCore_onOverscrollRefreshRelease(env, obj, allow_refresh); | |
| 1571 } | |
| 1572 } | |
| 1573 | |
| 1574 void ContentViewCoreImpl::PullReset() { | |
| 1575 JNIEnv* env = AttachCurrentThread(); | |
| 1576 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1577 if (!obj.is_null()) | |
| 1578 Java_ContentViewCore_onOverscrollRefreshReset(env, obj); | |
| 1579 } | |
| 1580 | |
| 1581 // This is called for each ContentView. | 1551 // This is called for each ContentView. |
| 1582 jlong Init(JNIEnv* env, | 1552 jlong Init(JNIEnv* env, |
| 1583 const JavaParamRef<jobject>& obj, | 1553 const JavaParamRef<jobject>& obj, |
| 1584 const JavaParamRef<jobject>& jweb_contents, | 1554 const JavaParamRef<jobject>& jweb_contents, |
| 1585 const JavaParamRef<jobject>& jview_android_delegate, | 1555 const JavaParamRef<jobject>& jview_android_delegate, |
| 1586 jlong jwindow_android, | 1556 jlong jwindow_android, |
| 1587 jfloat dipScale, | 1557 jfloat dipScale, |
| 1588 const JavaParamRef<jobject>& retained_objects_set) { | 1558 const JavaParamRef<jobject>& retained_objects_set) { |
| 1589 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 1559 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
| 1590 WebContents::FromJavaWebContents(jweb_contents)); | 1560 WebContents::FromJavaWebContents(jweb_contents)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1617 return ScopedJavaLocalRef<jobject>(); | 1587 return ScopedJavaLocalRef<jobject>(); |
| 1618 | 1588 |
| 1619 return view->GetJavaObject(); | 1589 return view->GetJavaObject(); |
| 1620 } | 1590 } |
| 1621 | 1591 |
| 1622 bool RegisterContentViewCore(JNIEnv* env) { | 1592 bool RegisterContentViewCore(JNIEnv* env) { |
| 1623 return RegisterNativesImpl(env); | 1593 return RegisterNativesImpl(env); |
| 1624 } | 1594 } |
| 1625 | 1595 |
| 1626 } // namespace content | 1596 } // namespace content |
| OLD | NEW |