| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/history/top_sites.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 for (std::map<GURL, size_t>::const_iterator i = all_old_urls.begin(); | 436 for (std::map<GURL, size_t>::const_iterator i = all_old_urls.begin(); |
| 437 i != all_old_urls.end(); ++i) { | 437 i != all_old_urls.end(); ++i) { |
| 438 if (i->second != kAlreadyFoundMarker) | 438 if (i->second != kAlreadyFoundMarker) |
| 439 delta->deleted.push_back(old_list[i->second]); | 439 delta->deleted.push_back(old_list[i->second]); |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 | 442 |
| 443 CancelableRequestProvider::Handle TopSites::StartQueryForMostVisited() { | 443 CancelableRequestProvider::Handle TopSites::StartQueryForMostVisited() { |
| 444 DCHECK(loaded_); | 444 DCHECK(loaded_); |
| 445 if (!profile_) | 445 if (!profile_) |
| 446 return NULL; | 446 return 0; |
| 447 | 447 |
| 448 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 448 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
| 449 // |hs| may be null during unit tests. | 449 // |hs| may be null during unit tests. |
| 450 if (hs) { | 450 if (hs) { |
| 451 return hs->QueryMostVisitedURLs( | 451 return hs->QueryMostVisitedURLs( |
| 452 num_results_to_request_from_history(), | 452 num_results_to_request_from_history(), |
| 453 kDaysOfHistory, | 453 kDaysOfHistory, |
| 454 &cancelable_consumer_, | 454 &cancelable_consumer_, |
| 455 NewCallback(this, &TopSites::OnTopSitesAvailableFromHistory)); | 455 NewCallback(this, &TopSites::OnTopSitesAvailableFromHistory)); |
| 456 } | 456 } |
| 457 return NULL; | 457 return 0; |
| 458 } | 458 } |
| 459 | 459 |
| 460 TopSites::~TopSites() { | 460 TopSites::~TopSites() { |
| 461 } | 461 } |
| 462 | 462 |
| 463 bool TopSites::SetPageThumbnailNoDB(const GURL& url, | 463 bool TopSites::SetPageThumbnailNoDB(const GURL& url, |
| 464 const RefCountedBytes* thumbnail_data, | 464 const RefCountedBytes* thumbnail_data, |
| 465 const ThumbnailScore& score) { | 465 const ThumbnailScore& score) { |
| 466 // This should only be invoked when we know about the url. | 466 // This should only be invoked when we know about the url. |
| 467 DCHECK(cache_->IsKnownURL(url)); | 467 DCHECK(cache_->IsKnownURL(url)); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 SetTopSites(pages); | 910 SetTopSites(pages); |
| 911 | 911 |
| 912 // Used only in testing. | 912 // Used only in testing. |
| 913 NotificationService::current()->Notify( | 913 NotificationService::current()->Notify( |
| 914 NotificationType::TOP_SITES_UPDATED, | 914 NotificationType::TOP_SITES_UPDATED, |
| 915 Source<TopSites>(this), | 915 Source<TopSites>(this), |
| 916 Details<CancelableRequestProvider::Handle>(&handle)); | 916 Details<CancelableRequestProvider::Handle>(&handle)); |
| 917 } | 917 } |
| 918 | 918 |
| 919 } // namespace history | 919 } // namespace history |
| OLD | NEW |