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

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

Issue 10828427: Add a view to show magnified link preview on Andrdoid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit fixed. Created 8 years, 4 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 09ac6d47356a3091707ecbe342bfc5b1a6c68c24..5f6c6c3a178fdbe108881ab78fdc7ddd0eacffa0 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
@@ -24,15 +24,14 @@ import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.base.WeakContext;
import org.chromium.content.app.AppResource;
+import org.chromium.content.browser.accessibility.AccessibilityInjector;
import org.chromium.content.browser.ContentViewGestureHandler;
+import org.chromium.content.browser.ContentViewGestureHandler.MotionEventDelegate;
import org.chromium.content.browser.TouchPoint;
import org.chromium.content.browser.ZoomManager;
import org.chromium.content.common.CleanupReference;
import org.chromium.content.common.TraceEvent;
-import org.chromium.content.browser.accessibility.AccessibilityInjector;
-import org.chromium.content.browser.ContentViewGestureHandler.MotionEventDelegate;
-
/**
* Provides a Java-side 'wrapper' around a WebContent (native) instance.
* Contains all the major functionality necessary to manage the lifecycle of a ContentView without
@@ -163,6 +162,8 @@ public class ContentViewCore implements MotionEventDelegate {
private float mNativeMinimumScale = 1.0f;
private float mNativeMaximumScale = 1.0f;
+ private PopupZoomer mPopupZoomer;
+
// TODO(klobag): this is to avoid a bug in GestureDetector. With multi-touch,
// mAlwaysInTapRegion is not reset. So when the last finger is up, onSingleTapUp()
// will be mistakenly fired.
@@ -295,9 +296,38 @@ public class ContentViewCore implements MotionEventDelegate {
mZoomManager.updateMultiTouchSupport();
mContentViewGestureHandler = new ContentViewGestureHandler(context, this, mZoomManager);
+ initPopupZoomer(mContext);
+
Log.i(TAG, "mNativeContentView=0x"+ Integer.toHexString(mNativeContentViewCore));
}
+ private void initPopupZoomer(Context context){
+ assert AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS != 0;
+ mPopupZoomer = new PopupZoomer(context, AppResource.DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS);
+ mContainerView.addView(mPopupZoomer);
+ PopupZoomer.OnTapListener listener = new PopupZoomer.OnTapListener() {
+ @Override
+ public boolean onSingleTap(View v, MotionEvent e) {
+ mContainerView.requestFocus();
+ if (mNativeContentViewCore != 0) {
+ nativeSingleTap(mNativeContentViewCore, e.getEventTime(), (int) e.getX(),
+ (int) e.getY(), true);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onLongPress(View v, MotionEvent e) {
+ if (mNativeContentViewCore != 0) {
+ nativeLongPress(mNativeContentViewCore, e.getEventTime(), (int) e.getX(),
+ (int) e.getY(), true);
+ }
+ return true;
+ }
+ };
+ mPopupZoomer.setOnTapListener(listener);
+ }
+
/**
* @return Whether the configured personality of this ContentView is {@link #PERSONALITY_VIEW}.
*/
@@ -702,6 +732,8 @@ public class ContentViewCore implements MotionEventDelegate {
//TODO(yusufo):Upstream the rest of the bits about handlerControllers.
if (!mContainerView.isFocused()) mContainerView.requestFocus();
+ if (!mPopupZoomer.isShowing()) mPopupZoomer.setLastTouch(x, y);
+
if (isLongPress) {
if (mNativeContentViewCore != 0) {
nativeLongPress(mNativeContentViewCore, timeMs, x, y, false);
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/android/java/src/org/chromium/content/browser/PopupZoomer.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698