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

Side by Side Diff: components/history/core/browser/url_database.cc

Issue 703553002: Allow systematic prefix search in bookmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments at https://codereview.chromium.org/701553002/ Created 6 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/history/core/browser/url_database.h" 5 #include "components/history/core/browser/url_database.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 return false; 350 return false;
351 351
352 DCHECK(info); 352 DCHECK(info);
353 FillURLRow(statement, info); 353 FillURLRow(statement, info);
354 return true; 354 return true;
355 } 355 }
356 356
357 bool URLDatabase::GetTextMatches(const base::string16& query, 357 bool URLDatabase::GetTextMatches(const base::string16& query,
358 URLRows* results) { 358 URLRows* results) {
359 ScopedVector<query_parser::QueryNode> query_nodes; 359 ScopedVector<query_parser::QueryNode> query_nodes;
360 query_parser_.ParseQueryNodes(query, &query_nodes.get()); 360 query_parser_.ParseQueryNodes(
361 query, query_parser::MatchingAlgorithm::DEFAULT, &query_nodes.get());
361 362
362 results->clear(); 363 results->clear();
363 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 364 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
364 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE hidden = 0")); 365 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE hidden = 0"));
365 366
366 while (statement.Step()) { 367 while (statement.Step()) {
367 query_parser::QueryWordVector query_words; 368 query_parser::QueryWordVector query_words;
368 base::string16 url = base::i18n::ToLower(statement.ColumnString16(1)); 369 base::string16 url = base::i18n::ToLower(statement.ColumnString16(1));
369 query_parser_.ExtractQueryWords(url, &query_words); 370 query_parser_.ExtractQueryWords(url, &query_words);
370 GURL gurl(url); 371 GURL gurl(url);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 bool RowQualifiesAsSignificant(const URLRow& row, 628 bool RowQualifiesAsSignificant(const URLRow& row,
628 const base::Time& threshold) { 629 const base::Time& threshold) {
629 const base::Time& real_threshold = 630 const base::Time& real_threshold =
630 threshold.is_null() ? AutocompleteAgeThreshold() : threshold; 631 threshold.is_null() ? AutocompleteAgeThreshold() : threshold;
631 return (row.typed_count() >= kLowQualityMatchTypedLimit) || 632 return (row.typed_count() >= kLowQualityMatchTypedLimit) ||
632 (row.visit_count() >= kLowQualityMatchVisitLimit) || 633 (row.visit_count() >= kLowQualityMatchVisitLimit) ||
633 (row.last_visit() >= real_threshold); 634 (row.last_visit() >= real_threshold);
634 } 635 }
635 636
636 } // namespace history 637 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698