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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 FillURLRow(statement, &info); | 305 FillURLRow(statement, &info); |
306 if (info.url().is_valid()) | 306 if (info.url().is_valid()) |
307 results->push_back(info); | 307 results->push_back(info); |
308 } | 308 } |
309 return !results->empty(); | 309 return !results->empty(); |
310 } | 310 } |
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 content::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 += content::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 } |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 return GetDB().Execute(sql.c_str()); | 595 return GetDB().Execute(sql.c_str()); |
596 } | 596 } |
597 | 597 |
598 bool URLDatabase::CreateMainURLIndex() { | 598 bool URLDatabase::CreateMainURLIndex() { |
599 // Index over URLs so we can quickly look up based on URL. | 599 // Index over URLs so we can quickly look up based on URL. |
600 return GetDB().Execute( | 600 return GetDB().Execute( |
601 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)"); | 601 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)"); |
602 } | 602 } |
603 | 603 |
604 } // namespace history | 604 } // namespace history |
OLD | NEW |