diff options
author | mpearson@chromium.org <mpearson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 14:52:24 +0000 |
---|---|---|
committer | mpearson@chromium.org <mpearson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 14:52:24 +0000 |
commit | fb95251e2402805dece783f9b8770416f4671256 (patch) | |
tree | b636382f69dbeeb0984530739609c0280b675107 | |
parent | 1e8bcd119da373a97deeac10faa855175c508992 (diff) | |
download | chromium_src-fb95251e2402805dece783f9b8770416f4671256.zip chromium_src-fb95251e2402805dece783f9b8770416f4671256.tar.gz chromium_src-fb95251e2402805dece783f9b8770416f4671256.tar.bz2 |
Omnibox: Search Provider: Fix Minor Constraint Enforcement Bug
IsTopMatchHighRankSearchForURL() is supposed to be check if
the top match is not a URL. It currently does this by asking
is it search-what-you-typed, search-other-engine, or search-suggest?
If so, then it must not be a URL.
This seems to have led to a bug because search-history has been omitted.
I haven't seen this bug in the wild; hence there's no bug link. I
spotted it when looking at the code.
Rather than fix it by adding "or is search-history" to the test, I changed
the test to be a negative. After all navsuggests are the only things
search provider can return that are URLs.
BUG=
Review URL: https://chromiumcodereview.appspot.com/18889008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212043 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/autocomplete/search_provider.cc | 11 | ||||
-rw-r--r-- | chrome/browser/autocomplete/search_provider.h | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 2f30450..849d494 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -1063,13 +1063,10 @@ bool SearchProvider::IsTopMatchScoreTooLow() const { CalculateRelevanceForVerbatimIgnoringKeywordModeState(); } -bool SearchProvider::IsTopMatchHighRankSearchForURL() const { +bool SearchProvider::IsTopMatchSearchWithURLInput() const { return input_.type() == AutocompleteInput::URL && matches_.front().relevance > CalculateRelevanceForVerbatim() && - (matches_.front().type == AutocompleteMatchType::SEARCH_SUGGEST || - matches_.front().type == - AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED || - matches_.front().type == AutocompleteMatchType::SEARCH_OTHER_ENGINE); + matches_.front().type != AutocompleteMatchType::NAVSUGGEST; } bool SearchProvider::IsTopMatchNotInlinable() const { @@ -1114,7 +1111,7 @@ void SearchProvider::UpdateMatches() { keyword_results_.verbatim_relevance = -1; ConvertResultsToAutocompleteMatches(); } - if (IsTopMatchHighRankSearchForURL()) { + if (IsTopMatchSearchWithURLInput()) { // Disregard the suggested search and verbatim relevances if the input // type is URL and the top match is a highly-ranked search suggestion. // For example, prevent a search for "foo.com" from outranking another @@ -1135,7 +1132,7 @@ void SearchProvider::UpdateMatches() { } DCHECK(!IsTopMatchNavigationInKeywordMode()); DCHECK(!IsTopMatchScoreTooLow()); - DCHECK(!IsTopMatchHighRankSearchForURL()); + DCHECK(!IsTopMatchSearchWithURLInput()); DCHECK(!IsTopMatchNotInlinable()); } diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h index f01fdb6..3f9b080 100644 --- a/chrome/browser/autocomplete/search_provider.h +++ b/chrome/browser/autocomplete/search_provider.h @@ -378,7 +378,7 @@ class SearchProvider : public AutocompleteProvider, // See UpdateMatches() for the use and explanation of these constraints. bool IsTopMatchNavigationInKeywordMode() const; bool IsTopMatchScoreTooLow() const; - bool IsTopMatchHighRankSearchForURL() const; + bool IsTopMatchSearchWithURLInput() const; bool IsTopMatchNotInlinable() const; // Updates |matches_| from the latest results; applies calculated relevances |