Chromium Code Reviews| Index: chrome/browser/autocomplete/zero_suggest_provider.cc |
| diff --git a/chrome/browser/autocomplete/zero_suggest_provider.cc b/chrome/browser/autocomplete/zero_suggest_provider.cc |
| index b6e072277b9d585d346e922937760a0437d16d6e..956f8750be5f641b80f7857ca23a0b1db66dbf57 100644 |
| --- a/chrome/browser/autocomplete/zero_suggest_provider.cc |
| +++ b/chrome/browser/autocomplete/zero_suggest_provider.cc |
| @@ -263,47 +263,17 @@ void ZeroSuggestProvider::AddSuggestResultsToMap( |
| const TemplateURL* template_url, |
| MatchMap* map) { |
| for (size_t i = 0; i < results.size(); ++i) { |
| - AddMatchToMap(results[i].relevance(), AutocompleteMatchType::SEARCH_SUGGEST, |
| - template_url, results[i].suggestion(), i, map); |
| + const base::string16& query_string(results[i].suggestion()); |
| + // Pass in query_string as the input_text to avoid bolding |
| + const SuggestResult suggestion(query_string, |
| + AutocompleteMatchType::SEARCH_SUGGEST, query_string, base::string16(), |
| + std::string(), std::string(), false, results[i].relevance(), true, |
| + false, query_string); |
| + AddMatchToMap(suggestion, AutocompleteInput(), query_string, template_url, |
|
Mark P
2014/02/10 23:25:55
Hopefully this ugly (pre-existing) AutocompleteInp
Maria
2014/02/11 21:42:32
Sadly, no :(
|
| + std::string(), i, true, map); |
| } |
| } |
| -void ZeroSuggestProvider::AddMatchToMap(int relevance, |
| - AutocompleteMatch::Type type, |
| - const TemplateURL* template_url, |
| - const base::string16& query_string, |
| - int accepted_suggestion, |
| - MatchMap* map) { |
| - // Pass in query_string as the input_text to avoid bolding. |
| - SuggestResult suggestion( |
| - query_string, type, query_string, base::string16(), std::string(), |
| - std::string(), false, relevance, true, false, query_string); |
| - // TODO(samarth|melevin): use the actual omnibox margin here as well instead |
| - // of passing in -1. |
| - AutocompleteMatch match = CreateSearchSuggestion(this, AutocompleteInput(), |
| - query_string, suggestion, template_url, accepted_suggestion, -1, true); |
| - if (!match.destination_url.is_valid()) |
| - return; |
| - |
| - // Try to add |match| to |map|. If a match for |query_string| is already in |
| - // |map|, replace it if |match| is more relevant. |
| - // NOTE: Keep this ToLower() call in sync with url_database.cc. |
| - MatchKey match_key( |
| - std::make_pair(base::i18n::ToLower(query_string), std::string())); |
| - const std::pair<MatchMap::iterator, bool> i(map->insert( |
| - std::make_pair(match_key, match))); |
| - // NOTE: We purposefully do a direct relevance comparison here instead of |
| - // using AutocompleteMatch::MoreRelevant(), so that we'll prefer "items added |
| - // first" rather than "items alphabetically first" when the scores are equal. |
| - // The only case this matters is when a user has results with the same score |
| - // that differ only by capitalization; because the history system returns |
| - // results sorted by recency, this means we'll pick the most recent such |
| - // result even if the precision of our relevance score is too low to |
| - // distinguish the two. |
| - if (!i.second && (match.relevance > i.first->second.relevance)) |
| - i.first->second = match; |
| -} |
| - |
| AutocompleteMatch ZeroSuggestProvider::NavigationToMatch( |
| const NavigationResult& navigation) { |
| AutocompleteMatch match(this, navigation.relevance(), false, |