[TTS] Add Smart Select support in Chrome

Desktop / Chromium - Donn Denman [google.com] - 7 October 2017 00:02 EDT

Adds a new class SelectionClientManager that manages the different possible SelectionClient configurations including the SmartSelectionClient and the ContextualSearchManager. The manager has a private bridge class that broadcasts messages to both the Smart-Select Selection Client and the Contextual Search Selection Client when they are both active. All the messy details of how to deal with optional and multiple selection clients and how to suppress one, are encapsulated in this class.

In the case where the user does a tap on an existing tap-selection and the selection pins are shown, we shift from CS-control to Smart-Select control of the selection. This turns out to be the best choice for the user and is a simpler implementation (see bug for details).

Initialization is somewhat changed -- SmartSelectionToggle is removed and the SmartSelectionClient decides whether or not to enable Smart Select for WebView. Tab works with the SelectionClientManager to enable the appropriate set of Selection Clients. There is a separate finch-controlled flag that allows disabling Smart Select in Chrome, and another to allow Contextual Search to still be fully active so we can handle the case where the Smart Selection feature is not fully activated.

This CL also does some minor cleanup, including making the Contextual Search Selection Client a subclass instead of having the ContextualSearchManager implement the interface itself.

Also does some trivial cleanup in a few files.

Still TODO: Add tests and metrics.

BUG=756241, 772467

Change-Id: I02f7de2b90ccd8e09334726351a9de639b3e8235 Reviewed-on: https://chromium-review.googlesource.com/679278 Commit-Queue: Donn Denman

35ecdc4 [TTS] Add Smart Select support in Chrome.
.../chromium/WebViewChromiumFactoryProvider.java | 2 -
.../org/chromium/android_webview/AwContents.java | 2 +
.../ContextualSearchFieldTrial.java | 34 +++-
.../contextualsearch/ContextualSearchManager.java | 150 +++++++++-------
.../ContextualSearchSelectionController.java | 3 +
.../ContextualSearchTabHelper.java | 71 +++++---
.../contextualsearch/SelectionClientManager.java | 190 +++++++++++++++++++++
chrome/android/java_sources.gni | 1 +
.../ContextualSearchManagerTest.java | 6 +-
.../ContextualSearchTapEventTest.java | 14 +-
content/public/android/BUILD.gn | 3 +-
.../chromium/content/browser/ContentViewCore.java | 12 +-
.../content/browser/SelectionPopupController.java | 16 +-
.../content/browser/SmartSelectionClient.java | 15 +-
.../content/browser/SmartSelectionProvider.java | 1 +
.../browser/SelectionClient.java | 20 ++-
.../browser/SmartSelectionToggle.java | 16 --
.../browser/ContentViewCoreSelectionTest.java | 1 +
.../browser/SelectionPopupControllerTest.java | 1 +
19 files changed, 421 insertions(+), 137 deletions(-)

Upstream: git.chromium.org


  • Share