Chromium Code Reviews| 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 073aa18ec4ddca9f23dd425d7c68a4e0f1378283..e9ce34a1b593cf273463effae5d7e2ca234eee30 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_) || |
|
msw
2013/07/18 06:23:57
Did you mean to negate this boolean? It looks unin
Peter Kasting
2013/07/18 17:35:28
Hmm, good catch, I agree. I looked at this code w
Mark P
2013/07/21 20:31:05
Yes, good catch. That was a bug. Fixed.
|
| + !matches.begin()->can_inline)) ? |
| (AutocompleteResult::kLowestDefaultScore - 1) : |
| matches.begin()->raw_score; |
| if (will_have_url_what_you_typed_match_first) { |
| @@ -272,12 +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.inline_autocomplete_offset = string16::npos; |
| } else { |
| DCHECK(!new_matches.empty()); |
| match.inline_autocomplete_offset = new_matches[0].offset + |
| new_matches[0].length; |
| + match.allowed_to_be_default_match = true; |
| // The following will happen if the user has typed an URL with a scheme |
| // and the last character typed is a slash because that slash is removed |
| // by the FormatURLWithOffsets call above. |