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

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

Issue 171753002: Omnibox: SearchProvider: Fix Navsuggestions in Prevent-Inlining Mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wrapping Created 6 years, 10 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/search_provider.cc
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 331a498f53666329f59a7096842933c0306eec03..10e60a304e40b77898691796ff850e55a64dbf85 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -1543,17 +1543,20 @@ AutocompleteMatch SearchProvider::NavigationToMatch(
if (inline_autocomplete_offset != base::string16::npos)
++inline_autocomplete_offset;
}
- if (!input_.prevent_inline_autocomplete() &&
- (inline_autocomplete_offset != base::string16::npos)) {
+ if (inline_autocomplete_offset != base::string16::npos) {
DCHECK(inline_autocomplete_offset <= match.fill_into_edit.length());
- // A 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.
- match.allowed_to_be_default_match =
- (providers_.GetKeywordProviderURL() == NULL);
match.inline_autocompletion =
match.fill_into_edit.substr(inline_autocomplete_offset);
}
+ // 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 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) &&
+ (!input_.prevent_inline_autocomplete() ||
+ match.inline_autocompletion.empty());
match.contents = navigation.match_contents();
match.contents_class = navigation.match_contents_class();
« no previous file with comments | « chrome/browser/autocomplete/base_search_provider.cc ('k') | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698