Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: chrome/browser/history/top_sites_impl.cc

Issue 441623002: Eliminate sending NOTIFICATION_TOP_SITES_* from TopSites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix incorrect parmeter being passed in notification Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 filtered_urls_nonforced.assign(thread_safe_cache_->top_sites().begin() + 867 filtered_urls_nonforced.assign(thread_safe_cache_->top_sites().begin() +
868 thread_safe_cache_->GetNumForcedURLs(), 868 thread_safe_cache_->GetNumForcedURLs(),
869 thread_safe_cache_->top_sites().end()); 869 thread_safe_cache_->top_sites().end());
870 pending_callbacks.swap(pending_callbacks_); 870 pending_callbacks.swap(pending_callbacks_);
871 } 871 }
872 } 872 }
873 873
874 for (size_t i = 0; i < pending_callbacks.size(); i++) 874 for (size_t i = 0; i < pending_callbacks.size(); i++)
875 pending_callbacks[i].Run(filtered_urls_all, filtered_urls_nonforced); 875 pending_callbacks[i].Run(filtered_urls_all, filtered_urls_nonforced);
876 876
877 content::NotificationService::current()->Notify( 877 NotifyTopSitesLoaded();
878 chrome::NOTIFICATION_TOP_SITES_LOADED,
879 content::Source<Profile>(profile_),
880 content::Details<TopSites>(this));
881 } 878 }
882 879
883 void TopSitesImpl::ResetThreadSafeCache() { 880 void TopSitesImpl::ResetThreadSafeCache() {
884 base::AutoLock lock(lock_); 881 base::AutoLock lock(lock_);
885 MostVisitedURLList cached; 882 MostVisitedURLList cached;
886 ApplyBlacklist(cache_->top_sites(), &cached); 883 ApplyBlacklist(cache_->top_sites(), &cached);
887 thread_safe_cache_->SetTopSites(cached); 884 thread_safe_cache_->SetTopSites(cached);
888 } 885 }
889 886
890 void TopSitesImpl::ResetThreadSafeImageCache() { 887 void TopSitesImpl::ResetThreadSafeImageCache() {
891 base::AutoLock lock(lock_); 888 base::AutoLock lock(lock_);
892 thread_safe_cache_->SetThumbnails(cache_->images()); 889 thread_safe_cache_->SetThumbnails(cache_->images());
893 } 890 }
894 891
895 void TopSitesImpl::NotifyTopSitesChanged() {
896 content::NotificationService::current()->Notify(
897 chrome::NOTIFICATION_TOP_SITES_CHANGED,
898 content::Source<TopSites>(this),
899 content::NotificationService::NoDetails());
900 }
901
902 void TopSitesImpl::RestartQueryForTopSitesTimer(base::TimeDelta delta) { 892 void TopSitesImpl::RestartQueryForTopSitesTimer(base::TimeDelta delta) {
903 if (timer_.IsRunning() && ((timer_start_time_ + timer_.GetCurrentDelay()) < 893 if (timer_.IsRunning() && ((timer_start_time_ + timer_.GetCurrentDelay()) <
904 (base::TimeTicks::Now() + delta))) { 894 (base::TimeTicks::Now() + delta))) {
905 return; 895 return;
906 } 896 }
907 897
908 timer_start_time_ = base::TimeTicks::Now(); 898 timer_start_time_ = base::TimeTicks::Now();
909 timer_.Stop(); 899 timer_.Stop();
910 timer_.Start(FROM_HERE, delta, this, &TopSitesImpl::TimerFired); 900 timer_.Start(FROM_HERE, delta, this, &TopSitesImpl::TimerFired);
911 } 901 }
(...skipping 17 matching lines...) Expand all
929 base::TimeDelta::FromSeconds(kUpdateIntervalSecs)); 919 base::TimeDelta::FromSeconds(kUpdateIntervalSecs));
930 } 920 }
931 921
932 void TopSitesImpl::OnTopSitesAvailableFromHistory( 922 void TopSitesImpl::OnTopSitesAvailableFromHistory(
933 const MostVisitedURLList* pages) { 923 const MostVisitedURLList* pages) {
934 DCHECK(pages); 924 DCHECK(pages);
935 SetTopSites(*pages); 925 SetTopSites(*pages);
936 } 926 }
937 927
938 } // namespace history 928 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_impl.h ('k') | chrome/browser/history/top_sites_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698