Chromium Code Reviews| 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( |
|
sdefresne
2014/08/11 09:43:23
nit: DCHECK(top_sites == top_sites_);
|
| + 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( |
|
sdefresne
2014/08/11 09:43:23
nit: DCHECK(top_sites == top_sites_);
|
| + chrome::NOTIFICATION_TOP_SITES_CHANGED, |
| + content::Source<Profile>(profile_), |
| + content::NotificationService::NoDetails()); |
| +} |