Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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/history/top_sites.h" | |
| 10 #include "components/keyed_service/content/refcounted_browser_context_keyed_serv ice_factory.h" | |
| 11 | |
| 12 template <typename T> | |
| 13 struct DefaultSingletonTraits; | |
| 14 | |
| 15 // Used for creating and fetching a per-profile instance of the | |
| 16 // TopSites. | |
| 17 class TopSitesFactory : public RefcountedBrowserContextKeyedServiceFactory { | |
| 18 public: | |
| 19 // Get the TopSites service for |profile|, creating one if needed. | |
| 20 static scoped_refptr<history::TopSites> GetForProfile(Profile* profile); | |
| 21 | |
| 22 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.
| |
| 23 Profile* profile); | |
| 24 | |
| 25 // Get the singleton instance of the factory. | |
| 26 static TopSitesFactory* GetInstance(); | |
| 27 | |
| 28 protected: | |
| 29 // Overridden from BrowserContextKeyedServiceFactory. | |
| 30 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( | |
| 31 content::BrowserContext* context) const override; | |
| 32 | |
| 33 private: | |
| 34 friend struct DefaultSingletonTraits<TopSitesFactory>; | |
| 35 | |
| 36 TopSitesFactory(); | |
| 37 ~TopSitesFactory() override; | |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(TopSitesFactory); | |
| 40 }; | |
| 41 | |
| 42 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ | |
| OLD | NEW |