| Index: components/omnibox/search_provider.cc
|
| diff --git a/components/omnibox/search_provider.cc b/components/omnibox/search_provider.cc
|
| index a9cd7b7fe3eef8168757e0ea582ee84243161d40..14433c440a49ff82e8ef7ab7cf6e258308b87048 100644
|
| --- a/components/omnibox/search_provider.cc
|
| +++ b/components/omnibox/search_provider.cc
|
| @@ -823,12 +823,15 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() {
|
| // verbatim, and if so, copy over answer contents.
|
| base::string16 answer_contents;
|
| base::string16 answer_type;
|
| + scoped_ptr<SuggestionAnswer> answer;
|
| for (ACMatches::iterator it = matches_.begin(); it != matches_.end();
|
| ++it) {
|
| if (!it->answer_contents.empty() &&
|
| it->fill_into_edit == trimmed_verbatim) {
|
| answer_contents = it->answer_contents;
|
| answer_type = it->answer_type;
|
| + answer.reset(it->answer.get() ?
|
| + new SuggestionAnswer(*it->answer) : nullptr);
|
| break;
|
| }
|
| }
|
| @@ -836,8 +839,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.Pass(), 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 +862,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(), nullptr, 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 +944,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.get()) {
|
| if (!answer_seen) {
|
| answer_seen = true;
|
| } else {
|
| it->answer_contents.clear();
|
| it->answer_type.clear();
|
| + it->answer.reset();
|
| }
|
| }
|
| }
|
| @@ -1065,8 +1069,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(), nullptr, 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);
|
|
|