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 24900f2d9685347b0d0f6ad09601b41484517164..11780a1772ea3eb239109dcb2021c572e1ef147c 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 |
@@ -163,21 +163,24 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
} |
/** |
- * Interface for subscribing to content size changes. |
+ * An interface that allows the embedder to be notified when the pinch gesture starts and |
+ * stops. |
*/ |
- public static interface ContentSizeChangeListener { |
+ public static interface PinchGestureStateListener { |
/** |
- * Called when the content size changes. |
- * The containing view may want to adjust its size to match the content. |
+ * Called when the pinch gesture starts. |
*/ |
- void onContentSizeChanged(int contentWidthPix, int contentHeightPix); |
+ void onPinchGestureStart(); |
+ /** |
+ * Called when the pinch gesture ends. |
+ */ |
+ void onPinchGestureEnd(); |
} |
private final Context mContext; |
private ViewGroup mContainerView; |
private InternalAccessDelegate mContainerViewInternals; |
private WebContentsObserverAndroid mWebContentsObserver; |
- private ContentSizeChangeListener mContentSizeChangeListener; |
private ContentViewClient mContentViewClient; |
@@ -189,6 +192,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
private boolean mAttachedToWindow = false; |
private ContentViewGestureHandler mContentViewGestureHandler; |
+ private PinchGestureStateListener mPinchGestureStateListener; |
private ZoomManager mZoomManager; |
private PopupZoomer mPopupZoomer; |
@@ -696,10 +700,6 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
return mContentViewClient; |
} |
- public void setContentSizeChangeListener(ContentSizeChangeListener listener) { |
- mContentSizeChangeListener = listener; |
- } |
- |
public int getBackgroundColor() { |
if (mNativeContentViewCore != 0) { |
return nativeGetBackgroundColor(mNativeContentViewCore); |
@@ -1054,6 +1054,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
public boolean sendGesture(int type, long timeMs, int x, int y, Bundle b) { |
if (mNativeContentViewCore == 0) return false; |
updateTextHandlesForGesture(type); |
+ updatePinchGestureStateListener(type); |
switch (type) { |
case ContentViewGestureHandler.GESTURE_SHOW_PRESSED_STATE: |
nativeShowPressState(mNativeContentViewCore, timeMs, x, y); |
@@ -1112,6 +1113,25 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
} |
} |
+ public void setPinchGestureStateListener(PinchGestureStateListener pinchGestureStateListener) { |
+ mPinchGestureStateListener = pinchGestureStateListener; |
+ } |
+ |
+ void updatePinchGestureStateListener(int gestureType) { |
+ if (mPinchGestureStateListener == null) return; |
+ |
+ switch (gestureType) { |
+ case ContentViewGestureHandler.GESTURE_PINCH_BEGIN: |
+ mPinchGestureStateListener.onPinchGestureStart(); |
+ break; |
+ case ContentViewGestureHandler.GESTURE_PINCH_END: |
+ mPinchGestureStateListener.onPinchGestureEnd(); |
+ break; |
+ default: |
+ break; |
+ } |
+ } |
+ |
public interface JavaScriptCallback { |
void handleJavaScriptResult(String jsonResult); |
} |
@@ -2029,17 +2049,6 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
pageScaleFactor, minPageScaleFactor, maxPageScaleFactor, |
contentOffsetYPix); |
- if (contentSizeChanged) { |
- getContentViewClient().onContentSizeChanged( |
- mRenderCoordinates.getContentWidthCss(), |
- mRenderCoordinates.getContentHeightCss()); |
- if (mContentSizeChangeListener != null) { |
- mContentSizeChangeListener.onContentSizeChanged( |
- mRenderCoordinates.getContentWidthPixInt(), |
- mRenderCoordinates.getContentHeightPixInt()); |
- } |
- } |
- |
if (needTemporarilyHideHandles) temporarilyHideTextHandles(); |
if (needUpdateZoomControls) mZoomManager.updateZoomControls(); |
if (contentOffsetChanged) updateHandleScreenPositions(); |