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

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

Issue 441623002: Eliminate sending NOTIFICATION_TOP_SITES_* from TopSites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing the commit message Created 6 years, 4 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
Index: chrome/browser/history/chrome_history_client.cc
diff --git a/chrome/browser/history/chrome_history_client.cc b/chrome/browser/history/chrome_history_client.cc
index 8f359abba144684b03cf1435ead04dfd8d0ae9da..f7b5f7ef528e53923a567ea14300e31111dba607 100644
--- a/chrome/browser/history/chrome_history_client.cc
+++ b/chrome/browser/history/chrome_history_client.cc
@@ -5,15 +5,30 @@
#include "chrome/browser/history/chrome_history_client.h"
#include "base/logging.h"
+#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/history/history_notifications.h"
+#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/ui/profile_error_dialog.h"
#include "chrome/common/chrome_version_info.h"
#include "components/bookmarks/browser/bookmark_model.h"
+#include "content/public/browser/notification_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
-ChromeHistoryClient::ChromeHistoryClient(BookmarkModel* bookmark_model)
- : bookmark_model_(bookmark_model) {
+ChromeHistoryClient::ChromeHistoryClient(BookmarkModel* bookmark_model,
+ Profile* profile,
+ history::TopSites* top_sites)
+ : bookmark_model_(bookmark_model),
+ profile_(profile),
+ top_sites_(top_sites) {
DCHECK(bookmark_model_);
+ if (top_sites_)
+ top_sites_->AddObserver(this);
+}
+
+ChromeHistoryClient::~ChromeHistoryClient() {
+ if (top_sites_)
+ top_sites_->RemoveObserver(this);
}
void ChromeHistoryClient::BlockUntilBookmarksLoaded() {
@@ -65,3 +80,17 @@ void ChromeHistoryClient::Shutdown() {
// sees an incorrect view of bookmarks, but it's better than a deadlock.
bookmark_model_->Shutdown();
}
+
+void ChromeHistoryClient::TopSitesLoaded(history::TopSites* top_sites) {
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_TOP_SITES_LOADED,
+ content::Source<Profile>(profile_),
+ content::Details<history::TopSites>(top_sites));
+}
+
+void ChromeHistoryClient::TopSitesChanged(history::TopSites* top_sites) {
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_TOP_SITES_CHANGED,
+ content::Source<Profile>(profile_),
+ content::NotificationService::NoDetails());
+}

Powered by Google App Engine
This is Rietveld 408576698