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

Unified Diff: components/omnibox/shortcuts_provider.cc

Issue 1220963005: Update base::StartsWith calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: 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/shortcuts_provider.cc
diff --git a/components/omnibox/shortcuts_provider.cc b/components/omnibox/shortcuts_provider.cc
index fe6a04881ec7c4ba01df49122d3a73d51fc83dff..8994d7d80f32dc76537cad9de320e8cdbdfda77b 100644
--- a/components/omnibox/shortcuts_provider.cc
+++ b/components/omnibox/shortcuts_provider.cc
@@ -136,7 +136,8 @@ void ShortcutsProvider::GetMatches(const AutocompleteInput& input) {
for (ShortcutsBackend::ShortcutMap::const_iterator it =
FindFirstMatch(term_string, backend.get());
it != backend->shortcuts_map().end() &&
- base::StartsWith(it->first, term_string, true);
+ base::StartsWith(it->first, term_string,
+ base::CompareCase::SENSITIVE);
++it) {
// Don't return shortcuts with zero relevance.
int relevance = CalculateScore(term_string, it->second, max_relevance);
@@ -208,7 +209,9 @@ AutocompleteMatch ShortcutsProvider::ShortcutToACMatch(
// input of "foo.c" to autocomplete to "foo.com" for a fill_into_edit of
// "http://foo.com".
if (AutocompleteMatch::IsSearchType(match.type)) {
- if (base::StartsWith(match.fill_into_edit, input.text(), false)) {
+ if (base::StartsWith(base::i18n::ToLower(match.fill_into_edit),
+ base::i18n::ToLower(input.text()),
+ base::CompareCase::SENSITIVE)) {
match.inline_autocompletion =
match.fill_into_edit.substr(input.text().length());
match.allowed_to_be_default_match =
@@ -295,7 +298,8 @@ ACMatchClassifications ShortcutsProvider::ClassifyAllMatchesInString(
base::string16 text_lowercase(base::i18n::ToLower(text));
ACMatchClassifications match_class;
size_t last_position = 0;
- if (base::StartsWith(text_lowercase, find_text, true)) {
+ if (base::StartsWith(text_lowercase, find_text,
+ base::CompareCase::SENSITIVE)) {
match_class.push_back(
ACMatchClassification(0, ACMatchClassification::MATCH));
last_position = find_text.length();
@@ -359,7 +363,7 @@ ShortcutsBackend::ShortcutMap::const_iterator ShortcutsProvider::FindFirstMatch(
// Lower bound not necessarily matches the keyword, check for item pointed by
// the lower bound iterator to at least start with keyword.
return ((it == backend->shortcuts_map().end()) ||
- base::StartsWith(it->first, keyword, true))
+ base::StartsWith(it->first, keyword, base::CompareCase::SENSITIVE))
? it
: backend->shortcuts_map().end();
}

Powered by Google App Engine
This is Rietveld 408576698