ee3765946c1743907a1c84a9ff1afbbf5c4e47fd
[platform/framework/web/crosswalk.git] / src / chrome / browser / dom_distiller / dom_distiller_service_factory.h
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.
4
5 #ifndef CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_
7
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
13 namespace content {
14 class BrowserContext;
15 }  // namespace content
16
17 namespace dom_distiller {
18
19 // A simple wrapper for DomDistillerService to expose it as a
20 // KeyedService.
21 class DomDistillerContextKeyedService : public KeyedService,
22                                         public DomDistillerService {
23  public:
24   DomDistillerContextKeyedService(
25       scoped_ptr<DomDistillerStoreInterface> store,
26       scoped_ptr<DistillerFactory> distiller_factory,
27       scoped_ptr<DistillerPageFactory> distiller_page_factory,
28       scoped_ptr<DistilledPagePrefs> distilled_page_prefs);
29   virtual ~DomDistillerContextKeyedService() {}
30
31  private:
32   DISALLOW_COPY_AND_ASSIGN(DomDistillerContextKeyedService);
33 };
34
35 class DomDistillerServiceFactory : public BrowserContextKeyedServiceFactory {
36  public:
37   static DomDistillerServiceFactory* GetInstance();
38   static DomDistillerContextKeyedService* GetForBrowserContext(
39       content::BrowserContext* context);
40
41  private:
42   friend struct DefaultSingletonTraits<DomDistillerServiceFactory>;
43
44   DomDistillerServiceFactory();
45   virtual ~DomDistillerServiceFactory();
46
47   virtual KeyedService* BuildServiceInstanceFor(
48       content::BrowserContext* context) const OVERRIDE;
49
50   virtual content::BrowserContext* GetBrowserContextToUse(
51       content::BrowserContext* context) const OVERRIDE;
52 };
53
54 }  // namespace dom_distiller
55
56 #endif  // CHROME_BROWSER_DOM_DISTILLER_DOM_DISTILLER_SERVICE_FACTORY_H_