Chromium Code Reviews| 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..32b9345dc2ad01e9db6eec72b9e8428fe7340f6a |
| --- /dev/null |
| +++ b/chrome/browser/history/top_sites_factory.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2015 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/profiles/profile.h" |
|
sdefresne
2015/01/23 13:25:46
nit: you can remove this #include and instead forw
Jitu( very slow this week)
2015/01/23 13:52:52
Done.
|
| +#include "components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h" |
| + |
| +namespace history { |
| +class TopSites; |
| +} |
| + |
| +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); |
| + |
| + // Get the TopSites service for |profile|, but do not create it if it doesn't |
| + // exist. |
| + static scoped_refptr<history::TopSites> GetForProfileIfExists( |
| + Profile* profile); |
| + |
| + // Get the singleton instance of the factory. |
| + static TopSitesFactory* GetInstance(); |
| + |
| + private: |
| + friend struct DefaultSingletonTraits<TopSitesFactory>; |
| + // Overridden from BrowserContextKeyedServiceFactory. |
| + scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( |
| + content::BrowserContext* context) const override; |
| + bool ServiceIsNULLWhileTesting() const override; |
| + |
| + TopSitesFactory(); |
| + ~TopSitesFactory() override; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TopSitesFactory); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ |