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

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: Tweaked API and finished unit tests 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 5f054ad94ebee27fbd56efeb9bee8714230ed02f..5b287c0edb7dcf0e9d8dd7ba204f127339780643 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;
}
}
}

Powered by Google App Engine
This is Rietveld 408576698