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

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

Issue 467303002: [Android] Perform haptic feedback after long press when appropriate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback with repeated long press Created 6 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 5ea4572ddeff44bd54b55882b2cded4f8f8627ea..084ca3092abc074189eb247bc81e1decf35cd38b 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
@@ -2133,7 +2133,7 @@ public class ContentViewCore
case SelectionEventType.INSERTION_MOVED:
if (mPastePopupMenu == null) break;
if (!isScrollInProgress() && mPastePopupMenu.isShowing()) {
- showPastePopup((int) posXDip, (int) posYDip);
+ showPastePopupIfAppropriate((int) posXDip, (int) posYDip);
} else {
hidePastePopup();
}
@@ -2143,7 +2143,7 @@ public class ContentViewCore
if (mWasPastePopupShowingOnInsertionDragStart)
hidePastePopup();
else
- showPastePopup((int) posXDip, (int) posYDip);
+ showPastePopupIfAppropriate((int) posXDip, (int) posYDip);
break;
case SelectionEventType.INSERTION_CLEARED:
@@ -2418,11 +2418,20 @@ public class ContentViewCore
@SuppressWarnings("unused")
@CalledByNative
private void showPastePopup(int xDip, int yDip) {
cjhopman 2014/08/14 00:12:28 This naming would make me expect that showPastePop
jdduke (slow) 2014/08/14 17:57:19 Done.
- if (!mHasInsertion || !canPaste()) return;
+ // TODO(jdduke): Remove this when there is a better signal that long press caused
+ // showing of the paste popup. See http://crbug.com/150151.
+ if (showPastePopupIfAppropriate(xDip, yDip)) {
+ mContainerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
+ }
+ }
+
+ private boolean showPastePopupIfAppropriate(int xDip, int yDip) {
+ if (!mHasInsertion || !canPaste()) return false;
final float contentOffsetYPix = mRenderCoordinates.getContentOffsetYPix();
getPastePopup().showAt(
(int) mRenderCoordinates.fromDipToPix(xDip),
(int) (mRenderCoordinates.fromDipToPix(yDip) + contentOffsetYPix));
+ return true;
}
private PastePopupMenu getPastePopup() {

Powered by Google App Engine
This is Rietveld 408576698