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

Unified Diff: chrome/browser/history/top_sites.cc

Issue 6901110: GTK: Query TopSites for the Most Visited pages and populate fill in the global History menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ooops. Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/top_sites.h ('k') | chrome/browser/ui/gtk/global_history_menu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/top_sites.cc
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index f985259f1e6e7e06d9c3e56461343e4de33493b0..483b021ffdd9a5e92c062d62178b873200c61d0d 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -370,6 +370,7 @@ void TopSites::AddBlacklistedURL(const GURL& url) {
}
ResetThreadSafeCache();
+ NotifyTopSitesChanged();
}
void TopSites::RemoveBlacklistedURL(const GURL& url) {
@@ -381,6 +382,7 @@ void TopSites::RemoveBlacklistedURL(const GURL& url) {
blacklist->RemoveWithoutPathExpansion(GetURLHash(url), NULL);
}
ResetThreadSafeCache();
+ NotifyTopSitesChanged();
}
bool TopSites::IsBlacklisted(const GURL& url) {
@@ -397,6 +399,7 @@ void TopSites::ClearBlacklistedURLs() {
blacklist->Clear();
}
ResetThreadSafeCache();
+ NotifyTopSitesChanged();
}
void TopSites::AddPinnedURL(const GURL& url, size_t pinned_index) {
@@ -419,6 +422,7 @@ void TopSites::AddPinnedURL(const GURL& url, size_t pinned_index) {
}
ResetThreadSafeCache();
+ NotifyTopSitesChanged();
}
bool TopSites::IsURLPinned(const GURL& url) {
@@ -437,6 +441,7 @@ void TopSites::RemovePinnedURL(const GURL& url) {
}
ResetThreadSafeCache();
+ NotifyTopSitesChanged();
}
bool TopSites::GetPinnedURLAtIndex(size_t index, GURL* url) {
@@ -832,11 +837,9 @@ void TopSites::SetTopSites(const MostVisitedURLList& new_top_sites) {
MostVisitedURLList top_sites(new_top_sites);
AddPrepopulatedPages(&top_sites);
- bool changed = false;
TopSitesDelta delta;
DiffMostVisited(cache_->top_sites(), top_sites, &delta);
if (!delta.deleted.empty() || !delta.added.empty() || !delta.moved.empty()) {
- changed = true;
backend_->UpdateTopSites(delta);
}
@@ -860,7 +863,6 @@ void TopSites::SetTopSites(const MostVisitedURLList& new_top_sites) {
SetPageThumbnailEncoded(mv.url,
it->second.thumbnail,
it->second.thumbnail_score);
- changed = true;
temp_images_.erase(it);
break;
}
@@ -873,13 +875,7 @@ void TopSites::SetTopSites(const MostVisitedURLList& new_top_sites) {
ResetThreadSafeCache();
ResetThreadSafeImageCache();
-
- if (changed) {
- NotificationService::current()->Notify(
- NotificationType::TOP_SITES_CHANGED,
- Source<TopSites>(this),
- NotificationService::NoDetails());
- }
+ NotifyTopSitesChanged();
// Restart the timer that queries history for top sites. This is done to
// ensure we stay in sync with history.
@@ -932,6 +928,13 @@ void TopSites::ResetThreadSafeImageCache() {
thread_safe_cache_->RemoveUnreferencedThumbnails();
}
+void TopSites::NotifyTopSitesChanged() {
+ NotificationService::current()->Notify(
+ NotificationType::TOP_SITES_CHANGED,
+ Source<TopSites>(this),
+ NotificationService::NoDetails());
+}
+
void TopSites::RestartQueryForTopSitesTimer(base::TimeDelta delta) {
if (timer_.IsRunning() && ((timer_start_time_ + timer_.GetCurrentDelay()) <
(base::TimeTicks::Now() + delta))) {
« no previous file with comments | « chrome/browser/history/top_sites.h ('k') | chrome/browser/ui/gtk/global_history_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698