OLD | NEW |
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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 bool URLDatabase::IsTypedHost(const std::string& host) { | 312 bool URLDatabase::IsTypedHost(const std::string& host) { |
313 const char* schemes[] = { | 313 const char* schemes[] = { |
314 chrome::kHttpScheme, | 314 chrome::kHttpScheme, |
315 chrome::kHttpsScheme, | 315 chrome::kHttpsScheme, |
316 chrome::kFtpScheme | 316 chrome::kFtpScheme |
317 }; | 317 }; |
318 URLRows dummy; | 318 URLRows dummy; |
319 for (size_t i = 0; i < arraysize(schemes); ++i) { | 319 for (size_t i = 0; i < arraysize(schemes); ++i) { |
320 std::string scheme_and_host(schemes[i]); | 320 std::string scheme_and_host(schemes[i]); |
321 scheme_and_host += chrome::kStandardSchemeSeparator + host; | 321 scheme_and_host += content::kStandardSchemeSeparator + host; |
322 if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) || | 322 if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) || |
323 AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy)) | 323 AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy)) |
324 return true; | 324 return true; |
325 } | 325 } |
326 return false; | 326 return false; |
327 } | 327 } |
328 | 328 |
329 bool URLDatabase::FindShortestURLFromBase(const std::string& base, | 329 bool URLDatabase::FindShortestURLFromBase(const std::string& base, |
330 const std::string& url, | 330 const std::string& url, |
331 int min_visits, | 331 int min_visits, |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 return GetDB().Execute(sql.c_str()); | 569 return GetDB().Execute(sql.c_str()); |
570 } | 570 } |
571 | 571 |
572 bool URLDatabase::CreateMainURLIndex() { | 572 bool URLDatabase::CreateMainURLIndex() { |
573 // Index over URLs so we can quickly look up based on URL. | 573 // Index over URLs so we can quickly look up based on URL. |
574 return GetDB().Execute( | 574 return GetDB().Execute( |
575 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)"); | 575 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)"); |
576 } | 576 } |
577 | 577 |
578 } // namespace history | 578 } // namespace history |
OLD | NEW |