| 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..a99f5632b934bce102ff87c45f737a708488a436 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();
|
| @@ -426,6 +436,13 @@ int KeywordProvider::CalculateRelevance(AutocompleteInput::Type type,
|
| bool supports_replacement,
|
| bool prefer_keyword,
|
| bool allow_exact_keyword_match) {
|
| + // Perhaps this should be kept similar to
|
| + // 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).
|
| if (!complete)
|
| return (type == AutocompleteInput::URL) ? 700 : 450;
|
| if (!supports_replacement || (allow_exact_keyword_match && prefer_keyword))
|
|
|