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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 9af5dfd2eb52f755a899c31eb81700d60e57555c..f18b102aee9b5c4ea14a8f1b5cea6706460df7fa 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -494,6 +494,8 @@ public class ContentViewCore
private SelectPopup mSelectPopup;
private long mNativeSelectPopupSourceFrame = 0;
+ private OverscrollRefreshHandler mOverscrollRefreshHandler;
+
private Runnable mFakeMouseMoveRunnable = null;
// Only valid when focused on a text / password field.
@@ -871,6 +873,7 @@ public class ContentViewCore
try {
TraceEvent.begin("ContentViewCore.setContainerView");
if (mContainerView != null) {
+ assert mOverscrollRefreshHandler == null;
mPastePopupMenu = null;
mInputConnection = null;
hidePopupsAndClearSelection();
@@ -1002,6 +1005,7 @@ public class ContentViewCore
// in this class.
mContentViewClient = new ContentViewClient();
mWebContents = null;
+ mOverscrollRefreshHandler = null;
mNativeContentViewCore = 0;
mJavaScriptInterfaces.clear();
mRetainedJavaScriptObjects.clear();
@@ -2513,6 +2517,40 @@ public class ContentViewCore
return new PopupTouchHandleDrawable(mTouchHandleDelegate);
}
+ /**
+ * Initialize the view with an overscroll refresh handler.
+ * @param handler The refresh handler.
+ */
+ public void setOverscrollRefreshHandler(OverscrollRefreshHandler handler) {
+ assert mOverscrollRefreshHandler == null || handler == null;
+ mOverscrollRefreshHandler = handler;
+ }
+
+ @SuppressWarnings("unused")
+ @CalledByNative
+ private boolean onOverscrollRefreshStart() {
+ if (mOverscrollRefreshHandler == null) return false;
+ return mOverscrollRefreshHandler.start();
+ }
+
+ @SuppressWarnings("unused")
+ @CalledByNative
+ private void onOverscrollRefreshUpdate(float delta) {
+ if (mOverscrollRefreshHandler != null) mOverscrollRefreshHandler.pull(delta);
+ }
+
+ @SuppressWarnings("unused")
+ @CalledByNative
+ private void onOverscrollRefreshRelease(boolean allowRefresh) {
+ if (mOverscrollRefreshHandler != null) mOverscrollRefreshHandler.release(allowRefresh);
+ }
+
+ @SuppressWarnings("unused")
+ @CalledByNative
+ private void onOverscrollRefreshReset() {
+ if (mOverscrollRefreshHandler != null) mOverscrollRefreshHandler.reset();
+ }
+
@SuppressWarnings("unused")
@CalledByNative
private void onSelectionChanged(String text) {

Powered by Google App Engine
This is Rietveld 408576698