Index: chrome/browser/history/top_sites.h |
diff --git a/chrome/browser/history/top_sites.h b/chrome/browser/history/top_sites.h |
index 47ed7de8cfe4b78d75d2d05e6d687adafbeb744e..812737763b308610ebf7c00cc01e1ec8dfdfd3d2 100644 |
--- a/chrome/browser/history/top_sites.h |
+++ b/chrome/browser/history/top_sites.h |
@@ -11,6 +11,7 @@ |
#include "base/memory/ref_counted.h" |
#include "chrome/browser/history/history_service.h" |
#include "chrome/browser/history/history_types.h" |
+#include "chrome/browser/history/top_sites_observer.h" |
#include "components/history/core/common/thumbnail_score.h" |
#include "third_party/skia/include/core/SkColor.h" |
#include "ui/gfx/image/image.h" |
@@ -38,7 +39,7 @@ class TopSites |
: public base::RefCountedThreadSafe<TopSites>, |
public content::NotificationObserver { |
public: |
- TopSites() {} |
+ TopSites(); |
// Initializes TopSites. |
static TopSites* Create(Profile* profile, const base::FilePath& db_name); |
@@ -167,10 +168,42 @@ class TopSites |
// The best color to highlight the page (should roughly match favicon). |
SkColor color; |
}; |
+ |
+ // TopSitesObserver |
sdefresne
2014/08/04 08:47:18
Remove this comment block and the Observer type de
nshaik
2014/08/05 06:38:03
My bad.had the old code left there... deleted
On 2
|
+ // chrome::NOTIFICATION_TOP_SITES_LOADED |
+ // chrome::NOTIFICATION_TOP_SITES_CHANGED |
+ class Observer { |
+ public: |
+ virtual void OnTopSitesLoaded(TopSites* top_sites) = 0; |
+ virtual void OnTopSitesChanged(TopSites* top_sites) = 0; |
+ }; |
+ |
+ // Add Observer to the list. |
+ void AddObserver(TopSitesObserver* observer) { |
sdefresne
2014/08/04 08:47:18
style: do not inline functions, see http://www.chr
nshaik
2014/08/05 06:38:03
Done.
|
+ observer_list_.AddObserver(observer); |
+ } |
+ |
+ // Remove Observer from the list. |
+ void RemoveObserver(TopSitesObserver* observer) { |
+ observer_list_.RemoveObserver(observer); |
+ } |
+ |
+ void NotifyTopSitesLoaded() { |
sdefresne
2014/08/04 08:47:18
Move to the protected: section since this is only
nshaik
2014/08/05 06:38:03
Done.
|
+ FOR_EACH_OBSERVER(TopSitesObserver, observer_list_, TopSitesLoaded(this)); |
+ } |
+ |
+ void NotifyTopSitesChanged() { |
sdefresne
2014/08/04 08:47:18
Move to the protected: section since this is only
nshaik
2014/08/05 06:38:03
Done.
|
+ FOR_EACH_OBSERVER(TopSitesObserver, observer_list_, TopSitesChanged(this)); |
+ } |
+ |
+ // Get the current Profile. |
sdefresne
2014/08/04 08:47:18
Remove, instead pass the Profile to ChromeHistoryC
nshaik
2014/08/05 06:38:03
Done.
|
+ virtual Profile* GetProfile(); |
+ |
protected: |
- virtual ~TopSites() {} |
+ virtual ~TopSites(); |
private: |
+ ObserverList<TopSitesObserver> observer_list_; |
friend class base::RefCountedThreadSafe<TopSites>; |
}; |