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 #include "components/dom_distiller/content/dom_distiller_service_factory.h"
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"
11 namespace dom_distiller {
13 DomDistillerContextKeyedService::DomDistillerContextKeyedService(
14 scoped_ptr<DomDistillerStoreInterface> store,
15 scoped_ptr<DistillerFactory> distiller_factory)
16 : DomDistillerService(store.Pass(), distiller_factory.Pass()) {}
19 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() {
20 return Singleton<DomDistillerServiceFactory>::get();
24 DomDistillerContextKeyedService*
25 DomDistillerServiceFactory::GetForBrowserContext(
26 content::BrowserContext* context) {
27 return static_cast<DomDistillerContextKeyedService*>(
28 GetInstance()->GetServiceForBrowserContext(context, true));
31 DomDistillerServiceFactory::DomDistillerServiceFactory()
32 : BrowserContextKeyedServiceFactory(
33 "DomDistillerService",
34 BrowserContextDependencyManager::GetInstance()) {}
36 DomDistillerServiceFactory::~DomDistillerServiceFactory() {}
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());
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