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

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

Issue 12567020: [android] Resize the android_webview if it's 0x0 initially. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java ('k') | no next file » | 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 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();
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698