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

Side by Side Diff: chrome/browser/history/url_database.cc

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ALL_MATCHES (in response to recent changes) Created 6 years, 8 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 | Annotate | Revision Log
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 "chrome/browser/history/url_database.h" 5 #include "chrome/browser/history/url_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 bool URLDatabase::GetTextMatches(const base::string16& query, 363 bool URLDatabase::GetTextMatches(const base::string16& query,
364 URLRows* results) { 364 URLRows* results) {
365 ScopedVector<query_parser::QueryNode> query_nodes; 365 ScopedVector<query_parser::QueryNode> query_nodes;
366 query_parser_.ParseQueryNodes(query, &query_nodes.get()); 366 query_parser_.ParseQueryNodes(query, &query_nodes.get());
367 367
368 results->clear(); 368 results->clear();
369 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 369 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
370 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE hidden = 0")); 370 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE hidden = 0"));
371 371
372 while (statement.Step()) { 372 while (statement.Step()) {
373 std::vector<query_parser::QueryWord> query_words; 373 query_parser::QueryWordVector query_words;
374 base::string16 url = base::i18n::ToLower(statement.ColumnString16(1)); 374 base::string16 url = base::i18n::ToLower(statement.ColumnString16(1));
375 query_parser_.ExtractQueryWords(url, &query_words); 375 query_parser_.ExtractQueryWords(url, &query_words);
376 GURL gurl(url); 376 GURL gurl(url);
377 if (gurl.is_valid()) { 377 if (gurl.is_valid()) {
378 // Decode punycode to match IDN. 378 // Decode punycode to match IDN.
379 // |query_words| won't be shown to user - therefore we can use empty 379 // |query_words| won't be shown to user - therefore we can use empty
380 // |languages| to reduce dependency (no need to call PrefService). 380 // |languages| to reduce dependency (no need to call PrefService).
381 base::string16 ascii = base::ASCIIToUTF16(gurl.host()); 381 base::string16 ascii = base::ASCIIToUTF16(gurl.host());
382 base::string16 utf = net::IDNToUnicode(gurl.host(), std::string()); 382 base::string16 utf = net::IDNToUnicode(gurl.host(), std::string());
383 if (ascii != utf) 383 if (ascii != utf)
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 return GetDB().Execute(sql.c_str()); 616 return GetDB().Execute(sql.c_str());
617 } 617 }
618 618
619 bool URLDatabase::CreateMainURLIndex() { 619 bool URLDatabase::CreateMainURLIndex() {
620 // Index over URLs so we can quickly look up based on URL. 620 // Index over URLs so we can quickly look up based on URL.
621 return GetDB().Execute( 621 return GetDB().Execute(
622 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)"); 622 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)");
623 } 623 }
624 624
625 } // namespace history 625 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/scored_history_match.cc ('k') | chrome/browser/history/url_index_private_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698