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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/action/ResolvedSearchAction.java

Issue 2211353002: [TTS] Gather surrounding text on Tap before any UX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split usage of the Tapped text from the SearchAction into a separate CL. Created 4 years, 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.contextualsearch.action;
6
7 import android.text.TextUtils;
8
9 import org.chromium.chrome.browser.contextualsearch.gesture.SearchGestureHost;
10
11 /**
12 * Represents a Search Action that will gather and examine surrounding text in o rder to
13 * "resolve" what to search for.
14 */
15 public class ResolvedSearchAction extends SearchAction {
Theresa 2016/08/16 15:41:49 Right now this class is just being used to extract
Donn Denman 2016/08/17 04:35:22 Correct. Added your nice description to the heade
16 // ========================================================================= ===================
17 // Constructor
18 // ========================================================================= ===================
19
20 public ResolvedSearchAction(SearchActionListener listener) {
21 super(listener);
22 }
23
24 // ========================================================================= ===================
25 // Abstract implementations
26 // ========================================================================= ===================
27
28 @Override
29 public void extractContext(SearchGestureHost host) {
30 updateState(host);
pedro (no code reviews) 2016/08/22 20:54:17 Why is updateState() being exposed? I think it sho
Donn Denman 2016/08/23 23:21:46 Something needs to set the host, and I wondered wh
31 requestSurroundingText();
32 }
33
34 // ========================================================================= ===================
35 // State handling
36 // ========================================================================= ===================
37
38 @Override
39 protected void onSurroundingTextResponse(String surroundingTextSample, int s ampleStart,
40 int focusStart, int focusEnd, int focusedWordStart, int focusedWordE nd) {
41 super.onSurroundingTextResponse(surroundingTextSample, sampleStart, focu sStart, focusEnd,
42 focusedWordStart, focusedWordEnd);
43
44 String focusedWord = getFocusedWord();
45 if (!TextUtils.isEmpty(focusedWord) && focusStart == focusEnd) {
46 notifyContextReady();
47 } else {
48 dismissAction();
49 }
50 }
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698