Index: components/omnibox/search_provider.cc |
diff --git a/components/omnibox/search_provider.cc b/components/omnibox/search_provider.cc |
index a9cd7b7fe3eef8168757e0ea582ee84243161d40..1653a5f83ec35a524a9512246f590b4293df9d22 100644 |
--- a/components/omnibox/search_provider.cc |
+++ b/components/omnibox/search_provider.cc |
@@ -25,6 +25,7 @@ |
#include "components/omnibox/autocomplete_result.h" |
#include "components/omnibox/keyword_provider.h" |
#include "components/omnibox/omnibox_field_trial.h" |
+#include "components/omnibox/suggestion_answer.h" |
#include "components/omnibox/url_prefix.h" |
#include "components/search/search.h" |
#include "components/search_engines/template_url_prepopulate_data.h" |
@@ -823,12 +824,13 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() { |
// verbatim, and if so, copy over answer contents. |
base::string16 answer_contents; |
base::string16 answer_type; |
+ SuggestionAnswer answer; |
for (ACMatches::iterator it = matches_.begin(); it != matches_.end(); |
++it) { |
- if (!it->answer_contents.empty() && |
- it->fill_into_edit == trimmed_verbatim) { |
+ if (it->answer.is_valid() && it->fill_into_edit == trimmed_verbatim) { |
answer_contents = it->answer_contents; |
answer_type = it->answer_type; |
+ answer = it->answer; |
break; |
} |
} |
@@ -836,8 +838,8 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() { |
SearchSuggestionParser::SuggestResult verbatim( |
trimmed_verbatim, AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, |
trimmed_verbatim, base::string16(), base::string16(), answer_contents, |
- answer_type, std::string(), std::string(), false, verbatim_relevance, |
- relevance_from_server, false, trimmed_verbatim); |
+ answer_type, answer, std::string(), std::string(), false, |
+ verbatim_relevance, relevance_from_server, false, trimmed_verbatim); |
AddMatchToMap(verbatim, std::string(), did_not_accept_default_suggestion, |
false, keyword_url != NULL, &map); |
} |
@@ -859,9 +861,9 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() { |
SearchSuggestionParser::SuggestResult verbatim( |
trimmed_verbatim, AutocompleteMatchType::SEARCH_OTHER_ENGINE, |
trimmed_verbatim, base::string16(), base::string16(), |
- base::string16(), base::string16(), std::string(), std::string(), |
- true, keyword_verbatim_relevance, keyword_relevance_from_server, |
- false, trimmed_verbatim); |
+ base::string16(), base::string16(), SuggestionAnswer(), |
+ std::string(), std::string(), true, keyword_verbatim_relevance, |
+ keyword_relevance_from_server, false, trimmed_verbatim); |
AddMatchToMap(verbatim, std::string(), |
did_not_accept_keyword_suggestion, false, true, &map); |
} |
@@ -941,12 +943,13 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() { |
void SearchProvider::RemoveExtraAnswers(ACMatches* matches) { |
bool answer_seen = false; |
for (ACMatches::iterator it = matches->begin(); it != matches->end(); ++it) { |
- if (!it->answer_contents.empty()) { |
+ if (it->answer.is_valid()) { |
if (!answer_seen) { |
answer_seen = true; |
} else { |
it->answer_contents.clear(); |
it->answer_type.clear(); |
+ it->answer.Clear(); |
} |
} |
} |
@@ -1065,8 +1068,8 @@ SearchProvider::ScoreHistoryResultsHelper(const HistoryResults& results, |
SearchSuggestionParser::SuggestResult history_suggestion( |
trimmed_suggestion, AutocompleteMatchType::SEARCH_HISTORY, |
trimmed_suggestion, base::string16(), base::string16(), |
- base::string16(), base::string16(), std::string(), std::string(), |
- is_keyword, relevance, false, false, trimmed_input); |
+ base::string16(), base::string16(), SuggestionAnswer(), std::string(), |
+ std::string(), is_keyword, relevance, false, false, trimmed_input); |
// History results are synchronous; they are received on the last keystroke. |
history_suggestion.set_received_after_last_keystroke(false); |
scored_results.insert(insertion_position, history_suggestion); |