diff options
author | dxie@chromium.org <dxie@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-19 21:17:49 +0000 |
---|---|---|
committer | dxie@chromium.org <dxie@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-19 21:17:49 +0000 |
commit | e19273d2ec9f07177422de8402b5770d69691942 (patch) | |
tree | 5b247acc5b667aa7fab44edc1904d2a01096fae9 | |
parent | a73473be8d02ead7b3cf80a62c0d42ade5fb1951 (diff) | |
download | chromium_src-e19273d2ec9f07177422de8402b5770d69691942.zip chromium_src-e19273d2ec9f07177422de8402b5770d69691942.tar.gz chromium_src-e19273d2ec9f07177422de8402b5770d69691942.tar.bz2 |
Revert 258069 "Merge 257829 "Omnibox: Make URL-What-You-Typed Na..."
> Merge 257829 "Omnibox: Make URL-What-You-Typed Navsuggestions Al..."
>
> > Omnibox: Make URL-What-You-Typed Navsuggestions Always Inlineable
> >
> > Also make autocomplete_result DCHECK test ignore placeholder matches--i.e., matches that don't navigate anywhere and so we don't care what type they are.
> >
> > BUG=351172
> >
> > Review URL: https://codereview.chromium.org/196573014
>
> TBR=mpearson@chromium.org
>
> Review URL: https://codereview.chromium.org/204333006
TBR=mpearson@chromium.org
Review URL: https://codereview.chromium.org/205213003
git-svn-id: svn://svn.chromium.org/chrome/branches/1847/src@258099 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_result.cc | 17 | ||||
-rw-r--r-- | chrome/browser/autocomplete/search_provider.cc | 21 | ||||
-rw-r--r-- | chrome/browser/autocomplete/search_provider_unittest.cc | 8 |
3 files changed, 13 insertions, 33 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_result.cc b/chrome/browser/autocomplete/autocomplete_result.cc index fc13ab2..f5ed15d 100644 --- a/chrome/browser/autocomplete/autocomplete_result.cc +++ b/chrome/browser/autocomplete/autocomplete_result.cc @@ -204,17 +204,12 @@ void AutocompleteResult::SortAndCull(const AutocompleteInput& input, base::ASCIIToUTF16(", input=") + input.text(); DCHECK(default_match_->allowed_to_be_default_match) << debug_info; - // If the default match is valid (i.e., not a prompt/placeholder), make - // sure the type of destination is what the user would expect given the - // input. - if (default_match_->destination_url.is_valid()) { - // We shouldn't get query matches for URL inputs, or non-query matches - // for query inputs. - if (AutocompleteMatch::IsSearchType(default_match_->type)) { - DCHECK_NE(AutocompleteInput::URL, input.type()) << debug_info; - } else { - DCHECK_NE(AutocompleteInput::FORCED_QUERY, input.type()) << debug_info; - } + // We shouldn't get query matches for URL inputs, or non-query matches + // for query inputs. + if (AutocompleteMatch::IsSearchType(default_match_->type)) { + DCHECK_NE(AutocompleteInput::URL, input.type()) << debug_info; + } else { + DCHECK_NE(AutocompleteInput::FORCED_QUERY, input.type()) << debug_info; } } diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 3b68436..38e6971 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -15,7 +15,6 @@ #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" -#include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h" #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" @@ -1510,11 +1509,8 @@ int SearchProvider::CalculateRelevanceForHistory( AutocompleteMatch SearchProvider::NavigationToMatch( const NavigationResult& navigation) { - base::string16 input; - const bool trimmed_whitespace = base::TrimWhitespace( - navigation.from_keyword_provider() ? - keyword_input_.text() : input_.text(), - base::TRIM_TRAILING, &input) != base::TRIM_NONE; + const base::string16& input = navigation.from_keyword_provider() ? + keyword_input_.text() : input_.text(); AutocompleteMatch match(this, navigation.relevance(), false, AutocompleteMatchType::NAVSUGGEST); match.destination_url = navigation.url(); @@ -1554,16 +1550,13 @@ AutocompleteMatch SearchProvider::NavigationToMatch( } // An inlineable navsuggestion can only be the default match when there // is no keyword provider active, lest it appear first and break the user - // out of keyword mode. It can also only be default if either the inline - // autocompletion is empty or we're not preventing inline autocompletion. - // Finally, if we have an inlineable navsuggestion with an inline completion - // that we're not preventing, make sure we didn't trim any whitespace. - // We don't want to claim http://foo.com/bar is inlineable against the - // input "foo.com/b ". + // out of keyword mode. It can also only be default when we're not + // preventing inline autocompletion (unless the inline autocompletion + // would be empty). match.allowed_to_be_default_match = navigation.IsInlineable(input) && (providers_.GetKeywordProviderURL() == NULL) && - (match.inline_autocompletion.empty() || - (!input_.prevent_inline_autocomplete() && !trimmed_whitespace)); + (!input_.prevent_inline_autocomplete() || + match.inline_autocompletion.empty()); match.contents = navigation.match_contents(); match.contents_class = navigation.match_contents_class(); diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc index f07918e..2cb68a4 100644 --- a/chrome/browser/autocomplete/search_provider_unittest.cc +++ b/chrome/browser/autocomplete/search_provider_unittest.cc @@ -3084,14 +3084,6 @@ TEST_F(SearchProviderTest, NavigationInline) { { "http://www.abc.com/", "http://www.abc.com", "http://www.abc.com", std::string(), true, true }, - // Inputs with trailing whitespace should inline when possible. - { "abc.com ", "http://www.abc.com", - "www.abc.com", std::string(), true, true }, - { "abc.com/ ", "http://www.abc.com", - "www.abc.com", std::string(), true, true }, - { "abc.com ", "http://www.abc.com/bar", - "www.abc.com/bar", "/bar", false, false }, - // Inline matches when the input is a leading substring of the scheme. { "h", "http://www.abc.com", "http://www.abc.com", "ttp://www.abc.com", true, false }, |