Index: chrome/browser/search/instant_service.h |
diff --git a/chrome/browser/search/instant_service.h b/chrome/browser/search/instant_service.h |
index 8ccebcd86b28d38672e83b044206a57f56b57810..47d4f34d3ccd776112972a8f5b4e8a489c025def 100644 |
--- a/chrome/browser/search/instant_service.h |
+++ b/chrome/browser/search/instant_service.h |
@@ -11,11 +11,14 @@ |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
#include "base/observer_list.h" |
#include "components/history/core/browser/history_types.h" |
#include "components/history/core/browser/top_sites_observer.h" |
#include "components/keyed_service/core/keyed_service.h" |
+#include "components/ntp_tiles/most_visited_sites.h" |
+#include "components/ntp_tiles/ntp_tile.h" |
#include "components/search_engines/template_url_service_observer.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
@@ -34,11 +37,16 @@ namespace content { |
class RenderProcessHost; |
} |
+namespace history { |
+class TopSites; |
+} |
+ |
// Tracks render process host IDs that are associated with Instant. |
class InstantService : public KeyedService, |
public content::NotificationObserver, |
public TemplateURLServiceObserver, |
- public history::TopSitesObserver { |
+ public history::TopSitesObserver, |
+ public ntp_tiles::MostVisitedSites::Observer { |
public: |
explicit InstantService(Profile* profile); |
~InstantService() override; |
@@ -127,7 +135,12 @@ class InstantService : public KeyedService, |
// Called when we get new most visited items from TopSites, registered as an |
// async callback. Parses them and sends them to the renderer via |
// NotifyAboutMostVisitedItems. |
- void OnMostVisitedItemsReceived(const history::MostVisitedURLList& data); |
+ void OnTopSitesReceived(const history::MostVisitedURLList& data); |
+ |
+ // ntp_tiles::MostVisitedSites::Observer implementation. |
+ void OnMostVisitedURLsAvailable( |
+ const ntp_tiles::NTPTilesVector& tiles) override; |
+ void OnIconMadeAvailable(const GURL& site_url) override; |
// Notifies the observer about the last known most visited items. |
void NotifyAboutMostVisitedItems(); |
@@ -168,6 +181,11 @@ class InstantService : public KeyedService, |
std::unique_ptr<TemplateURLData> previous_default_search_provider_; |
GURL previous_google_base_url_; |
+ // Data sources for NTP tiles (aka Most Visited tiles). Only one of these will |
+ // be non-null. |
+ std::unique_ptr<ntp_tiles::MostVisitedSites> most_visited_sites_; |
+ scoped_refptr<history::TopSites> top_sites_; |
+ |
// Used for Top Sites async retrieval. |
base::WeakPtrFactory<InstantService> weak_ptr_factory_; |