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

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

Issue 12090006: Omnibox: Create Keyword Verbatim Result in Search Provider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bart's final comments. Created 7 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 c37da20e228f36040e821a071aecc4df86b70668..1de238743dd80fd4d2fc12f30e5c95892158d816 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -285,14 +285,25 @@ 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 =
+ profile_ && template_url->IsExtensionKeyword();
msw 2013/01/31 00:38:16 Is |profile_| actually required for extension keyw
Mark P 2013/01/31 23:09:27 That was a condition in the original if test so I
msw 2013/02/01 20:52:37 I see that, but I asked if that was a separate con
Mark P 2013/02/02 00:24:35 It's unrelated. Moved as you suggested.
+
+ // We only create an exact match if remaining_input is empty or
msw 2013/01/31 00:38:16 optional nits: |remaining_input| here and below an
Mark P 2013/01/31 23:09:27 Done.
+ // if this is an extension keyword; if remaining_input is a non-empty
+ // non-extension keyword (i.e., we have a regular keyword that
+ // supports replacement and has extra text following it), then we
+ // let SearchProvider create 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 (is_extension_keyword) {
if (input.matches_requested() == AutocompleteInput::ALL_MATCHES) {
if (template_url->GetExtensionId() != current_keyword_extension_id_)
MaybeEndExtensionKeywordMode();
@@ -315,7 +326,8 @@ void KeywordProvider::Start(const AutocompleteInput& input,
matches_.push_back(extension_suggest_matches_[i]);
matches_.back().relevance = matches_[0].relevance - (i + 1);
}
- } else if (input.matches_requested() == AutocompleteInput::ALL_MATCHES) {
+ } else if (input.matches_requested() ==
msw 2013/01/31 00:38:16 optional nit: don't split this line
Mark P 2013/01/31 23:09:27 Done.
+ AutocompleteInput::ALL_MATCHES) {
extension_suggest_last_input_ = input;
extension_suggest_matches_.clear();

Powered by Google App Engine
This is Rietveld 408576698