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

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

Issue 62153002: Omnibox: Fix Inline Autocompletion of Navsuggest in Forced Query Mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reupload Created 7 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/search_provider.cc
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 7373008ae41c28178d92cd5c1eb82d4ecb533100..deae0cc7f3ed262ea5578fa9d7305d46eb8d77e4 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -1692,14 +1692,6 @@ AutocompleteMatch SearchProvider::NavigationToMatch(
bool trim_http = !AutocompleteInput::HasHTTPScheme(input) &&
(!prefix || (match_start != 0));
- // Preserve the forced query '?' prefix in |match.fill_into_edit|.
- // Otherwise, user edits to a suggestion would show non-Search results.
- if (input_.type() == AutocompleteInput::FORCED_QUERY) {
- match.fill_into_edit = ASCIIToUTF16("?");
- if (inline_autocomplete_offset != string16::npos)
- ++inline_autocomplete_offset;
- }
-
const std::string languages(
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
const net::FormatUrlTypes format_types =
@@ -1709,6 +1701,13 @@ AutocompleteMatch SearchProvider::NavigationToMatch(
net::FormatUrl(navigation.url(), languages, format_types,
net::UnescapeRule::SPACES, NULL, NULL,
&inline_autocomplete_offset));
+ // Preserve the forced query '?' prefix in |match.fill_into_edit|.
+ // Otherwise, user edits to a suggestion would show non-Search results.
+ if (input_.type() == AutocompleteInput::FORCED_QUERY) {
+ match.fill_into_edit.insert(0, ASCIIToUTF16("?"));
+ if (inline_autocomplete_offset != string16::npos)
+ ++inline_autocomplete_offset;
+ }
if (!input_.prevent_inline_autocomplete() &&
(inline_autocomplete_offset != string16::npos)) {
DCHECK(inline_autocomplete_offset <= match.fill_into_edit.length());
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698