Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ | |
| 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #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.
| |
| 10 #include "components/keyed_service/content/refcounted_browser_context_keyed_serv ice_factory.h" | |
| 11 | |
| 12 namespace history { | |
| 13 class TopSites; | |
| 14 } | |
| 15 | |
| 16 template <typename T> | |
| 17 struct DefaultSingletonTraits; | |
| 18 | |
| 19 // Used for creating and fetching a per-profile instance of the | |
| 20 // TopSites. | |
| 21 class TopSitesFactory : public RefcountedBrowserContextKeyedServiceFactory { | |
| 22 public: | |
| 23 // Get the TopSites service for |profile|, creating one if needed. | |
| 24 static scoped_refptr<history::TopSites> GetForProfile(Profile* profile); | |
| 25 | |
| 26 // Get the TopSites service for |profile|, but do not create it if it doesn't | |
| 27 // exist. | |
| 28 static scoped_refptr<history::TopSites> GetForProfileIfExists( | |
| 29 Profile* profile); | |
| 30 | |
| 31 // Get the singleton instance of the factory. | |
| 32 static TopSitesFactory* GetInstance(); | |
| 33 | |
| 34 private: | |
| 35 friend struct DefaultSingletonTraits<TopSitesFactory>; | |
| 36 // Overridden from BrowserContextKeyedServiceFactory. | |
| 37 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( | |
| 38 content::BrowserContext* context) const override; | |
| 39 bool ServiceIsNULLWhileTesting() const override; | |
| 40 | |
| 41 TopSitesFactory(); | |
| 42 ~TopSitesFactory() override; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(TopSitesFactory); | |
| 45 }; | |
| 46 | |
| 47 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ | |
| OLD | NEW |