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

Unified Diff: chrome/browser/history/top_sites_factory.h

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review comments Created 5 years, 11 months 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
Index: chrome/browser/history/top_sites_factory.h
diff --git a/chrome/browser/history/top_sites_factory.h b/chrome/browser/history/top_sites_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..4fe014a12d73cf6546e2ed61678fa722680a0b75
--- /dev/null
+++ b/chrome/browser/history/top_sites_factory.h
@@ -0,0 +1,42 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_
+#define CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_
+
+#include "base/memory/ref_counted.h"
+#include "chrome/browser/history/top_sites.h"
+#include "components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h"
+
+template <typename T>
+struct DefaultSingletonTraits;
+
+// Used for creating and fetching a per-profile instance of the
+// TopSites.
+class TopSitesFactory : public RefcountedBrowserContextKeyedServiceFactory {
+ public:
+ // Get the TopSites service for |profile|, creating one if needed.
+ static scoped_refptr<history::TopSites> GetForProfile(Profile* profile);
+
+ static scoped_refptr<history::TopSites> GetForProfileIfExists(
sdefresne 2015/01/08 10:41:01 nit: please comment this method.
Jitu( very slow this week) 2015/01/12 11:30:08 Done.
+ Profile* profile);
+
+ // Get the singleton instance of the factory.
+ static TopSitesFactory* GetInstance();
+
+ protected:
+ // Overridden from BrowserContextKeyedServiceFactory.
+ scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor(
+ content::BrowserContext* context) const override;
+
+ private:
+ friend struct DefaultSingletonTraits<TopSitesFactory>;
+
+ TopSitesFactory();
+ ~TopSitesFactory() override;
+
+ DISALLOW_COPY_AND_ASSIGN(TopSitesFactory);
+};
+
+#endif // CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698