Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
index 4426bcfdaa3a46cb27256b8f517fc864ee941c9a..62fb7bdcf1cb9aa9530932b09a56857de31a8b26 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java |
@@ -1210,7 +1210,20 @@ public class ContextualSearchManager implements ContextualSearchManagementDelega |
return false; |
} |
- // TODO(donnd): add handling of an ACK to selectWordAroundCaret (crbug.com/435778 has details). |
+ @Override |
+ public void selectWordAroundCaretAck(boolean didSelect, int startAdjust, int endAdjust) { |
+ if (isOverlayVideoMode() |
aelias_OOO_until_Jul13
2017/04/27 22:01:27
Is this needed? The request is already suppressed
Donn Denman
2017/04/28 20:28:00
Done.
|
+ || !mInternalStateController.isStillWorkingOn(InternalState.START_SHOWING_TAP_UI)) { |
aelias_OOO_until_Jul13
2017/04/27 22:01:27
This early-return also looks a bit sketchy. Gener
Donn Denman
2017/04/28 20:28:00
I *think* we want to leave this isStillWorkingOn()
aelias_OOO_until_Jul13
2017/04/28 20:55:29
It doesn't fully make sense to me. If the ack sho
Donn Denman
2017/04/28 21:54:41
We have a simple model where we only work on the m
aelias_OOO_until_Jul13
2017/04/28 22:14:33
Counterpoints:
- I don't agree with the claim of
|
+ return; |
+ } |
+ |
+ if (didSelect) { |
+ assert mContext != null; |
+ mContext.onSelectionAdjusted(startAdjust, endAdjust); |
+ showSelectionAsSearchInBar(mSelectionController.getSelectedText()); |
+ } |
+ mInternalStateController.notifyFinishedWorkOn(InternalState.START_SHOWING_TAP_UI); |
+ } |
/** |
* @return Whether the display is in a full-screen video overlay mode. |
@@ -1295,9 +1308,6 @@ public class ContextualSearchManager implements ContextualSearchManagementDelega |
if (!selection.isEmpty()) { |
ContextualSearchUma.logSelectionIsValid(selectionValid); |
- // Update the context so it knows the selection has changed. |
- if (mContext != null) mContext.updateContextFromSelection(selection); |
- |
if (selectionValid && mSearchPanel != null) { |
mSearchPanel.updateBasePageSelectionYPx(y); |
if (!mSearchPanel.isShowing()) { |
@@ -1305,12 +1315,7 @@ public class ContextualSearchManager implements ContextualSearchManagementDelega |
} |
showSelectionAsSearchInBar(selection); |
- // TODO(donnd): remove this complication when we get an ACK message from |
- // selectWordAroundCaret (see crbug.com/435778). |
- if (type == SelectionType.TAP) { |
- mInternalStateController.notifyFinishedWorkOn( |
- InternalState.START_SHOWING_TAP_UI); |
- } else { |
+ if (type == SelectionType.LONG_PRESS) { |
mInternalStateController.enter(InternalState.LONG_PRESS_RECOGNIZED); |
} |
} else { |