Chromium Code Reviews| 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 49836b362d1dba52a4245c5d75fde9fa319dd296..b7c02b059f00cc7941ccdae175c62a29ba18eed5 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 |
| @@ -639,18 +639,24 @@ public class ContextualSearchManager extends ContextualSearchObservable |
| * @param searchTerm The term to use in our subsequent search. |
| * @param displayText The text to display in our UX. |
| * @param alternateTerm The alternate term to display on the results page. |
| + * @param selectionStartAdjust The start offset adjustment of the selection to use to highlight |
| + * the search term. |
|
pedro (no code reviews)
2015/07/01 22:18:56
I would add to make things clearer:
This number s
aurimas (slooooooooow)
2015/07/01 23:05:44
Done
|
| + * @param selectionEndAdjust The end offset adjustment of the selection to use to highlight |
| + * the search term. |
|
pedro (no code reviews)
2015/07/01 22:18:56
Same thing as above, but replacing "beginning" wit
aurimas (slooooooooow)
2015/07/01 23:05:44
Done
|
| */ |
| @CalledByNative |
| public void onSearchTermResolutionResponse(boolean isNetworkUnavailable, int responseCode, |
| final String searchTerm, final String displayText, final String alternateTerm, |
| - boolean doPreventPreload) { |
| + boolean doPreventPreload, int selectionStartAdjust, int selectionEndAdjust) { |
| mNetworkCommunicator.handleSearchTermResolutionResponse(isNetworkUnavailable, responseCode, |
| - searchTerm, displayText, alternateTerm, doPreventPreload); |
| + searchTerm, displayText, alternateTerm, doPreventPreload, selectionStartAdjust, |
| + selectionEndAdjust); |
| } |
| @Override |
| public void handleSearchTermResolutionResponse(boolean isNetworkUnavailable, int responseCode, |
| - String searchTerm, String displayText, String alternateTerm, boolean doPreventPreload) { |
| + String searchTerm, String displayText, String alternateTerm, boolean doPreventPreload, |
| + int selectionStartAdjust, int selectionEndAdjust) { |
| if (!mSearchPanelDelegate.isShowing()) return; |
| // Show an appropriate message for what to search for. |
| @@ -693,6 +699,10 @@ public class ContextualSearchManager extends ContextualSearchObservable |
| mPolicy.logSearchTermResolutionDetails(searchTerm, |
| mNetworkCommunicator.getBasePageUrl()); |
| } |
| + |
| + if (selectionStartAdjust != 0 || selectionEndAdjust != 0) { |
| + mSelectionController.expandSelection(selectionStartAdjust, selectionEndAdjust); |
| + } |
| } |
| /** |