New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 770502 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
(OOO slow)
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocked on:
issue 774296



Sign in to add a comment

[TTS] Access the Context and Selection using common WebView code

Project Member Reported by donnd@google.com, Sep 30 2017

Issue description

We have duplication of code that accesses surrounding text and expands the selection between Smart Select and Contextual Search.  Since Smart Select needs to be supported in WebView it makes sense for Contextual Search to switch to using the Smart Select mechanisms.

Related to issue 756241.
 

Comment 1 by ctzsm@chromium.org, Oct 1 2017

Actually I am considering to move get surrounding text logic to showSelectionMenu() call in SelectionPopupController (Issue 769949), will that affect this issue?

Comment 2 by donnd@google.com, Oct 2 2017

> I am considering ... will that affect this issue?
This issue is a long-term refactoring task so don't worry about your changes impacting it!
Project Member

Comment 3 by bugdroid1@chromium.org, Oct 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/708197db129edcea4501ba1d62bdc16f8e4bb660

commit 708197db129edcea4501ba1d62bdc16f8e4bb660
Author: Donn Denman <donnd@google.com>
Date: Thu Oct 12 21:28:57 2017

[TTS] Fix a race with Smart Selection.

Introduces a fix for  issue 773330  where gathering
surrounding text on the page is requested multiple times
but only a single call is supported.

Disables the gathering of surrounding text for longpress
when Smart Selection is active. Instead we send just the
current selection to icing for the assistant to use.

Also fix a logic error in whether surrounding text can be
sent to icing or not.

BUG= 773330 , 770502

Change-Id: I752271efecb27d931d3fc25d46a4d66ad9649875
Reviewed-on: https://chromium-review.googlesource.com/714378
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Theresa <twellington@chromium.org>
Commit-Queue: Donn Denman <donnd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#508480}
[modify] https://crrev.com/708197db129edcea4501ba1d62bdc16f8e4bb660/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchContext.java
[modify] https://crrev.com/708197db129edcea4501ba1d62bdc16f8e4bb660/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java
[modify] https://crrev.com/708197db129edcea4501ba1d62bdc16f8e4bb660/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java
[modify] https://crrev.com/708197db129edcea4501ba1d62bdc16f8e4bb660/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java
[modify] https://crrev.com/708197db129edcea4501ba1d62bdc16f8e4bb660/content/public/android/java/src/org/chromium/content_public/browser/WebContents.java

Comment 4 by donnd@google.com, Oct 12 2017

I'm thinking that if we used Mojo for communication from Blink to the embedder we wouldn't have the race condition that required the workaround done in #3 whose impact is "the Google Assistant might be affected in a minor way -- instead of getting about 400 chars of context from the page it will just get the selection, along with the regular data.  The regular data includes page title and URL -- the URL should allow attachment of entities similar to what was done with the full surrounding text." 

Comment 5 by donnd@google.com, Oct 12 2017

Cc: amaralp@chromium.org
Pedro, what do you think about using Mojo for communication from Blink to the embedder so we wouldn't have the race condition?
Blockedon: 774296
The plan is for Smart Selection to not use the surrounding text IPC.

Eventually the surrounding text will be passed as a parameter to showSelectionMenu() which will remove the need to do a round trip to Blink (see crbug.com/774296). This should fix the race condition since only Contextual Search will be using the request surrounding text IPC.

Sign in to add a comment