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