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 fc74e13834ee470f3b6722ccf798fefe925282b8..2cff2ec623f1a5fe05f7db8e9e4c78329312e6c8 100644 |
--- a/chrome/browser/autocomplete/history_quick_provider.cc |
+++ b/chrome/browser/autocomplete/history_quick_provider.cc |
@@ -56,7 +56,9 @@ HistoryQuickProvider::HistoryQuickProvider( |
Profile* profile) |
: HistoryProvider(listener, profile, |
AutocompleteProvider::TYPE_HISTORY_QUICK), |
- languages_(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)) { |
+ languages_(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)), |
+ omnibox_will_reorder_for_legal_default_match_( |
+ OmniboxFieldTrial::InReorderForLegalDefaultMatchGroup()) { |
} |
void HistoryQuickProvider::Start(const AutocompleteInput& input, |
@@ -208,7 +210,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 +222,9 @@ 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 = (!omnibox_will_reorder_for_legal_default_match_ && |
+ (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 || |
+ 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 |