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

Unified Diff: components/omnibox/browser/base_search_provider.cc

Issue 2045873002: Omnibox: Don't Barf When Suggestion is Mixed-Case Equivalent to Verbatim (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "" -> std::string() Created 4 years, 6 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
« no previous file with comments | « chrome/browser/autocomplete/search_provider_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/omnibox/browser/base_search_provider.cc
diff --git a/components/omnibox/browser/base_search_provider.cc b/components/omnibox/browser/base_search_provider.cc
index 55aa13228d72028d036e44e70e4f9693c626eeb2..9ae221bf3f2b450a7ed5c5ff6bad00cef7ea8cf8 100644
--- a/components/omnibox/browser/base_search_provider.cc
+++ b/components/omnibox/browser/base_search_provider.cc
@@ -232,11 +232,12 @@ AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion(
&match.description_class, 0, ACMatchClassification::NONE);
}
+ const base::string16 input_lower = base::i18n::ToLower(input.text());
// suggestion.match_contents() should have already been collapsed.
match.allowed_to_be_default_match =
(!in_keyword_mode || suggestion.from_keyword_provider()) &&
- (base::CollapseWhitespace(input.text(), false) ==
- suggestion.match_contents());
+ (base::CollapseWhitespace(input_lower, false) ==
+ base::i18n::ToLower(suggestion.match_contents()));
// When the user forced a query, we need to make sure all the fill_into_edit
// values preserve that property. Otherwise, if the user starts editing a
@@ -251,8 +252,8 @@ AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion(
!suggestion.received_after_last_keystroke() &&
(!in_keyword_mode || suggestion.from_keyword_provider()) &&
base::StartsWith(
- base::i18n::ToLower(suggestion.suggestion()),
- base::i18n::ToLower(input.text()), base::CompareCase::SENSITIVE)) {
+ base::i18n::ToLower(suggestion.suggestion()), input_lower,
+ base::CompareCase::SENSITIVE)) {
match.inline_autocompletion =
suggestion.suggestion().substr(input.text().length());
match.allowed_to_be_default_match = true;
« no previous file with comments | « chrome/browser/autocomplete/search_provider_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698