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

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: 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..f31b5fb8585932a07ee37349151f98c0fb11c7a6 100644
--- a/components/omnibox/base_search_provider.cc
+++ b/components/omnibox/base_search_provider.cc
@@ -111,7 +111,7 @@ 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(),
+ base::string16(), base::string16(), nullptr, std::string(), std::string(),
from_keyword_provider, 0, false, false, base::string16());
suggest_result.set_received_after_last_keystroke(false);
return CreateSearchSuggestion(
@@ -208,6 +208,8 @@ AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion(
match.contents_class = suggestion.match_contents_class();
match.answer_contents = suggestion.answer_contents();
match.answer_type = suggestion.answer_type();
+ match.answer.reset(
+ suggestion.answer() ? new SuggestionAnswer(*suggestion.answer()) : NULL);
if (suggestion.type() == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE) {
match.RecordAdditionalInfo(
kACMatchPropertyInputText, base::UTF16ToUTF8(input.text()));
@@ -430,6 +432,8 @@ 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.reset(less_relevant_match.answer.get() ?
groby-ooo-7-16 2014/10/21 00:35:54 Assuming that we don't care about the answer on th
Justin Donnelly 2014/10/21 21:43:54 No longer using the scoped_ptr.
+ new SuggestionAnswer(*less_relevant_match.answer) : NULL);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698