| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/top_sites_impl.h" | 5 #include "chrome/browser/history/top_sites_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 delta->deleted.push_back(old_list[i->second]); | 443 delta->deleted.push_back(old_list[i->second]); |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 | 446 |
| 447 base::CancelableTaskTracker::TaskId TopSitesImpl::StartQueryForMostVisited() { | 447 base::CancelableTaskTracker::TaskId TopSitesImpl::StartQueryForMostVisited() { |
| 448 DCHECK(loaded_); | 448 DCHECK(loaded_); |
| 449 if (!profile_) | 449 if (!profile_) |
| 450 return base::CancelableTaskTracker::kBadTaskId; | 450 return base::CancelableTaskTracker::kBadTaskId; |
| 451 | 451 |
| 452 HistoryService* hs = HistoryServiceFactory::GetForProfile( | 452 HistoryService* hs = HistoryServiceFactory::GetForProfile( |
| 453 profile_, Profile::EXPLICIT_ACCESS); | 453 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
| 454 // |hs| may be null during unit tests. | 454 // |hs| may be null during unit tests. |
| 455 if (hs) { | 455 if (hs) { |
| 456 return hs->QueryMostVisitedURLs( | 456 return hs->QueryMostVisitedURLs( |
| 457 num_results_to_request_from_history(), | 457 num_results_to_request_from_history(), |
| 458 kDaysOfHistory, | 458 kDaysOfHistory, |
| 459 base::Bind(&TopSitesImpl::OnTopSitesAvailableFromHistory, | 459 base::Bind(&TopSitesImpl::OnTopSitesAvailableFromHistory, |
| 460 base::Unretained(this)), | 460 base::Unretained(this)), |
| 461 &cancelable_task_tracker_); | 461 &cancelable_task_tracker_); |
| 462 } | 462 } |
| 463 return base::CancelableTaskTracker::kBadTaskId; | 463 return base::CancelableTaskTracker::kBadTaskId; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 base::TimeDelta::FromSeconds(kUpdateIntervalSecs)); | 919 base::TimeDelta::FromSeconds(kUpdateIntervalSecs)); |
| 920 } | 920 } |
| 921 | 921 |
| 922 void TopSitesImpl::OnTopSitesAvailableFromHistory( | 922 void TopSitesImpl::OnTopSitesAvailableFromHistory( |
| 923 const MostVisitedURLList* pages) { | 923 const MostVisitedURLList* pages) { |
| 924 DCHECK(pages); | 924 DCHECK(pages); |
| 925 SetTopSites(*pages); | 925 SetTopSites(*pages); |
| 926 } | 926 } |
| 927 | 927 |
| 928 } // namespace history | 928 } // namespace history |
| OLD | NEW |