| Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
|
| index 9bb6567fd544394b4bcb0358083d13f0c319b7e7..ff4e32fac1396f8472eb8ce56ce9a21a59b6d824 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
|
| @@ -79,6 +79,10 @@ public class ContextualSearchSelectionController {
|
| // The time of the most last scroll activity, or 0 if none.
|
| private long mLastScrollTimeNs;
|
|
|
| + // Tracks whether a Context Menu has just been shown and the UX has been dismissed.
|
| + // The selection may be unreliable until the next reset. See crbug.com/628436.
|
| + private boolean mIsContextMenuShown;
|
| +
|
| private class ContextualSearchGestureStateListener extends GestureStateListener {
|
| @Override
|
| public void onScrollStarted(int scrollOffsetY, int scrollExtentY) {
|
| @@ -144,6 +148,16 @@ public class ContextualSearchSelectionController {
|
| }
|
|
|
| /**
|
| + * Notifies that a Context Menu has been shown.
|
| + * Future controller events may be unreliable until the next reset.
|
| + */
|
| + void onContextMenuShown() {
|
| + // Hide the UX.
|
| + mHandler.handleSelectionDismissal();
|
| + mIsContextMenuShown = true;
|
| + }
|
| +
|
| + /**
|
| * Notifies that the Contextual Search has ended.
|
| * @param reason The reason for ending the Contextual Search.
|
| */
|
| @@ -286,11 +300,14 @@ public class ContextualSearchSelectionController {
|
| boolean shouldHandleSelection = false;
|
| switch (eventType) {
|
| case SelectionEventType.SELECTION_HANDLES_SHOWN:
|
| - mWasTapGestureDetected = false;
|
| - mSelectionType = SelectionType.LONG_PRESS;
|
| - shouldHandleSelection = true;
|
| - // Since we're showing pins, we don't care if the previous tap was invalid anymore.
|
| - unscheduleInvalidTapNotification();
|
| + if (!mIsContextMenuShown) {
|
| + mWasTapGestureDetected = false;
|
| + mSelectionType = SelectionType.LONG_PRESS;
|
| + shouldHandleSelection = true;
|
| + // Since we're showing pins, we don't care if the previous tap was invalid
|
| + // anymore.
|
| + unscheduleInvalidTapNotification();
|
| + }
|
| break;
|
| case SelectionEventType.SELECTION_HANDLES_CLEARED:
|
| mHandler.handleSelectionDismissal();
|
| @@ -341,6 +358,7 @@ public class ContextualSearchSelectionController {
|
| resetSelectionStates();
|
| mWasLastTapValid = false;
|
| mLastScrollTimeNs = 0;
|
| + mIsContextMenuShown = false;
|
| }
|
|
|
| /**
|
|
|