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

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

Issue 672773003: Include a URL what-you-typed option when the default search provider is not available and the input… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit tests, make suggested style and comment changes Created 6 years, 2 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_url_provider.cc
diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc
index 61eceda8b345109719c6c0082b39ce99a62e8d8d..362f20b48267792514c1c55cae2e93deaa174252 100644
--- a/chrome/browser/autocomplete/history_url_provider.cc
+++ b/chrome/browser/autocomplete/history_url_provider.cc
@@ -756,20 +756,20 @@ void HistoryURLProvider::DoAutocomplete(history::HistoryBackend* backend,
SortAndDedupMatches(&params->matches);
// Try to create a shorter suggestion from the best match.
- // We consider the what you typed match eligible for display when there's a
- // reasonable chance the user actually cares:
- // * Their input can be opened as a URL, and
- // * We parsed the input as a URL, or it starts with an explicit "http:" or
- // "https:".
- // Otherwise, this is just low-quality noise. In the cases where we've parsed
- // as UNKNOWN, we'll still show an accidental search infobar if need be.
+ // We consider the what you typed match eligible for display when it's
+ // navigable and there's a reasonable chance the user intended to do
+ // something other than search. We use a variety of heuristics to determine
+ // this, e.g. whether the user explicitly typed a scheme, or if omnibox
+ // searching has been disabled by policy. In the cases where we've parsed as
+ // UNKNOWN, we'll still show an accidental search infobar if need be.
VisitClassifier classifier(this, params->input, db);
params->have_what_you_typed_match =
(params->input.type() != metrics::OmniboxInputType::QUERY) &&
((params->input.type() != metrics::OmniboxInputType::UNKNOWN) ||
(classifier.type() == VisitClassifier::UNVISITED_INTRANET) ||
!params->trim_http ||
- (AutocompleteInput::NumNonHostComponents(params->input.parts()) > 0));
+ (AutocompleteInput::NumNonHostComponents(params->input.parts()) > 0) ||
+ (!params->default_search_provider));
Peter Kasting 2014/10/24 22:02:13 Nit: No parens around unary operation
const bool have_shorter_suggestion_suitable_for_inline_autocomplete =
PromoteOrCreateShorterSuggestion(
db, params->have_what_you_typed_match, params);

Powered by Google App Engine
This is Rietveld 408576698