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..b0bd2fc9213f011a07fa38426739b04e70a49599 100644 |
| --- a/chrome/browser/history/chrome_history_client.cc |
| +++ b/chrome/browser/history/chrome_history_client.cc |
| @@ -5,15 +5,29 @@ |
| #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) { |
| +class Profile; |
|
sdefresne
2014/08/04 08:47:17
Remove, this is un-necessary.
nshaik
2014/08/05 06:38:03
Done.
|
| + |
| +ChromeHistoryClient::ChromeHistoryClient(BookmarkModel* bookmark_model, |
|
sdefresne
2014/08/04 08:47:18
Receive Profile* as an additional parameter and st
nshaik
2014/08/05 06:38:02
Done.
|
| + history::TopSites* top_sites) |
| + : bookmark_model_(bookmark_model), 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 +79,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>(top_sites->GetProfile()), |
|
sdefresne
2014/08/04 08:47:18
Use saved pointer to the Profile*.
nshaik
2014/08/05 06:38:02
Done.
|
| + 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>(top_sites->GetProfile()), |
|
sdefresne
2014/08/04 08:47:17
Same.
nshaik
2014/08/05 06:38:02
Done.
|
| + content::NotificationService::NoDetails()); |
| +} |