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

Unified Diff: components/omnibox/answers_cache.cc

Issue 1220653002: Fix some case-insensitive cases for StartsWith (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: grt's review comments, Mac fix Created 5 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
Index: components/omnibox/answers_cache.cc
diff --git a/components/omnibox/answers_cache.cc b/components/omnibox/answers_cache.cc
index 35cf5a38fab24752ab1d01b70d5fde9e489a4548..3ea8a1f405bcdd4dcbb2073053e3168b46e4018c 100644
--- a/components/omnibox/answers_cache.cc
+++ b/components/omnibox/answers_cache.cc
@@ -4,6 +4,7 @@
#include "components/omnibox/answers_cache.h"
+#include "base/i18n/case_conversion.h"
#include "base/strings/string_util.h"
AnswersQueryData::AnswersQueryData() {
@@ -20,10 +21,12 @@ AnswersCache::~AnswersCache() {
}
AnswersQueryData AnswersCache::GetTopAnswerEntry(const base::string16& query) {
- base::string16 collapsed_query = base::CollapseWhitespace(query, false);
+ base::string16 collapsed_query = base::i18n::ToLower(
+ base::CollapseWhitespace(query, false));
for (Cache::iterator it = cache_.begin(); it != cache_.end(); ++it) {
// If the query text starts with trimmed input, this is valid prefetch data.
- if (base::StartsWith(it->full_query_text, collapsed_query, false)) {
+ if (base::StartsWith(base::i18n::ToLower(it->full_query_text),
+ collapsed_query, base::CompareCase::SENSITIVE)) {
// Move the touched item to the front of the list.
cache_.splice(cache_.begin(), cache_, it);
return cache_.front();
« no previous file with comments | « components/browser_watcher/exit_code_watcher_win_unittest.cc ('k') | components/omnibox/base_search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698