Index: chrome/browser/autocomplete/keyword_provider.cc |
diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc |
index 10cf328dacb9dfeac3a4dc54d80f7f8504041518..97ccc5c036e1a6d10607426aeee468d0f6a07d48 100644 |
--- a/chrome/browser/autocomplete/keyword_provider.cc |
+++ b/chrome/browser/autocomplete/keyword_provider.cc |
@@ -365,15 +365,15 @@ void KeywordProvider::FillInURLAndContents( |
// static |
int KeywordProvider::CalculateRelevance(AutocompleteInput::Type type, |
bool complete, |
- bool no_query_text_needed, |
+ bool supports_replacement, |
+ bool prefer_keyword, |
bool allow_exact_keyword_match) { |
if (!complete) |
return (type == AutocompleteInput::URL) ? 700 : 450; |
- if (!allow_exact_keyword_match) |
- return 1100; |
- if (no_query_text_needed) |
+ if (!supports_replacement || (allow_exact_keyword_match && prefer_keyword)) |
return 1500; |
- return (type == AutocompleteInput::QUERY) ? 1450 : 1100; |
+ return (allow_exact_keyword_match && (type == AutocompleteInput::QUERY)) ? |
+ 1450 : 1100; |
} |
AutocompleteMatch KeywordProvider::CreateAutocompleteMatch( |
@@ -400,7 +400,7 @@ AutocompleteMatch KeywordProvider::CreateAutocompleteMatch( |
// When the user wants keyword matches to take |
// preference, score them highly regardless of |
// whether the input provides query text. |
- input.prefer_keyword() || !supports_replacement, |
+ supports_replacement, input.prefer_keyword(), |
input.allow_exact_keyword_match()); |
} |
AutocompleteMatch result(this, relevance, false, |
@@ -494,7 +494,7 @@ void KeywordProvider::Observe(NotificationType type, |
// and subtract 1 for each subsequent suggestion from the extension. |
// We know that |complete| is true, because we wouldn't get results from |
// the extension unless the full keyword had been typed. |
- int first_relevance = CalculateRelevance(input.type(), true, |
+ 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(), |