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

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

Issue 291005: Allow the history URL provider to handle input of type QUERY. This helps in ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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
===================================================================
--- chrome/browser/autocomplete/history_url_provider.cc (revision 29226)
+++ chrome/browser/autocomplete/history_url_provider.cc (working copy)
@@ -126,7 +126,8 @@
// Create a What You Typed match, which we'll need below.
bool have_what_you_typed_match =
params->input.canonicalized_url().is_valid() &&
- (params->input.type() != AutocompleteInput::UNKNOWN);
+ (params->input.type() != AutocompleteInput::UNKNOWN) &&
+ (params->input.type() != AutocompleteInput::QUERY);
AutocompleteMatch what_you_typed_match(SuggestExactInput(params->input,
params->trim_http));
@@ -172,7 +173,7 @@
if (what_you_typed_match.is_history_what_you_typed_match &&
FixupExactSuggestion(db, params->input, &what_you_typed_match,
&history_matches)) {
- // Got an exact match for the user's input. Treat is as the best match
+ // Got an exact match for the user's input. Treat it as the best match
// regardless of the input type.
exact_suggestion = 1;
params->matches.push_back(what_you_typed_match);
@@ -180,7 +181,7 @@
history_matches.empty() ||
!PromoteMatchForInlineAutocomplete(params, history_matches.front())) {
// Failed to promote any URLs for inline autocompletion. Use the What You
- // Typed match, if we have it and the input wasn't UNKNOWN.
+ // Typed match, if we have it and the input looked like a URL.
first_match = 0;
if (have_what_you_typed_match)
params->matches.push_back(what_you_typed_match);
@@ -464,7 +465,7 @@
return 1400;
case WHAT_YOU_TYPED:
- return (input_type == AutocompleteInput::REQUESTED_URL) ? 1300 : 1200;
+ return 1200;
default:
return 900 + static_cast<int>(match_number);
@@ -592,9 +593,8 @@
bool fixup_input_and_run_pass_1) {
matches_.clear();
- if ((input.type() != AutocompleteInput::UNKNOWN) &&
- (input.type() != AutocompleteInput::REQUESTED_URL) &&
- (input.type() != AutocompleteInput::URL))
+ if ((input.type() == AutocompleteInput::INVALID) ||
+ (input.type() == AutocompleteInput::FORCED_QUERY))
return;
// Create a match for exactly what the user typed. This will only be used as
@@ -602,7 +602,10 @@
// we'll run this again in DoAutocomplete() and use that result instead.
const bool trim_http = !url_util::FindAndCompareScheme(
WideToUTF8(input.text()), chrome::kHttpScheme, NULL);
- if (input.canonicalized_url().is_valid())
+ // Don't do this for queries -- while we can sometimes mark up a match for
+ // this, it's not what the user wants, and just adds noise.
+ if ((input.type() != AutocompleteInput::QUERY) &&
+ input.canonicalized_url().is_valid())
matches_.push_back(SuggestExactInput(input, trim_http));
// We'll need the history service to run both passes, so try to obtain it.

Powered by Google App Engine
This is Rietveld 408576698