| Index: chrome/browser/autocomplete/keyword_provider.cc
|
| ===================================================================
|
| --- chrome/browser/autocomplete/keyword_provider.cc (revision 107110)
|
| +++ chrome/browser/autocomplete/keyword_provider.cc (working copy)
|
| @@ -440,6 +440,22 @@
|
| return result;
|
| }
|
|
|
| +AutocompleteMatch KeywordProvider::CreateAutocompleteMatchFromSuggestion(
|
| + TemplateURLService* model,
|
| + const string16& keyword,
|
| + const AutocompleteInput& input,
|
| + const ExtensionOmniboxSuggestion& suggestion,
|
| + int relevance) {
|
| + AutocompleteMatch match = CreateAutocompleteMatch(
|
| + model, keyword, input, keyword.length(),
|
| + suggestion.content, relevance);
|
| + match.contents = AutocompleteMatch::SanitizeString(suggestion.description);
|
| + match.contents_class = suggestion.description_styles;
|
| + match.description.clear();
|
| + match.description_class.clear();
|
| + return match;
|
| +}
|
| +
|
| void KeywordProvider::Observe(int type,
|
| const content::NotificationSource& source,
|
| const content::NotificationDetails& details) {
|
| @@ -488,8 +504,6 @@
|
| // TODO(mpcomplete): consider clamping the number of suggestions to
|
| // AutocompleteProvider::kMaxMatches.
|
| for (size_t i = 0; i < suggestions.suggestions.size(); ++i) {
|
| - const ExtensionOmniboxSuggestion& suggestion =
|
| - suggestions.suggestions[i];
|
| // We want to order these suggestions in descending order, so start with
|
| // the relevance of the first result (added synchronously in Start()),
|
| // and subtract 1 for each subsequent suggestion from the extension.
|
| @@ -497,15 +511,13 @@
|
| // the extension unless the full keyword had been typed.
|
| int first_relevance = CalculateRelevance(input.type(), true, true,
|
| input.prefer_keyword(), input.allow_exact_keyword_match());
|
| - extension_suggest_matches_.push_back(CreateAutocompleteMatch(
|
| - model, keyword, input, keyword.length(),
|
| - suggestion.content, first_relevance - (i + 1)));
|
| -
|
| - AutocompleteMatch* match = &extension_suggest_matches_.back();
|
| - match->contents.assign(suggestion.description);
|
| - match->contents_class = suggestion.description_styles;
|
| - match->description.clear();
|
| - match->description_class.clear();
|
| + int relevance = first_relevance - (i + 1);
|
| + extension_suggest_matches_.push_back(
|
| + CreateAutocompleteMatchFromSuggestion(model,
|
| + keyword,
|
| + input,
|
| + suggestions.suggestions[i],
|
| + relevance));
|
| }
|
|
|
| done_ = true;
|
|
|