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/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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 return false; | 484 return false; |
485 | 485 |
486 *from_url = GURL(statement.ColumnString(0)); | 486 *from_url = GURL(statement.ColumnString(0)); |
487 } | 487 } |
488 return true; | 488 return true; |
489 } | 489 } |
490 | 490 |
491 bool VisitDatabase::GetVisibleVisitCountToHost(const GURL& url, | 491 bool VisitDatabase::GetVisibleVisitCountToHost(const GURL& url, |
492 int* count, | 492 int* count, |
493 base::Time* first_visit) { | 493 base::Time* first_visit) { |
494 if (!url.SchemeIs(chrome::kHttpScheme) && | 494 if (!url.SchemeIs(content::kHttpScheme) && |
495 !url.SchemeIs(content::kHttpsScheme)) | 495 !url.SchemeIs(content::kHttpsScheme)) |
496 return false; | 496 return false; |
497 | 497 |
498 // We need to search for URLs with a matching host/port. One way to query for | 498 // We need to search for URLs with a matching host/port. One way to query for |
499 // this is to use the LIKE operator, eg 'url LIKE http://google.com/%'. This | 499 // this is to use the LIKE operator, eg 'url LIKE http://google.com/%'. This |
500 // is inefficient though in that it doesn't use the index and each entry must | 500 // is inefficient though in that it doesn't use the index and each entry must |
501 // be visited. The same query can be executed by using >= and < operator. | 501 // be visited. The same query can be executed by using >= and < operator. |
502 // The query becomes: | 502 // The query becomes: |
503 // 'url >= http://google.com/' and url < http://google.com0'. | 503 // 'url >= http://google.com/' and url < http://google.com0'. |
504 // 0 is used as it is one character greater than '/'. | 504 // 0 is used as it is one character greater than '/'. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 while (statement.Step()) { | 617 while (statement.Step()) { |
618 BriefVisitInfo info; | 618 BriefVisitInfo info; |
619 info.url_id = statement.ColumnInt64(0); | 619 info.url_id = statement.ColumnInt64(0); |
620 info.time = base::Time::FromInternalValue(statement.ColumnInt64(1)); | 620 info.time = base::Time::FromInternalValue(statement.ColumnInt64(1)); |
621 info.transition = content::PageTransitionFromInt(statement.ColumnInt(2)); | 621 info.transition = content::PageTransitionFromInt(statement.ColumnInt(2)); |
622 result_vector->push_back(info); | 622 result_vector->push_back(info); |
623 } | 623 } |
624 } | 624 } |
625 | 625 |
626 } // namespace history | 626 } // namespace history |
OLD | NEW |