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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_
8 #include "base/memory/singleton.h"
9 #include "components/dom_distiller/core/distilled_page_prefs.h"
10 #include "components/dom_distiller/core/dom_distiller_service.h"
11 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
12 #include "components/keyed_service/core/keyed_service.h"
16 } // namespace content
18 namespace dom_distiller
{
20 // A simple wrapper for DomDistillerService to expose it as a
22 class DomDistillerContextKeyedService
: public KeyedService
,
23 public DomDistillerService
{
25 DomDistillerContextKeyedService(
26 scoped_ptr
<DomDistillerStoreInterface
> store
,
27 scoped_ptr
<DistillerFactory
> distiller_factory
,
28 scoped_ptr
<DistillerPageFactory
> distiller_page_factory
,
29 scoped_ptr
<DistilledPagePrefs
> distilled_page_prefs
);
30 ~DomDistillerContextKeyedService() override
{}
33 DISALLOW_COPY_AND_ASSIGN(DomDistillerContextKeyedService
);
36 class DomDistillerServiceFactory
: public BrowserContextKeyedServiceFactory
{
38 static DomDistillerServiceFactory
* GetInstance();
39 static DomDistillerContextKeyedService
* GetForBrowserContext(
40 content::BrowserContext
* context
);
43 friend struct DefaultSingletonTraits
<DomDistillerServiceFactory
>;
45 DomDistillerServiceFactory();
46 ~DomDistillerServiceFactory() override
;
48 KeyedService
* BuildServiceInstanceFor(
49 content::BrowserContext
* context
) const override
;
51 content::BrowserContext
* GetBrowserContextToUse(
52 content::BrowserContext
* context
) const override
;
55 } // namespace dom_distiller
57 #endif // CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_