Chromium Code Reviews| Index: chrome/browser/history/top_sites_service_factory.h |
| diff --git a/chrome/browser/history/top_sites_service_factory.h b/chrome/browser/history/top_sites_service_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a93c248205d07e2a62e6700d8c08470c9843023c |
| --- /dev/null |
| +++ b/chrome/browser/history/top_sites_service_factory.h |
| @@ -0,0 +1,50 @@ |
| +// 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_SERVICE_FACTORY_H_ |
| +#define CHROME_BROWSER_HISTORY_TOP_SITES_SERVICE_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 TopSitesServiceFactory |
|
sdefresne
2014/12/29 09:48:14
nit: rename this class to 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( |
| + Profile* profile); |
| + |
| + // Get the singleton instance of the factory. |
| + static TopSitesServiceFactory* GetInstance(); |
| + |
| + // Creates and returns a TopSites Service for testing purposes. |
| + static scoped_refptr<RefcountedKeyedService> BuildProfileForTesting( |
|
sdefresne
2014/12/29 09:48:14
I don't think those two method needs to be 1. meth
Jitu( very slow this week)
2014/12/30 10:09:03
Done.
|
| + content::BrowserContext* profile); |
| + |
| + static scoped_refptr<RefcountedKeyedService> |
| + CreateCustomTopSitesServiceFactory(history::TopSites* top_sites); |
| + |
| + protected: |
| + // Overridden from BrowserContextKeyedServiceFactory. |
| + scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( |
| + content::BrowserContext* context) const override; |
| + |
| + private: |
| + friend struct DefaultSingletonTraits<TopSitesServiceFactory>; |
| + |
| + TopSitesServiceFactory(); |
| + ~TopSitesServiceFactory() override; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TopSitesServiceFactory); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_HISTORY_TOP_SITES_SERVICE_FACTORY_H_ |