| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if (info.url().is_valid()) | 308 if (info.url().is_valid()) |
| 309 results->push_back(info); | 309 results->push_back(info); |
| 310 } | 310 } |
| 311 return !results->empty(); | 311 return !results->empty(); |
| 312 } | 312 } |
| 313 | 313 |
| 314 bool URLDatabase::IsTypedHost(const std::string& host) { | 314 bool URLDatabase::IsTypedHost(const std::string& host) { |
| 315 const char* schemes[] = { | 315 const char* schemes[] = { |
| 316 url::kHttpScheme, | 316 url::kHttpScheme, |
| 317 url::kHttpsScheme, | 317 url::kHttpsScheme, |
| 318 content::kFtpScheme | 318 url::kFtpScheme |
| 319 }; | 319 }; |
| 320 URLRows dummy; | 320 URLRows dummy; |
| 321 for (size_t i = 0; i < arraysize(schemes); ++i) { | 321 for (size_t i = 0; i < arraysize(schemes); ++i) { |
| 322 std::string scheme_and_host(schemes[i]); | 322 std::string scheme_and_host(schemes[i]); |
| 323 scheme_and_host += content::kStandardSchemeSeparator + host; | 323 scheme_and_host += content::kStandardSchemeSeparator + host; |
| 324 if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) || | 324 if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) || |
| 325 AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy)) | 325 AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy)) |
| 326 return true; | 326 return true; |
| 327 } | 327 } |
| 328 return false; | 328 return false; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |