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

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: creis nits Created 5 years, 5 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 23e1e0547f16fe9b0803fa867600c60091901013..3cfd762d0d783c6c0ee0a321c324d65e48eee130 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
@@ -640,18 +640,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 A positive number of characters that the start of the existing
+ * selection should be expanded by.
+ * @param selectionEndAdjust A positive number of characters that the end of the existing
+ * selection should be expanded by.
*/
@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.
@@ -694,6 +700,10 @@ public class ContextualSearchManager extends ContextualSearchObservable
mPolicy.logSearchTermResolutionDetails(searchTerm,
mNetworkCommunicator.getBasePageUrl());
}
+
+ if (selectionStartAdjust != 0 || selectionEndAdjust != 0) {
+ mSelectionController.expandSelection(selectionStartAdjust, selectionEndAdjust);
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698