| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/visit_database.h" | 5 #include "chrome/browser/history/visit_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 return false; | 428 return false; |
| 429 | 429 |
| 430 *from_url = GURL(statement.ColumnString(0)); | 430 *from_url = GURL(statement.ColumnString(0)); |
| 431 } | 431 } |
| 432 return true; | 432 return true; |
| 433 } | 433 } |
| 434 | 434 |
| 435 bool VisitDatabase::GetVisitCountToHost(const GURL& url, | 435 bool VisitDatabase::GetVisitCountToHost(const GURL& url, |
| 436 int* count, | 436 int* count, |
| 437 base::Time* first_visit) { | 437 base::Time* first_visit) { |
| 438 if (!url.SchemeIs(chrome::kHttpScheme) && !url.SchemeIs(chrome::kHttpsScheme)) | 438 if (!url.SchemeIs(chrome::kHttpScheme) && |
| 439 !url.SchemeIs(chrome::kHttpsScheme) && |
| 440 !url.SchemeIs(chrome::kHttpsvScheme)) |
| 439 return false; | 441 return false; |
| 440 | 442 |
| 441 // We need to search for URLs with a matching host/port. One way to query for | 443 // We need to search for URLs with a matching host/port. One way to query for |
| 442 // this is to use the LIKE operator, eg 'url LIKE http://google.com/%'. This | 444 // this is to use the LIKE operator, eg 'url LIKE http://google.com/%'. This |
| 443 // is inefficient though in that it doesn't use the index and each entry must | 445 // is inefficient though in that it doesn't use the index and each entry must |
| 444 // be visited. The same query can be executed by using >= and < operator. | 446 // be visited. The same query can be executed by using >= and < operator. |
| 445 // The query becomes: | 447 // The query becomes: |
| 446 // 'url >= http://google.com/' and url < http://google.com0'. | 448 // 'url >= http://google.com/' and url < http://google.com0'. |
| 447 // 0 is used as it is one character greater than '/'. | 449 // 0 is used as it is one character greater than '/'. |
| 448 GURL search_url(url); | 450 GURL search_url(url); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // Get the source entries out of the query result. | 520 // Get the source entries out of the query result. |
| 519 while (statement.Step()) { | 521 while (statement.Step()) { |
| 520 std::pair<VisitID, VisitSource> source_entry(statement.ColumnInt64(0), | 522 std::pair<VisitID, VisitSource> source_entry(statement.ColumnInt64(0), |
| 521 static_cast<VisitSource>(statement.ColumnInt(1))); | 523 static_cast<VisitSource>(statement.ColumnInt(1))); |
| 522 sources->insert(source_entry); | 524 sources->insert(source_entry); |
| 523 } | 525 } |
| 524 } | 526 } |
| 525 } | 527 } |
| 526 | 528 |
| 527 } // namespace history | 529 } // namespace history |
| OLD | NEW |