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

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

Issue 15029006: Make it possible for the scroll offset delegate to intercept fling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reactivate the patch! Created 7 years, 5 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
« no previous file with comments | « content/port/browser/render_widget_host_view_port.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d9e0d77b1061fdcefa7c1225ea7081c0270a3b52..bbaecb042f3589820c14b3a512a58ef311785177 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
@@ -182,15 +182,26 @@ import java.util.Map;
* An interface that allows the embedder to be notified when the pinch gesture starts and
* stops.
*/
- public interface PinchGestureStateListener {
+ public interface GestureStateListener {
/**
* Called when the pinch gesture starts.
*/
void onPinchGestureStart();
+
/**
* Called when the pinch gesture ends.
*/
void onPinchGestureEnd();
+
+ /**
+ * Called when the fling gesture starts.
+ */
+ void onFlingStartGestureStart(int vx, int vy);
+
+ /**
+ * Called when a fling event was not handled by the renderer.
+ */
+ void onUnhandledFlingStartEvent();
}
/**
@@ -201,10 +212,12 @@ import java.util.Map;
* Called when it's reasonable to show zoom controls.
*/
void invokeZoomPicker();
+
/**
* Called when zoom controls need to be hidden (e.g. when the view hides).
*/
void dismissZoomPicker();
+
/**
* Called when page scale has been changed, so the controls can update their state.
*/
@@ -332,7 +345,7 @@ import java.util.Map;
private boolean mAttachedToWindow = false;
private ContentViewGestureHandler mContentViewGestureHandler;
- private PinchGestureStateListener mPinchGestureStateListener;
+ private GestureStateListener mGestureStateListener;
private UpdateFrameInfoListener mUpdateFrameInfoListener;
private ZoomManager mZoomManager;
private ZoomControlsDelegate mZoomControlsDelegate;
@@ -1216,13 +1229,21 @@ import java.util.Map;
mContentViewGestureHandler.confirmTouchEvent(ackResult);
}
+ @SuppressWarnings("unused")
+ @CalledByNative
+ private void unhandledFlingStartEvent() {
+ if (mGestureStateListener != null) {
+ mGestureStateListener.onUnhandledFlingStartEvent();
+ }
+ }
+
@Override
public boolean sendGesture(int type, long timeMs, int x, int y, boolean lastInputEventForVSync,
Bundle b) {
if (offerGestureToEmbedder(type)) return false;
if (mNativeContentViewCore == 0) return false;
updateTextHandlesForGesture(type);
- updatePinchGestureStateListener(type);
+ updateGestureStateListener(type, b);
if (lastInputEventForVSync && isVSyncNotificationEnabled()) {
assert type == ContentViewGestureHandler.GESTURE_SCROLL_BY ||
type == ContentViewGestureHandler.GESTURE_PINCH_BY;
@@ -1291,20 +1312,24 @@ import java.util.Map;
}
}
- public void setPinchGestureStateListener(PinchGestureStateListener pinchGestureStateListener) {
- mPinchGestureStateListener = pinchGestureStateListener;
+ public void setGestureStateListener(GestureStateListener pinchGestureStateListener) {
+ mGestureStateListener = pinchGestureStateListener;
}
- void updatePinchGestureStateListener(int gestureType) {
- if (mPinchGestureStateListener == null) return;
+ void updateGestureStateListener(int gestureType, Bundle b) {
+ if (mGestureStateListener == null) return;
switch (gestureType) {
case ContentViewGestureHandler.GESTURE_PINCH_BEGIN:
- mPinchGestureStateListener.onPinchGestureStart();
+ mGestureStateListener.onPinchGestureStart();
break;
case ContentViewGestureHandler.GESTURE_PINCH_END:
- mPinchGestureStateListener.onPinchGestureEnd();
+ mGestureStateListener.onPinchGestureEnd();
break;
+ case ContentViewGestureHandler.GESTURE_FLING_START:
+ mGestureStateListener.onFlingStartGestureStart(
+ b.getInt(ContentViewGestureHandler.VELOCITY_X, 0),
+ b.getInt(ContentViewGestureHandler.VELOCITY_Y, 0));
default:
break;
}
« no previous file with comments | « content/port/browser/render_widget_host_view_port.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698