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

Side by Side Diff: components/omnibox/url_index_private_data.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, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/omnibox/url_index_private_data.h" 5 #include "components/omnibox/url_index_private_data.h"
6 6
7 #include <functional> 7 #include <functional>
8 #include <iterator> 8 #include <iterator>
9 #include <limits> 9 #include <limits>
10 #include <numeric> 10 #include <numeric>
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return HistoryIDSet(); 556 return HistoryIDSet();
557 557
558 // TODO(mrossetti): Consider optimizing for very common terms such as 558 // TODO(mrossetti): Consider optimizing for very common terms such as
559 // 'http[s]', 'www', 'com', etc. Or collect the top 100 more frequently 559 // 'http[s]', 'www', 'com', etc. Or collect the top 100 more frequently
560 // occuring words in the user's searches. 560 // occuring words in the user's searches.
561 561
562 size_t term_length = term.length(); 562 size_t term_length = term.length();
563 WordIDSet word_id_set; 563 WordIDSet word_id_set;
564 if (term_length > 1) { 564 if (term_length > 1) {
565 // See if this term or a prefix thereof is present in the cache. 565 // See if this term or a prefix thereof is present in the cache.
566 base::string16 term_lower = base::i18n::ToLower(term);
566 SearchTermCacheMap::iterator best_prefix(search_term_cache_.end()); 567 SearchTermCacheMap::iterator best_prefix(search_term_cache_.end());
567 for (SearchTermCacheMap::iterator cache_iter = search_term_cache_.begin(); 568 for (SearchTermCacheMap::iterator cache_iter = search_term_cache_.begin();
568 cache_iter != search_term_cache_.end(); ++cache_iter) { 569 cache_iter != search_term_cache_.end(); ++cache_iter) {
569 if (base::StartsWith(term, cache_iter->first, false) && 570 if (base::StartsWith(term_lower,
571 base::i18n::ToLower(cache_iter->first),
572 base::CompareCase::SENSITIVE) &&
570 (best_prefix == search_term_cache_.end() || 573 (best_prefix == search_term_cache_.end() ||
571 cache_iter->first.length() > best_prefix->first.length())) 574 cache_iter->first.length() > best_prefix->first.length()))
572 best_prefix = cache_iter; 575 best_prefix = cache_iter;
573 } 576 }
574 577
575 // If a prefix was found then determine the leftover characters to be used 578 // If a prefix was found then determine the leftover characters to be used
576 // for further refining the results from that prefix. 579 // for further refining the results from that prefix.
577 Char16Set prefix_chars; 580 Char16Set prefix_chars;
578 base::string16 leftovers(term); 581 base::string16 leftovers(term);
579 if (best_prefix != search_term_cache_.end()) { 582 if (best_prefix != search_term_cache_.end()) {
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 // First cut: typed count, visit count, recency. 1351 // First cut: typed count, visit count, recency.
1349 // TODO(mrossetti): This is too simplistic. Consider an approach which ranks 1352 // TODO(mrossetti): This is too simplistic. Consider an approach which ranks
1350 // recently visited (within the last 12/24 hours) as highly important. Get 1353 // recently visited (within the last 12/24 hours) as highly important. Get
1351 // input from mpearson. 1354 // input from mpearson.
1352 if (r1.typed_count() != r2.typed_count()) 1355 if (r1.typed_count() != r2.typed_count())
1353 return (r1.typed_count() > r2.typed_count()); 1356 return (r1.typed_count() > r2.typed_count());
1354 if (r1.visit_count() != r2.visit_count()) 1357 if (r1.visit_count() != r2.visit_count())
1355 return (r1.visit_count() > r2.visit_count()); 1358 return (r1.visit_count() > r2.visit_count());
1356 return (r1.last_visit() > r2.last_visit()); 1359 return (r1.last_visit() > r2.last_visit());
1357 } 1360 }
OLDNEW
« chrome/utility/importer/bookmark_html_reader.cc ('K') | « components/omnibox/shortcuts_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698