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 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 5 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
6 | 6 |
7 #include "base/threading/sequenced_worker_pool.h" | 7 #include "base/threading/sequenced_worker_pool.h" |
8 #include "components/dom_distiller/content/distiller_page_web_contents.h" | 8 #include "components/dom_distiller/content/distiller_page_web_contents.h" |
9 #include "components/dom_distiller/core/distiller.h" | 9 #include "components/dom_distiller/core/distiller.h" |
10 #include "components/dom_distiller/core/dom_distiller_store.h" | 10 #include "components/dom_distiller/core/dom_distiller_store.h" |
11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
12 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 | 14 |
15 namespace dom_distiller { | 15 namespace dom_distiller { |
16 | 16 |
17 DomDistillerContextKeyedService::DomDistillerContextKeyedService( | 17 DomDistillerContextKeyedService::DomDistillerContextKeyedService( |
18 scoped_ptr<DomDistillerStoreInterface> store, | 18 scoped_ptr<DomDistillerStoreInterface> store, |
19 scoped_ptr<DistillerFactory> distiller_factory) | 19 scoped_ptr<DistillerFactory> distiller_factory, |
20 : DomDistillerService(store.Pass(), distiller_factory.Pass()) {} | 20 scoped_ptr<DistillerPageFactory> distiller_page_factory) |
| 21 : DomDistillerService(store.Pass(), |
| 22 distiller_factory.Pass(), |
| 23 distiller_page_factory.Pass()) { |
| 24 } |
21 | 25 |
22 // static | 26 // static |
23 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() { | 27 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() { |
24 return Singleton<DomDistillerServiceFactory>::get(); | 28 return Singleton<DomDistillerServiceFactory>::get(); |
25 } | 29 } |
26 | 30 |
27 // static | 31 // static |
28 DomDistillerContextKeyedService* | 32 DomDistillerContextKeyedService* |
29 DomDistillerServiceFactory::GetForBrowserContext( | 33 DomDistillerServiceFactory::GetForBrowserContext( |
30 content::BrowserContext* context) { | 34 content::BrowserContext* context) { |
(...skipping 20 matching lines...) Expand all Loading... |
51 base::FilePath database_dir( | 55 base::FilePath database_dir( |
52 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); | 56 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); |
53 | 57 |
54 scoped_ptr<DomDistillerStore> dom_distiller_store(new DomDistillerStore( | 58 scoped_ptr<DomDistillerStore> dom_distiller_store(new DomDistillerStore( |
55 db.PassAs<DomDistillerDatabaseInterface>(), database_dir)); | 59 db.PassAs<DomDistillerDatabaseInterface>(), database_dir)); |
56 | 60 |
57 scoped_ptr<DistillerPageFactory> distiller_page_factory( | 61 scoped_ptr<DistillerPageFactory> distiller_page_factory( |
58 new DistillerPageWebContentsFactory(profile)); | 62 new DistillerPageWebContentsFactory(profile)); |
59 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( | 63 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( |
60 new DistillerURLFetcherFactory(profile->GetRequestContext())); | 64 new DistillerURLFetcherFactory(profile->GetRequestContext())); |
61 scoped_ptr<DistillerFactory> distiller_factory(new DistillerFactoryImpl( | 65 scoped_ptr<DistillerFactory> distiller_factory( |
62 distiller_page_factory.Pass(), distiller_url_fetcher_factory.Pass())); | 66 new DistillerFactoryImpl(distiller_url_fetcher_factory.Pass())); |
63 | 67 |
64 DomDistillerContextKeyedService* service = | 68 DomDistillerContextKeyedService* service = |
65 new DomDistillerContextKeyedService( | 69 new DomDistillerContextKeyedService( |
66 dom_distiller_store.PassAs<DomDistillerStoreInterface>(), | 70 dom_distiller_store.PassAs<DomDistillerStoreInterface>(), |
67 distiller_factory.Pass()); | 71 distiller_factory.Pass(), |
| 72 distiller_page_factory.Pass()); |
68 | 73 |
69 return service; | 74 return service; |
70 } | 75 } |
71 | 76 |
72 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( | 77 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( |
73 content::BrowserContext* context) const { | 78 content::BrowserContext* context) const { |
74 // TODO(cjhopman): Do we want this to be | 79 // TODO(cjhopman): Do we want this to be |
75 // GetBrowserContextRedirectedInIncognito? | 80 // GetBrowserContextRedirectedInIncognito? |
76 return context; | 81 return context; |
77 } | 82 } |
78 | 83 |
79 } // namespace dom_distiller | 84 } // namespace dom_distiller |
OLD | NEW |