| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "components/dom_distiller/core/distilled_page_prefs.h" |
| 9 #include "components/dom_distiller/core/dom_distiller_service.h" | 10 #include "components/dom_distiller/core/dom_distiller_service.h" |
| 10 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 11 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 class BrowserContext; | 14 class BrowserContext; |
| 14 } // namespace content | 15 } // namespace content |
| 15 | 16 |
| 16 namespace dom_distiller { | 17 namespace dom_distiller { |
| 17 | 18 |
| 18 // A simple wrapper for DomDistillerService to expose it as a | 19 // A simple wrapper for DomDistillerService to expose it as a |
| 19 // KeyedService. | 20 // KeyedService. |
| 20 class DomDistillerContextKeyedService : public KeyedService, | 21 class DomDistillerContextKeyedService : public KeyedService, |
| 21 public DomDistillerService { | 22 public DomDistillerService { |
| 22 public: | 23 public: |
| 23 DomDistillerContextKeyedService( | 24 DomDistillerContextKeyedService( |
| 24 scoped_ptr<DomDistillerStoreInterface> store, | 25 scoped_ptr<DomDistillerStoreInterface> store, |
| 25 scoped_ptr<DistillerFactory> distiller_factory, | 26 scoped_ptr<DistillerFactory> distiller_factory, |
| 26 scoped_ptr<DistillerPageFactory> distiller_page_factory); | 27 scoped_ptr<DistillerPageFactory> distiller_page_factory, |
| 28 scoped_ptr<DistilledPagePrefs> distilled_page_prefs); |
| 27 virtual ~DomDistillerContextKeyedService() {} | 29 virtual ~DomDistillerContextKeyedService() {} |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 DISALLOW_COPY_AND_ASSIGN(DomDistillerContextKeyedService); | 32 DISALLOW_COPY_AND_ASSIGN(DomDistillerContextKeyedService); |
| 31 }; | 33 }; |
| 32 | 34 |
| 33 class DomDistillerServiceFactory : public BrowserContextKeyedServiceFactory { | 35 class DomDistillerServiceFactory : public BrowserContextKeyedServiceFactory { |
| 34 public: | 36 public: |
| 35 static DomDistillerServiceFactory* GetInstance(); | 37 static DomDistillerServiceFactory* GetInstance(); |
| 36 static DomDistillerContextKeyedService* GetForBrowserContext( | 38 static DomDistillerContextKeyedService* GetForBrowserContext( |
| 37 content::BrowserContext* context); | 39 content::BrowserContext* context); |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 friend struct DefaultSingletonTraits<DomDistillerServiceFactory>; | 42 friend struct DefaultSingletonTraits<DomDistillerServiceFactory>; |
| 41 | 43 |
| 42 DomDistillerServiceFactory(); | 44 DomDistillerServiceFactory(); |
| 43 virtual ~DomDistillerServiceFactory(); | 45 virtual ~DomDistillerServiceFactory(); |
| 44 | 46 |
| 45 virtual KeyedService* BuildServiceInstanceFor( | 47 virtual KeyedService* BuildServiceInstanceFor( |
| 46 content::BrowserContext* context) const OVERRIDE; | 48 content::BrowserContext* context) const OVERRIDE; |
| 47 | 49 |
| 48 virtual content::BrowserContext* GetBrowserContextToUse( | 50 virtual content::BrowserContext* GetBrowserContextToUse( |
| 49 content::BrowserContext* context) const OVERRIDE; | 51 content::BrowserContext* context) const OVERRIDE; |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 } // namespace dom_distiller | 54 } // namespace dom_distiller |
| 53 | 55 |
| 54 #endif // CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_ | 56 #endif // CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_ |
| OLD | NEW |