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

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

Issue 2963573003: [TTS] Fix Bar text w/ selection modification (Closed)
Patch Set: Added usage of ContentViewCore.getSelectedText back again. Created 3 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
« no previous file with comments | « no previous file | no next file » | 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/ContextualSearchSelectionController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
index b241bae4005bba0ac12529c6398624bbd2224e7b..6060aeaf2342d3a2eb637af0ee899ab2659f253e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchSelectionController.java
@@ -58,6 +58,7 @@ public class ContextualSearchSelectionController {
private ContextualSearchTapState mLastTapState;
private boolean mIsWaitingForInvalidTapDetection;
private boolean mShouldHandleSelectionModification;
+ // Whether the selection was automatically expanded due to an adjustment (e.g. Resolve).
private boolean mDidExpandSelection;
// Position of the selection.
@@ -249,6 +250,8 @@ public class ContextualSearchSelectionController {
mWasTapGestureDetected = false;
mSelectionType = SelectionType.LONG_PRESS;
shouldHandleSelection = true;
+ ContentViewCore baseContentView = getBaseContentView();
+ if (baseContentView != null) mSelectedText = baseContentView.getSelectedText();
break;
case SelectionEventType.SELECTION_HANDLES_CLEARED:
mHandler.handleSelectionDismissal();
@@ -261,15 +264,10 @@ public class ContextualSearchSelectionController {
}
if (shouldHandleSelection) {
- ContentViewCore baseContentView = getBaseContentView();
- if (baseContentView != null) {
- String selection = baseContentView.getSelectedText();
- if (selection != null) {
- mX = posXPix;
- mY = posYPix;
- mSelectedText = selection;
- handleSelection(selection, SelectionType.LONG_PRESS);
- }
+ if (mSelectedText != null) {
+ mX = posXPix;
+ mY = posYPix;
+ handleSelection(mSelectedText, SelectionType.LONG_PRESS);
}
}
}
@@ -401,10 +399,7 @@ public class ContextualSearchSelectionController {
Tab currentTab = mActivity.getActivityTab();
if (currentTab == null) return null;
- ContentViewCore contentViewCore = currentTab.getContentViewCore();
- if (contentViewCore == null) return null;
-
- return contentViewCore.getWebContents();
+ return currentTab.getWebContents();
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698