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 history::URLRow info; | 305 history::URLRow info; |
306 FillURLRow(statement, &info); | 306 FillURLRow(statement, &info); |
307 if (info.url().is_valid()) | 307 if (info.url().is_valid()) |
308 results->push_back(info); | 308 results->push_back(info); |
309 } | 309 } |
310 return !results->empty(); | 310 return !results->empty(); |
311 } | 311 } |
312 | 312 |
313 bool URLDatabase::IsTypedHost(const std::string& host) { | 313 bool URLDatabase::IsTypedHost(const std::string& host) { |
314 const char* schemes[] = { | 314 const char* schemes[] = { |
315 chrome::kHttpScheme, | 315 content::kHttpScheme, |
316 content::kHttpsScheme, | 316 content::kHttpsScheme, |
317 chrome::kFtpScheme | 317 chrome::kFtpScheme |
318 }; | 318 }; |
319 URLRows dummy; | 319 URLRows dummy; |
320 for (size_t i = 0; i < arraysize(schemes); ++i) { | 320 for (size_t i = 0; i < arraysize(schemes); ++i) { |
321 std::string scheme_and_host(schemes[i]); | 321 std::string scheme_and_host(schemes[i]); |
322 scheme_and_host += content::kStandardSchemeSeparator + host; | 322 scheme_and_host += content::kStandardSchemeSeparator + host; |
323 if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) || | 323 if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) || |
324 AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy)) | 324 AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy)) |
325 return true; | 325 return true; |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 return GetDB().Execute(sql.c_str()); | 606 return GetDB().Execute(sql.c_str()); |
607 } | 607 } |
608 | 608 |
609 bool URLDatabase::CreateMainURLIndex() { | 609 bool URLDatabase::CreateMainURLIndex() { |
610 // Index over URLs so we can quickly look up based on URL. | 610 // Index over URLs so we can quickly look up based on URL. |
611 return GetDB().Execute( | 611 return GetDB().Execute( |
612 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)"); | 612 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)"); |
613 } | 613 } |
614 | 614 |
615 } // namespace history | 615 } // namespace history |
OLD | NEW |