X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fhistory%2Fchrome_history_client.h;h=92f918609c7c6004b453b46268db77f605171449;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=1a02506fb8ab437cbd147c4c26d5acc818eb197f;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/history/chrome_history_client.h b/src/chrome/browser/history/chrome_history_client.h index 1a02506..92f9186 100644 --- a/src/chrome/browser/history/chrome_history_client.h +++ b/src/chrome/browser/history/chrome_history_client.h @@ -7,14 +7,24 @@ #include "base/macros.h" #include "components/history/core/browser/history_client.h" +#include "components/history/core/browser/top_sites_observer.h" class BookmarkModel; +class Profile; + +namespace history { +class TopSites; +} // This class implements history::HistoryClient to abstract operations that // depend on Chrome environment. -class ChromeHistoryClient : public history::HistoryClient { +class ChromeHistoryClient : public history::HistoryClient, + public history::TopSitesObserver { public: - explicit ChromeHistoryClient(BookmarkModel* bookmark_model); + explicit ChromeHistoryClient(BookmarkModel* bookmark_model, + Profile* profile, + history::TopSites* top_sites); + virtual ~ChromeHistoryClient(); // history::HistoryClient: virtual void BlockUntilBookmarksLoaded() OVERRIDE; @@ -27,9 +37,25 @@ class ChromeHistoryClient : public history::HistoryClient { // KeyedService: virtual void Shutdown() OVERRIDE; + // TopSitesObserver: + virtual void TopSitesLoaded(history::TopSites* top_sites) OVERRIDE; + virtual void TopSitesChanged(history::TopSites* top_sites) OVERRIDE; + private: // The BookmarkModel, this should outlive ChromeHistoryClient. BookmarkModel* bookmark_model_; + Profile* profile_; + // The TopSites object is owned by the Profile (see + // chrome/browser/profiles/profile_impl.h) + // and lazily constructed by the getter. + // ChromeHistoryClient is a KeyedService linked to the Profile lifetime by the + // ChromeHistoryClientFactory (which is a BrowserContextKeyedServiceFactory). + // Before the Profile is destroyed, all the KeyedService Shutdown methods are + // called, and the Profile is fully constructed before any of the KeyedService + // can be constructed. The TopSites does not use the HistoryService nor the + // HistoryClient during construction (it uses it later, but supports getting + // an NULL pointer). + history::TopSites* top_sites_; DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); };