Chromium Code Reviews| 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() { |