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

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: Fixed java tests 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchNetworkCommunicator.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 64a356b0b717a9191f51f98a3ce7535fac6f5d63..2a9088717c3690c14b6d753183becf8d4c322422 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
@@ -645,18 +645,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.
@@ -699,6 +705,10 @@ public class ContextualSearchManager extends ContextualSearchObservable
mPolicy.logSearchTermResolutionDetails(searchTerm,
mNetworkCommunicator.getBasePageUrl());
}
+
+ if (selectionStartAdjust != 0 || selectionEndAdjust != 0) {
+ mSelectionController.adjustSelection(selectionStartAdjust, selectionEndAdjust);
+ }
}
/**
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchNetworkCommunicator.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698