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 20b30d8f89db3f086671e52db70fc0f1a5a24208..3b9fe6371ecbbe451c254a4b23a34990fd1915cf 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 |
@@ -181,6 +181,24 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
void onPinchGestureEnd(); |
} |
+ /** |
+ * An interface for controlling visibility and state of embedder-provided zoom controls. |
+ */ |
+ public static interface ZoomControlsDelegate { |
joth
2013/05/03 19:32:43
nit: I think static is spurious here? (didn't know
mnaganov (inactive)
2013/05/07 09:55:44
I've copied it from the two interfaces above. Acco
|
+ /** |
+ * 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. |
+ */ |
+ void updateZoomControls(); |
+ } |
+ |
private VSyncManager.Provider mVSyncProvider; |
private VSyncManager.Listener mVSyncListener; |
private int mVSyncSubscriberCount; |
@@ -276,6 +294,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
private ContentViewGestureHandler mContentViewGestureHandler; |
private PinchGestureStateListener mPinchGestureStateListener; |
private ZoomManager mZoomManager; |
+ private ZoomControlsDelegate mZoomControlsDelegate; |
private PopupZoomer mPopupZoomer; |
@@ -655,8 +674,15 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
} |
mZoomManager = new ZoomManager(mContext, this); |
- mZoomManager.updateMultiTouchSupport(); |
mContentViewGestureHandler = new ContentViewGestureHandler(mContext, this, mZoomManager); |
+ mZoomControlsDelegate = new ZoomControlsDelegate() { |
benm (inactive)
2013/05/03 16:01:12
nit: maybe just add a comment to say that by defau
mnaganov (inactive)
2013/05/03 16:09:52
I think, it is more correct say that Chrome for An
|
+ @Override |
+ public void invokeZoomPicker() {} |
+ @Override |
+ public void dismissZoomPicker() {} |
+ @Override |
+ public void updateZoomControls() {} |
+ }; |
mRenderCoordinates.reset(); |
@@ -1367,9 +1393,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
} |
setAccessibilityState(false); |
hidePopupDialog(); |
- if (mContentSettings != null && mContentSettings.supportZoom()) { |
- mZoomManager.dismissZoomPicker(); |
- } |
+ mZoomControlsDelegate.dismissZoomPicker(); |
} |
/** |
@@ -1377,9 +1401,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
*/ |
public void onVisibilityChanged(View changedView, int visibility) { |
if (visibility != View.VISIBLE) { |
- if (mContentSettings.supportZoom()) { |
- mZoomManager.dismissZoomPicker(); |
- } |
+ mZoomControlsDelegate.dismissZoomPicker(); |
} |
} |
@@ -1781,12 +1803,12 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
} |
} |
- void updateMultiTouchZoomSupport() { |
- mZoomManager.updateMultiTouchSupport(); |
+ public void setZoomControlsDelegate(ZoomControlsDelegate zoomControlsDelegate) { |
+ mZoomControlsDelegate = zoomControlsDelegate; |
} |
- public boolean isMultiTouchZoomSupported() { |
- return mZoomManager.isMultiTouchZoomSupported(); |
+ public void updateMultiTouchZoomSupport(boolean supportsMultiTouchZoom) { |
+ mZoomManager.updateMultiTouchSupport(supportsMultiTouchZoom); |
} |
public void selectPopupMenuItems(int[] indices) { |
@@ -2160,7 +2182,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
contentOffsetYPix); |
if (needTemporarilyHideHandles) temporarilyHideTextHandles(); |
- if (needUpdateZoomControls) mZoomManager.updateZoomControls(); |
+ if (needUpdateZoomControls) mZoomControlsDelegate.updateZoomControls(); |
if (contentOffsetChanged) updateHandleScreenPositions(); |
// Update offsets for fullscreen. |
@@ -2445,15 +2467,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient { |
*/ |
@Override |
public void invokeZoomPicker() { |
- if (mContentSettings != null && mContentSettings.supportZoom()) { |
- mZoomManager.invokeZoomPicker(); |
- } |
- } |
- |
- // Unlike legacy WebView getZoomControls which returns external zoom controls, |
- // this method returns built-in zoom controls. This method is used in tests. |
- public View getZoomControlsForTest() { |
- return mZoomManager.getZoomControlsViewForTest(); |
+ mZoomControlsDelegate.invokeZoomPicker(); |
joth
2013/05/03 19:32:43
feels like pulling at a bit of string here, but..
mnaganov (inactive)
2013/05/07 09:55:44
Yes, I was also considering that. Decided to keep
|
} |
/** |