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/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 8 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
9 #include "components/dom_distiller/content/distiller_page_web_contents.h" | 9 #include "components/dom_distiller/content/distiller_page_web_contents.h" |
| 10 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" |
10 #include "components/dom_distiller/core/distiller.h" | 11 #include "components/dom_distiller/core/distiller.h" |
11 #include "components/dom_distiller/core/dom_distiller_store.h" | 12 #include "components/dom_distiller/core/dom_distiller_store.h" |
12 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/url_data_source.h" |
14 | 16 |
15 namespace dom_distiller { | 17 namespace dom_distiller { |
16 | 18 |
17 DomDistillerContextKeyedService::DomDistillerContextKeyedService( | 19 DomDistillerContextKeyedService::DomDistillerContextKeyedService( |
18 scoped_ptr<DomDistillerStoreInterface> store, | 20 scoped_ptr<DomDistillerStoreInterface> store, |
19 scoped_ptr<DistillerFactory> distiller_factory) | 21 scoped_ptr<DistillerFactory> distiller_factory) |
20 : DomDistillerService(store.Pass(), distiller_factory.Pass()) {} | 22 : DomDistillerService(store.Pass(), distiller_factory.Pass()) {} |
21 | 23 |
22 // static | 24 // static |
23 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() { | 25 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() { |
(...skipping 10 matching lines...) Expand all Loading... |
34 | 36 |
35 DomDistillerServiceFactory::DomDistillerServiceFactory() | 37 DomDistillerServiceFactory::DomDistillerServiceFactory() |
36 : BrowserContextKeyedServiceFactory( | 38 : BrowserContextKeyedServiceFactory( |
37 "DomDistillerService", | 39 "DomDistillerService", |
38 BrowserContextDependencyManager::GetInstance()) {} | 40 BrowserContextDependencyManager::GetInstance()) {} |
39 | 41 |
40 DomDistillerServiceFactory::~DomDistillerServiceFactory() {} | 42 DomDistillerServiceFactory::~DomDistillerServiceFactory() {} |
41 | 43 |
42 BrowserContextKeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor( | 44 BrowserContextKeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor( |
43 content::BrowserContext* profile) const { | 45 content::BrowserContext* profile) const { |
| 46 content::URLDataSource::Add(profile, new DomDistillerViewerSource()); |
44 | 47 |
45 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 48 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
46 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( | 49 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( |
47 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); | 50 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); |
48 | 51 |
49 scoped_ptr<DomDistillerDatabase> db( | 52 scoped_ptr<DomDistillerDatabase> db( |
50 new DomDistillerDatabase(background_task_runner)); | 53 new DomDistillerDatabase(background_task_runner)); |
51 | 54 |
52 base::FilePath database_dir( | 55 base::FilePath database_dir( |
53 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); | 56 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); |
(...skipping 16 matching lines...) Expand all Loading... |
70 } | 73 } |
71 | 74 |
72 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( | 75 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( |
73 content::BrowserContext* context) const { | 76 content::BrowserContext* context) const { |
74 // TODO(cjhopman): Do we want this to be | 77 // TODO(cjhopman): Do we want this to be |
75 // GetBrowserContextRedirectedInIncognito? | 78 // GetBrowserContextRedirectedInIncognito? |
76 return context; | 79 return context; |
77 } | 80 } |
78 | 81 |
79 } // namespace dom_distiller | 82 } // namespace dom_distiller |
OLD | NEW |