- add sources.
[platform/framework/web/crosswalk.git] / src / components / dom_distiller / content / dom_distiller_service_factory.cc
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 #include "components/dom_distiller/content/dom_distiller_service_factory.h"
6
7 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
8 #include "components/dom_distiller/core/distiller.h"
9 #include "components/dom_distiller/core/dom_distiller_store.h"
10
11 namespace dom_distiller {
12
13 DomDistillerContextKeyedService::DomDistillerContextKeyedService(
14     scoped_ptr<DomDistillerStoreInterface> store,
15     scoped_ptr<DistillerFactory> distiller_factory)
16     : DomDistillerService(store.Pass(), distiller_factory.Pass()) {}
17
18 // static
19 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() {
20   return Singleton<DomDistillerServiceFactory>::get();
21 }
22
23 // static
24 DomDistillerContextKeyedService*
25 DomDistillerServiceFactory::GetForBrowserContext(
26     content::BrowserContext* context) {
27   return static_cast<DomDistillerContextKeyedService*>(
28       GetInstance()->GetServiceForBrowserContext(context, true));
29 }
30
31 DomDistillerServiceFactory::DomDistillerServiceFactory()
32     : BrowserContextKeyedServiceFactory(
33           "DomDistillerService",
34           BrowserContextDependencyManager::GetInstance()) {}
35
36 DomDistillerServiceFactory::~DomDistillerServiceFactory() {}
37
38 BrowserContextKeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor(
39     content::BrowserContext* profile) const {
40   scoped_ptr<DomDistillerStoreInterface> dom_distiller_store;
41   scoped_ptr<DistillerFactory> distiller_factory;
42   return new DomDistillerContextKeyedService(dom_distiller_store.Pass(),
43                                              distiller_factory.Pass());
44 }
45
46 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse(
47     content::BrowserContext* context) const {
48   // TODO(cjhopman): Do we want this to be
49   // GetBrowserContextRedirectedInIncognito? If so, find some way to use that in
50   // components/.
51   return context;
52 }
53
54 }  // namespace apps