Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 2528823002: Separate SwipeRefreshHandler and ContentViewCore (Closed)
Patch Set: Make boliu's requested changes Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 clip_rect_object); 1539 clip_rect_object);
1540 } 1540 }
1541 1541
1542 void ContentViewCoreImpl::WebContentsDestroyed() { 1542 void ContentViewCoreImpl::WebContentsDestroyed() {
1543 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( 1543 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>(
1544 static_cast<WebContentsImpl*>(web_contents())->GetView()); 1544 static_cast<WebContentsImpl*>(web_contents())->GetView());
1545 DCHECK(wcva); 1545 DCHECK(wcva);
1546 wcva->SetContentViewCore(NULL); 1546 wcva->SetContentViewCore(NULL);
1547 } 1547 }
1548 1548
1549 bool ContentViewCoreImpl::PullStart() {
1550 JNIEnv* env = AttachCurrentThread();
1551 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1552 if (!obj.is_null())
1553 return Java_ContentViewCore_onOverscrollRefreshStart(env, obj);
1554 return false;
1555 }
1556
1557 void ContentViewCoreImpl::PullUpdate(float delta) {
1558 JNIEnv* env = AttachCurrentThread();
1559 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1560 if (!obj.is_null())
1561 Java_ContentViewCore_onOverscrollRefreshUpdate(env, obj, delta);
1562 }
1563
1564 void ContentViewCoreImpl::PullRelease(bool allow_refresh) {
1565 JNIEnv* env = AttachCurrentThread();
1566 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1567 if (!obj.is_null()) {
1568 Java_ContentViewCore_onOverscrollRefreshRelease(env, obj, allow_refresh);
1569 }
1570 }
1571
1572 void ContentViewCoreImpl::PullReset() {
1573 JNIEnv* env = AttachCurrentThread();
1574 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1575 if (!obj.is_null())
1576 Java_ContentViewCore_onOverscrollRefreshReset(env, obj);
1577 }
1578
1579 // This is called for each ContentView. 1549 // This is called for each ContentView.
1580 jlong Init(JNIEnv* env, 1550 jlong Init(JNIEnv* env,
1581 const JavaParamRef<jobject>& obj, 1551 const JavaParamRef<jobject>& obj,
1582 const JavaParamRef<jobject>& jweb_contents, 1552 const JavaParamRef<jobject>& jweb_contents,
1583 const JavaParamRef<jobject>& jview_android_delegate, 1553 const JavaParamRef<jobject>& jview_android_delegate,
1584 jlong jwindow_android, 1554 jlong jwindow_android,
1585 jfloat dipScale, 1555 jfloat dipScale,
1586 const JavaParamRef<jobject>& retained_objects_set) { 1556 const JavaParamRef<jobject>& retained_objects_set) {
1587 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( 1557 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
1588 WebContents::FromJavaWebContents(jweb_contents)); 1558 WebContents::FromJavaWebContents(jweb_contents));
(...skipping 26 matching lines...) Expand all
1615 return ScopedJavaLocalRef<jobject>(); 1585 return ScopedJavaLocalRef<jobject>();
1616 1586
1617 return view->GetJavaObject(); 1587 return view->GetJavaObject();
1618 } 1588 }
1619 1589
1620 bool RegisterContentViewCore(JNIEnv* env) { 1590 bool RegisterContentViewCore(JNIEnv* env) {
1621 return RegisterNativesImpl(env); 1591 return RegisterNativesImpl(env);
1622 } 1592 }
1623 1593
1624 } // namespace content 1594 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698