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_SERVICE_FACTORY_H_ | |
6 #define CHROME_BROWSER_HISTORY_TOP_SITES_SERVICE_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 TopSitesServiceFactory | |
sdefresne
2014/12/29 09:48:14
nit: rename this class to TopSitesFactory
| |
18 : public RefcountedBrowserContextKeyedServiceFactory { | |
19 public: | |
20 // Get the TopSites service for |profile|, creating one if needed. | |
21 static scoped_refptr<history::TopSites> GetForProfile(Profile* profile); | |
22 | |
23 static scoped_refptr<history::TopSites> GetForProfileIfExists( | |
24 Profile* profile); | |
25 | |
26 // Get the singleton instance of the factory. | |
27 static TopSitesServiceFactory* GetInstance(); | |
28 | |
29 // Creates and returns a TopSites Service for testing purposes. | |
30 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.
| |
31 content::BrowserContext* profile); | |
32 | |
33 static scoped_refptr<RefcountedKeyedService> | |
34 CreateCustomTopSitesServiceFactory(history::TopSites* top_sites); | |
35 | |
36 protected: | |
37 // Overridden from BrowserContextKeyedServiceFactory. | |
38 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( | |
39 content::BrowserContext* context) const override; | |
40 | |
41 private: | |
42 friend struct DefaultSingletonTraits<TopSitesServiceFactory>; | |
43 | |
44 TopSitesServiceFactory(); | |
45 ~TopSitesServiceFactory() override; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(TopSitesServiceFactory); | |
48 }; | |
49 | |
50 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_SERVICE_FACTORY_H_ | |
OLD | NEW |