Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: chrome/browser/autocomplete/keyword_provider.cc

Issue 6334017: Always allow exact match non-substituting keywords. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..da0554cf21c4c560736dee0c648d3beb463af17a 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -365,13 +365,14 @@ void KeywordProvider::FillInURLAndContents(
// static
int KeywordProvider::CalculateRelevance(AutocompleteInput::Type type,
bool complete,
- bool no_query_text_needed,
+ bool prefer_keyword,
+ bool supports_replacement,
bool allow_exact_keyword_match) {
if (!complete)
return (type == AutocompleteInput::URL) ? 700 : 450;
- if (!allow_exact_keyword_match)
+ if (!allow_exact_keyword_match && supports_replacement)
Peter Kasting 2011/01/25 23:20:44 Nit: This is minor, but I wonder if it might not b
James Su 2011/01/26 00:53:31 Done.
return 1100;
- if (no_query_text_needed)
+ if (prefer_keyword || !supports_replacement)
return 1500;
return (type == AutocompleteInput::QUERY) ? 1450 : 1100;
}
@@ -400,7 +401,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,
+ input.prefer_keyword(), supports_replacement,
input.allow_exact_keyword_match());
}
AutocompleteMatch result(this, relevance, false,
@@ -495,7 +496,7 @@ void KeywordProvider::Observe(NotificationType type,
// 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,
- input.prefer_keyword(), input.allow_exact_keyword_match());
+ input.prefer_keyword(), true, input.allow_exact_keyword_match());
extension_suggest_matches_.push_back(CreateAutocompleteMatch(
model, keyword, input, keyword.length(),
suggestion.content, first_relevance - (i + 1)));

Powered by Google App Engine
This is Rietveld 408576698