Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: chrome/browser/search/instant_service.h

Issue 2532103002: Add support for components/ntp_tiles in InstantService (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/local_ntp/most_visited_single.js ('k') | chrome/browser/search/instant_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « chrome/browser/resources/local_ntp/most_visited_single.js ('k') | chrome/browser/search/instant_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698