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

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

Issue 18878007: Omnibox: Make the Controller Reorder Matches for Inlining (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 5 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 dd2959e9eb41a0921a1f294c8847d3eeadf919ec..43b60280da5a877de23feec3df0b6bd38cc9dcd9 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -217,7 +217,7 @@ AutocompleteMatch KeywordProvider::CreateAutocompleteMatch(
const AutocompleteInput& input) {
return CreateAutocompleteMatch(
GetTemplateURLService()->GetTemplateURLForKeyword(keyword), input,
- keyword.length(), SplitReplacementStringFromInput(text, true), 0);
+ keyword.length(), SplitReplacementStringFromInput(text, true), true, 0);
msw 2013/07/23 21:55:33 It's not obvious why this file has true or false s
Mark P 2013/07/26 16:48:13 Sure. I'll clarify in this comment; you can decid
msw 2013/07/26 20:04:49 I think your comments are insightful enough that t
Mark P 2013/07/26 23:55:24 Added comments in those other three areas as reque
}
void KeywordProvider::Start(const AutocompleteInput& input,
@@ -319,7 +319,7 @@ void KeywordProvider::Start(const AutocompleteInput& input,
// 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(
- template_url, input, keyword.length(), remaining_input, -1));
+ template_url, input, keyword.length(), remaining_input, true, -1));
if (profile_ && is_extension_keyword) {
if (input.matches_requested() == AutocompleteInput::ALL_MATCHES) {
@@ -365,7 +365,7 @@ void KeywordProvider::Start(const AutocompleteInput& input,
for (TemplateURLService::TemplateURLVector::const_iterator i(
matches.begin()); i != matches.end(); ++i) {
matches_.push_back(CreateAutocompleteMatch(
- *i, input, keyword.length(), remaining_input, -1));
+ *i, input, keyword.length(), remaining_input, false, -1));
}
}
}
@@ -420,6 +420,7 @@ AutocompleteMatch KeywordProvider::CreateAutocompleteMatch(
const AutocompleteInput& input,
size_t prefix_length,
const string16& remaining_input,
+ bool allowed_to_be_default_match,
int relevance) {
DCHECK(template_url);
const bool supports_replacement =
@@ -442,6 +443,7 @@ AutocompleteMatch KeywordProvider::CreateAutocompleteMatch(
AutocompleteMatch match(this, relevance, false,
supports_replacement ? AutocompleteMatchType::SEARCH_OTHER_ENGINE :
AutocompleteMatchType::HISTORY_KEYWORD);
+ match.allowed_to_be_default_match = allowed_to_be_default_match;
match.fill_into_edit = keyword;
if (!remaining_input.empty() || !keyword_complete || supports_replacement)
match.fill_into_edit.push_back(L' ');
@@ -573,7 +575,7 @@ void KeywordProvider::Observe(int type,
input.prefer_keyword(), input.allow_exact_keyword_match());
extension_suggest_matches_.push_back(CreateAutocompleteMatch(
template_url, input, keyword.length(),
- UTF8ToUTF16(suggestion.content), first_relevance - (i + 1)));
+ UTF8ToUTF16(suggestion.content), false, first_relevance - (i + 1)));
AutocompleteMatch* match = &extension_suggest_matches_.back();
match->contents.assign(UTF8ToUTF16(suggestion.description));

Powered by Google App Engine
This is Rietveld 408576698