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 IOS_CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_NTP_CONTENT_NTP_CONTENT_SERVICE_FACTORY_H_ |
6 #define IOS_CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_NTP_CONTENT_NTP_CONTENT_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" | 10 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 template <typename T> | 13 template <typename T> |
14 struct DefaultSingletonTraits; | 14 struct DefaultSingletonTraits; |
15 } // namespace base | 15 } // namespace base |
16 | 16 |
17 namespace dom_distiller { | |
18 class DomDistillerService; | |
19 } | |
20 | |
21 namespace ios { | 17 namespace ios { |
22 class ChromeBrowserState; | 18 class ChromeBrowserState; |
23 } | 19 } |
24 | 20 |
25 namespace dom_distiller { | 21 namespace ntp_content { |
blundell
2015/11/16 16:00:53
nit: After some amount of thrashing, the naming co
noyau (Ping after 24h)
2015/11/17 10:36:10
Done.
| |
26 | 22 |
27 class DomDistillerServiceFactory : public BrowserStateKeyedServiceFactory { | 23 class NTPContentService; |
24 | |
25 // A factory to create NTPContentService and associate them to | |
26 // ios::ChromeBrowserState. | |
27 class NTPContentServiceFactory : public BrowserStateKeyedServiceFactory { | |
28 public: | 28 public: |
29 static DomDistillerServiceFactory* GetInstance(); | 29 static NTPContentServiceFactory* GetInstance(); |
30 static DomDistillerService* GetForBrowserState( | 30 static NTPContentService* GetForBrowserState( |
31 ios::ChromeBrowserState* browser_state); | 31 ios::ChromeBrowserState* browser_state); |
32 | 32 |
33 private: | 33 private: |
34 friend struct base::DefaultSingletonTraits<DomDistillerServiceFactory>; | 34 friend struct base::DefaultSingletonTraits<NTPContentServiceFactory>; |
35 | 35 |
36 DomDistillerServiceFactory(); | 36 NTPContentServiceFactory(); |
37 ~DomDistillerServiceFactory() override; | 37 ~NTPContentServiceFactory() override; |
38 | 38 |
39 // BrowserStateKeyedServiceFactory implementation. | 39 // BrowserStateKeyedServiceFactory implementation. |
40 scoped_ptr<KeyedService> BuildServiceInstanceFor( | 40 scoped_ptr<KeyedService> BuildServiceInstanceFor( |
41 web::BrowserState* context) const override; | 41 web::BrowserState* context) const override; |
42 web::BrowserState* GetBrowserStateToUse( | 42 web::BrowserState* GetBrowserStateToUse( |
43 web::BrowserState* context) const override; | 43 web::BrowserState* context) const override; |
44 | 44 |
45 DISALLOW_COPY(DomDistillerServiceFactory); | 45 DISALLOW_COPY_AND_ASSIGN(NTPContentServiceFactory); |
46 }; | 46 }; |
47 | 47 |
48 } // namespace dom_distiller | 48 } // namespace ntp_content |
49 | 49 |
50 #endif // IOS_CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_ | 50 #endif // IOS_CHROME_BROWSER_NTP_CONTENT_NTP_CONTENT_SERVICE_FACTORY_H_ |
OLD | NEW |