| 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 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 clip_rect_object); | 1532 clip_rect_object); |
| 1533 } | 1533 } |
| 1534 | 1534 |
| 1535 void ContentViewCoreImpl::WebContentsDestroyed() { | 1535 void ContentViewCoreImpl::WebContentsDestroyed() { |
| 1536 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( | 1536 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
| 1537 static_cast<WebContentsImpl*>(web_contents())->GetView()); | 1537 static_cast<WebContentsImpl*>(web_contents())->GetView()); |
| 1538 DCHECK(wcva); | 1538 DCHECK(wcva); |
| 1539 wcva->SetContentViewCore(NULL); | 1539 wcva->SetContentViewCore(NULL); |
| 1540 } | 1540 } |
| 1541 | 1541 |
| 1542 bool ContentViewCoreImpl::PullStart() { | |
| 1543 JNIEnv* env = AttachCurrentThread(); | |
| 1544 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1545 if (!obj.is_null()) | |
| 1546 return Java_ContentViewCore_onOverscrollRefreshStart(env, obj); | |
| 1547 return false; | |
| 1548 } | |
| 1549 | |
| 1550 void ContentViewCoreImpl::PullUpdate(float delta) { | |
| 1551 JNIEnv* env = AttachCurrentThread(); | |
| 1552 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1553 if (!obj.is_null()) | |
| 1554 Java_ContentViewCore_onOverscrollRefreshUpdate(env, obj, delta); | |
| 1555 } | |
| 1556 | |
| 1557 void ContentViewCoreImpl::PullRelease(bool allow_refresh) { | |
| 1558 JNIEnv* env = AttachCurrentThread(); | |
| 1559 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1560 if (!obj.is_null()) { | |
| 1561 Java_ContentViewCore_onOverscrollRefreshRelease(env, obj, allow_refresh); | |
| 1562 } | |
| 1563 } | |
| 1564 | |
| 1565 void ContentViewCoreImpl::PullReset() { | |
| 1566 JNIEnv* env = AttachCurrentThread(); | |
| 1567 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1568 if (!obj.is_null()) | |
| 1569 Java_ContentViewCore_onOverscrollRefreshReset(env, obj); | |
| 1570 } | |
| 1571 | |
| 1572 // This is called for each ContentView. | 1542 // This is called for each ContentView. |
| 1573 jlong Init(JNIEnv* env, | 1543 jlong Init(JNIEnv* env, |
| 1574 const JavaParamRef<jobject>& obj, | 1544 const JavaParamRef<jobject>& obj, |
| 1575 const JavaParamRef<jobject>& jweb_contents, | 1545 const JavaParamRef<jobject>& jweb_contents, |
| 1576 const JavaParamRef<jobject>& jview_android_delegate, | 1546 const JavaParamRef<jobject>& jview_android_delegate, |
| 1577 jlong jwindow_android, | 1547 jlong jwindow_android, |
| 1578 jfloat dipScale, | 1548 jfloat dipScale, |
| 1579 const JavaParamRef<jobject>& retained_objects_set) { | 1549 const JavaParamRef<jobject>& retained_objects_set) { |
| 1580 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 1550 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
| 1581 WebContents::FromJavaWebContents(jweb_contents)); | 1551 WebContents::FromJavaWebContents(jweb_contents)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1608 return ScopedJavaLocalRef<jobject>(); | 1578 return ScopedJavaLocalRef<jobject>(); |
| 1609 | 1579 |
| 1610 return view->GetJavaObject(); | 1580 return view->GetJavaObject(); |
| 1611 } | 1581 } |
| 1612 | 1582 |
| 1613 bool RegisterContentViewCore(JNIEnv* env) { | 1583 bool RegisterContentViewCore(JNIEnv* env) { |
| 1614 return RegisterNativesImpl(env); | 1584 return RegisterNativesImpl(env); |
| 1615 } | 1585 } |
| 1616 | 1586 |
| 1617 } // namespace content | 1587 } // namespace content |
| OLD | NEW |