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

Unified Diff: chrome/browser/android/contextualsearch/contextual_search_delegate.h

Issue 2351283002: [TTS] Decode Now on Tap results for v1 integration. (Closed)
Patch Set: Created 4 years, 3 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
Index: chrome/browser/android/contextualsearch/contextual_search_delegate.h
diff --git a/chrome/browser/android/contextualsearch/contextual_search_delegate.h b/chrome/browser/android/contextualsearch/contextual_search_delegate.h
index ae5946d4bdd1034fe5593ccc6d0ac8c1e0e2203b..3c34a83433811ec6afa520d1780a722496f51c2e 100644
--- a/chrome/browser/android/contextualsearch/contextual_search_delegate.h
+++ b/chrome/browser/android/contextualsearch/contextual_search_delegate.h
@@ -62,7 +62,8 @@ class ContextualSearchDelegate
TemplateURLService* template_url_service,
const SearchTermResolutionCallback& search_term_callback,
const SurroundingTextCallback& surrounding_callback,
- const IcingCallback& icing_callback);
+ const IcingCallback& icing_callback,
+ std::unique_ptr<ContextualSearchFieldTrial> field_trial);
~ContextualSearchDelegate() override;
// Gathers surrounding text and starts an asynchronous search term resolution
@@ -114,6 +115,8 @@ class ContextualSearchDelegate
FRIEND_TEST_ALL_PREFIXES(ContextualSearchDelegateTest,
DecodeSearchTermFromJsonResponse);
FRIEND_TEST_ALL_PREFIXES(ContextualSearchDelegateTest, DecodeStringMentions);
+ FRIEND_TEST_ALL_PREFIXES(ContextualSearchDelegateTest,
+ ResponseWithNowOnTapData);
// net::URLFetcherDelegate:
void OnURLFetchComplete(const net::URLFetcher* source) override;
@@ -202,6 +205,12 @@ class ContextualSearchDelegate
int* startResult,
int* endResult);
+ // Decodes the Now on Tap response from the given dictionary, and returns
+ // whether both the subtitle and thumbnail were present.
+ void DecodeNowOnTapResponse(const base::DictionaryValue& dict,
+ std::string* subtitle,
+ std::string* thumbnail);
+
// Generates a subset of the given surrounding_text string, for Icing
// integration.
// |surrounding_text| the entire text context that contains the selection.
@@ -228,9 +237,6 @@ class ContextualSearchDelegate
// Holds the TemplateURLService. Not owned.
TemplateURLService* template_url_service_;
- // The field trial helper instance, always set up by the constructor.
- std::unique_ptr<ContextualSearchFieldTrial> field_trial_;
-
// The callback for notifications of completed URL fetches.
SearchTermResolutionCallback search_term_callback_;
@@ -240,6 +246,9 @@ class ContextualSearchDelegate
// The callback for notifications of Icing selection being available.
IcingCallback icing_callback_;
+ // The field trial helper instance, always set up by the constructor.
+ std::unique_ptr<ContextualSearchFieldTrial> field_trial_;
+
// Used to hold the context until an upcoming search term request is started.
std::unique_ptr<ContextualSearchContext> context_;

Powered by Google App Engine
This is Rietveld 408576698