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