Chromium Code Reviews| 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 |