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

Unified Diff: components/omnibox/base_search_provider.cc

Issue 669573005: Add a class to parse answer json. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and respond to comments Created 6 years, 2 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: components/omnibox/base_search_provider.cc
diff --git a/components/omnibox/base_search_provider.cc b/components/omnibox/base_search_provider.cc
index cb3654c2b9a1200d9e3635aee8ba02875ce6a9ed..763b952ab203b4c6160efcb23394c09b632696af 100644
--- a/components/omnibox/base_search_provider.cc
+++ b/components/omnibox/base_search_provider.cc
@@ -111,8 +111,8 @@ AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion(
// this match to look as if it was received/created synchronously.
SearchSuggestionParser::SuggestResult suggest_result(
suggestion, type, suggestion, base::string16(), base::string16(),
- base::string16(), base::string16(), std::string(), std::string(),
- from_keyword_provider, 0, false, false, base::string16());
+ base::string16(), base::string16(), SuggestionAnswer(), std::string(),
+ std::string(), from_keyword_provider, 0, false, false, base::string16());
suggest_result.set_received_after_last_keystroke(false);
return CreateSearchSuggestion(
NULL, AutocompleteInput(), from_keyword_provider, suggest_result,
@@ -208,6 +208,7 @@ AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion(
match.contents_class = suggestion.match_contents_class();
match.answer_contents = suggestion.answer_contents();
match.answer_type = suggestion.answer_type();
+ match.answer = suggestion.answer();
if (suggestion.type() == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE) {
match.RecordAdditionalInfo(
kACMatchPropertyInputText, base::UTF16ToUTF8(input.text()));
@@ -430,6 +431,7 @@ void BaseSearchProvider::AddMatchToMap(
more_relevant_match.answer_type.empty()) {
more_relevant_match.answer_type = less_relevant_match.answer_type;
more_relevant_match.answer_contents = less_relevant_match.answer_contents;
+ more_relevant_match.answer = less_relevant_match.answer;
}
}
}
@@ -445,7 +447,7 @@ bool BaseSearchProvider::ParseSuggestResults(
client_->AcceptLanguages(), is_keyword_result, results))
return false;
- for (std::vector<GURL>::const_iterator it =
+ for (SuggestionAnswer::URLs::const_iterator it =
groby-ooo-7-16 2014/10/28 00:50:02 Since we're touching this anyways, let's go C++11
Justin Donnelly 2014/10/28 15:20:55 Done. (I can't properly express how much I love ra
results->answers_image_urls.begin();
it != results->answers_image_urls.end(); ++it)
client_->PrefetchImage(*it);

Powered by Google App Engine
This is Rietveld 408576698