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

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

Issue 894193005: [Android] Use the platform SwipeRefreshLayout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 8 months 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 "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 env, obj.obj(), jtext.obj(), jhtml.obj(), clip_rect_object.obj()); 1403 env, obj.obj(), jtext.obj(), jhtml.obj(), clip_rect_object.obj());
1404 } 1404 }
1405 1405
1406 void ContentViewCoreImpl::WebContentsDestroyed() { 1406 void ContentViewCoreImpl::WebContentsDestroyed() {
1407 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( 1407 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>(
1408 static_cast<WebContentsImpl*>(web_contents())->GetView()); 1408 static_cast<WebContentsImpl*>(web_contents())->GetView());
1409 DCHECK(wcva); 1409 DCHECK(wcva);
1410 wcva->SetContentViewCore(NULL); 1410 wcva->SetContentViewCore(NULL);
1411 } 1411 }
1412 1412
1413 bool ContentViewCoreImpl::PullStart() {
1414 JNIEnv* env = AttachCurrentThread();
1415 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1416 if (!obj.is_null())
1417 return Java_ContentViewCore_onOverscrollRefreshStart(env, obj.obj());
1418 return false;
1419 }
1420
1421 void ContentViewCoreImpl::PullUpdate(float delta) {
1422 JNIEnv* env = AttachCurrentThread();
1423 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1424 if (!obj.is_null())
1425 Java_ContentViewCore_onOverscrollRefreshUpdate(env, obj.obj(), delta);
1426 }
1427
1428 void ContentViewCoreImpl::PullRelease(bool allow_refresh) {
1429 JNIEnv* env = AttachCurrentThread();
1430 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1431 if (!obj.is_null()) {
1432 Java_ContentViewCore_onOverscrollRefreshRelease(env, obj.obj(),
1433 allow_refresh);
1434 }
1435 }
1436
1437 void ContentViewCoreImpl::PullReset() {
1438 JNIEnv* env = AttachCurrentThread();
1439 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1440 if (!obj.is_null())
1441 Java_ContentViewCore_onOverscrollRefreshReset(env, obj.obj());
1442 }
1443
1413 // This is called for each ContentView. 1444 // This is called for each ContentView.
1414 jlong Init(JNIEnv* env, 1445 jlong Init(JNIEnv* env,
1415 jobject obj, 1446 jobject obj,
1416 jobject web_contents, 1447 jobject web_contents,
1417 jobject view_android_delegate, 1448 jobject view_android_delegate,
1418 jlong window_android, 1449 jlong window_android,
1419 jobject retained_objects_set) { 1450 jobject retained_objects_set) {
1420 ContentViewCoreImpl* view = new ContentViewCoreImpl( 1451 ContentViewCoreImpl* view = new ContentViewCoreImpl(
1421 env, obj, WebContents::FromJavaWebContents(web_contents), 1452 env, obj, WebContents::FromJavaWebContents(web_contents),
1422 view_android_delegate, 1453 view_android_delegate,
(...skipping 15 matching lines...) Expand all
1438 return NULL; 1469 return NULL;
1439 1470
1440 return view->GetJavaObject().Release(); 1471 return view->GetJavaObject().Release();
1441 } 1472 }
1442 1473
1443 bool RegisterContentViewCore(JNIEnv* env) { 1474 bool RegisterContentViewCore(JNIEnv* env) {
1444 return RegisterNativesImpl(env); 1475 return RegisterNativesImpl(env);
1445 } 1476 }
1446 1477
1447 } // namespace content 1478 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/android/overscroll_controller_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698