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

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

Issue 18878007: Omnibox: Make the Controller Reorder Matches for Inlining (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Harry's comments Created 7 years, 4 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/history_quick_provider.cc
diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc
index ea890abdc5e1c4505b63c8245b99f8732c7d37a6..c9d35731ef0385659fa7c4155cbdc91228277815 100644
--- a/chrome/browser/autocomplete/history_quick_provider.cc
+++ b/chrome/browser/autocomplete/history_quick_provider.cc
@@ -208,7 +208,7 @@ void HistoryQuickProvider::DoAutocomplete() {
// general or the current best suggestion isn't inlineable,
// artificially reduce the starting |max_match_score| (which
// therefore applies to all results) to something low enough that
- // guarantees no result will be offered as an autocomplete
+ // guarantees no result will be offered as an inline autocomplete
// suggestion. Also do a similar reduction if we think there will be
// a URL-what-you-typed match. (We want URL-what-you-typed matches for
// visited URLs to beat out any longer URLs, no matter how frequently
@@ -220,8 +220,11 @@ void HistoryQuickProvider::DoAutocomplete() {
TemplateURLServiceFactory::GetForProfile(profile_);
TemplateURL* template_url = template_url_service ?
template_url_service->GetDefaultSearchProvider() : NULL;
- int max_match_score = (PreventInlineAutocomplete(autocomplete_input_) ||
- !matches.begin()->can_inline) ?
+ int max_match_score =
+ (!OmniboxFieldTrial::ReorderForLegalDefaultMatch(
+ autocomplete_input_.current_page_classification()) &&
Peter Kasting 2013/08/06 22:56:16 Nit: No parens around unary operator application
Mark P 2013/08/07 00:44:31 It's not around the unary operator; its around the
+ (PreventInlineAutocomplete(autocomplete_input_) ||
+ !matches.begin()->can_inline)) ?
(AutocompleteResult::kLowestDefaultScore - 1) :
matches.begin()->raw_score;
if (will_have_url_what_you_typed_match_first) {
@@ -272,10 +275,14 @@ AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch(
match.contents_class =
SpansFromTermMatch(new_matches, match.contents.length(), true);
- if (history_match.can_inline) {
+ if (!history_match.can_inline ||
Peter Kasting 2013/08/06 22:56:16 Nit: Shorter: match.allowed_to_be_default_match
Mark P 2013/08/07 00:44:31 Yup, that's shorter and no less clear.
+ PreventInlineAutocomplete(autocomplete_input_)) {
+ match.allowed_to_be_default_match = false;
+ } else {
DCHECK(!new_matches.empty());
size_t inline_autocomplete_offset = new_matches[0].offset +
new_matches[0].length;
+ match.allowed_to_be_default_match = true;
// |inline_autocomplete_offset| may be beyond the end of the
// |fill_into_edit| if the user has typed an URL with a scheme and the
// last character typed is a slash. That slash is removed by the

Powered by Google App Engine
This is Rietveld 408576698