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

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

Issue 2322793002: [Contextual Search] Fetch and display thumbnails returned in resolution response (Closed)
Patch Set: Fix unit tests 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.cc
diff --git a/chrome/browser/android/contextualsearch/contextual_search_delegate.cc b/chrome/browser/android/contextualsearch/contextual_search_delegate.cc
index bf28538f72f37adc783d9d0315f8935c52ff64fa..79619f4b9db53919fd3866efeaf96a342d938f70 100644
--- a/chrome/browser/android/contextualsearch/contextual_search_delegate.cc
+++ b/chrome/browser/android/contextualsearch/contextual_search_delegate.cc
@@ -164,10 +164,12 @@ ContextualSearchDelegate::GetResolvedSearchTermFromJson(
int start_adjust = 0;
int end_adjust = 0;
std::string context_language;
+ std::string thumbnail_url = "";
DecodeSearchTermFromJsonResponse(
json_string, &search_term, &display_text, &alternate_term, &mid,
- &prevent_preload, &mention_start, &mention_end, &context_language);
+ &prevent_preload, &mention_start, &mention_end, &context_language,
+ &thumbnail_url);
if (mention_start != 0 || mention_end != 0) {
// Sanity check that our selection is non-zero and it is less than
// 100 characters as that would make contextual search bar hide.
@@ -188,7 +190,7 @@ ContextualSearchDelegate::GetResolvedSearchTermFromJson(
return std::unique_ptr<ResolvedSearchTerm>(new ResolvedSearchTerm(
is_invalid, response_code, search_term, display_text, alternate_term, mid,
prevent_preload == kDoPreventPreloadValue, start_adjust, end_adjust,
- context_language));
+ context_language, thumbnail_url));
}
std::string ContextualSearchDelegate::BuildRequestUrl(std::string selection) {
@@ -436,7 +438,8 @@ void ContextualSearchDelegate::DecodeSearchTermFromJsonResponse(
std::string* prevent_preload,
int* mention_start,
int* mention_end,
- std::string* lang) {
+ std::string* lang,
+ std::string* thumbnail_url) {
bool contains_xssi_escape =
base::StartsWith(response, kXssiEscape, base::CompareCase::SENSITIVE);
const std::string& proper_json =
@@ -482,6 +485,9 @@ void ContextualSearchDelegate::DecodeSearchTermFromJsonResponse(
*alternate_term = resolved_term;
}
}
+
+ // TODO(twellington): extract thumbnail_url. Also extract caption and pipe
Donn Denman 2016/09/08 18:13:39 Feel free to change to donnd.
Theresa 2016/09/08 20:18:23 Done :)
+ // through.
}
// Extract the Start/End of the mentions in the surrounding text

Powered by Google App Engine
This is Rietveld 408576698