Chromium Code Reviews| Index: chrome/browser/autocomplete/keyword_provider.cc |
| diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc |
| index c37da20e228f36040e821a071aecc4df86b70668..e183ae753b89eb6d0408f7c415c0e332e5c24455 100644 |
| --- a/chrome/browser/autocomplete/keyword_provider.cc |
| +++ b/chrome/browser/autocomplete/keyword_provider.cc |
| @@ -285,14 +285,24 @@ void KeywordProvider::Start(const AutocompleteInput& input, |
| // Any exact match is going to be the highest quality match, and thus at the |
| // front of our vector. |
| if (keyword_matches.front() == keyword) { |
| - const TemplateURL* template_url(model->GetTemplateURLForKeyword(keyword)); |
| + const TemplateURL* template_url = model->GetTemplateURLForKeyword(keyword); |
| + const bool is_extension_keyword = template_url->IsExtensionKeyword(); |
| + |
| + // Only create an exact match if |remaining_input| is empty or if |
| + // this is an extension keyword. If |remaining_input| is a |
| + // non-empty non-extension keyword (i.e., a regular keyword that |
| + // supports replacement and that has extra text following it), |
| + // then SearchProvider creates the exact (a.k.a. verbatim) match. |
| + if (!remaining_input.empty() && !is_extension_keyword) |
| + return; |
| + |
| // TODO(pkasting): We should probably check that if the user explicitly |
| // typed a scheme, that scheme matches the one in |template_url|. |
| matches_.push_back(CreateAutocompleteMatch(model, keyword, input, |
| keyword.length(), |
| remaining_input, -1)); |
| - if (profile_ && template_url->IsExtensionKeyword()) { |
| + if (profile_ && is_extension_keyword) { |
| if (input.matches_requested() == AutocompleteInput::ALL_MATCHES) { |
| if (template_url->GetExtensionId() != current_keyword_extension_id_) |
| MaybeEndExtensionKeywordMode(); |
| @@ -421,6 +431,13 @@ void KeywordProvider::FillInURLAndContents( |
| } |
| // static |
| +// Perhaps this should be kept similar to |
|
msw
2013/02/02 02:27:52
nit: comment inside the function or at the declara
Mark P
2013/02/04 19:46:09
Done.
|
| +// SearchProvider::CalculateRelevanceForKeywordVerbatim(). That |
| +// function calculates the verbatim query score for search keywords |
| +// but only non-extension ones. It would be a bit odd if the score |
| +// for a verbatim query for non-extension keyword and for an extension |
| +// keyword differed dramatically (though no immediate harm would come |
| +// from it). |
| int KeywordProvider::CalculateRelevance(AutocompleteInput::Type type, |
| bool complete, |
| bool supports_replacement, |