Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1889)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java

Issue 1205033005: Adds selection expansion support for Contextual Search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8099d1beabc9bfdcd8c86cd79430628b08d24ae0..3ab00d15a501aa109620f483d4ba85c9c11e7fdf 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
@@ -653,18 +653,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.
+ * @param selectionEndAdjust The end offset adjustment of the selection to use to highlight
+ * the search term.
*/
@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.
@@ -707,6 +713,10 @@ public class ContextualSearchManager extends ContextualSearchObservable
mPolicy.logSearchTermResolutionDetails(searchTerm,
mNetworkCommunicator.getBasePageUrl());
}
+
+ if (selectionStartAdjust != 0 || selectionEndAdjust != 0) {
+ mSelectionController.adjustSelection(selectionStartAdjust, selectionEndAdjust);
pedro (no code reviews) 2015/06/25 01:30:28 Nit: Call it expandSelection() instead?
aurimas (slooooooooow) 2015/07/01 00:45:38 Done
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698