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..a4b432a5a55ce46aa852b200c1a3a3a2e86145aa 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,19 @@ 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 (!mInternalStateController.isStillWorkingOn(InternalState.START_SHOWING_TAP_UI)) { |
+ 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 +1307,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 +1314,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 { |