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 "chrome/common/url_constants.h" |
8 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 9 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
9 #include "components/dom_distiller/content/distiller_page_web_contents.h" | 10 #include "components/dom_distiller/content/distiller_page_web_contents.h" |
| 11 #include "components/dom_distiller/content/dom_distiller_viewer_source.h" |
10 #include "components/dom_distiller/core/distiller.h" | 12 #include "components/dom_distiller/core/distiller.h" |
11 #include "components/dom_distiller/core/dom_distiller_store.h" | 13 #include "components/dom_distiller/core/dom_distiller_store.h" |
12 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/url_data_source.h" |
14 | 17 |
15 namespace dom_distiller { | 18 namespace dom_distiller { |
16 | 19 |
17 DomDistillerContextKeyedService::DomDistillerContextKeyedService( | 20 DomDistillerContextKeyedService::DomDistillerContextKeyedService( |
18 scoped_ptr<DomDistillerStoreInterface> store, | 21 scoped_ptr<DomDistillerStoreInterface> store, |
19 scoped_ptr<DistillerFactory> distiller_factory) | 22 scoped_ptr<DistillerFactory> distiller_factory) |
20 : DomDistillerService(store.Pass(), distiller_factory.Pass()) {} | 23 : DomDistillerService(store.Pass(), distiller_factory.Pass()) {} |
21 | 24 |
22 // static | 25 // static |
23 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() { | 26 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() { |
(...skipping 10 matching lines...) Expand all Loading... |
34 | 37 |
35 DomDistillerServiceFactory::DomDistillerServiceFactory() | 38 DomDistillerServiceFactory::DomDistillerServiceFactory() |
36 : BrowserContextKeyedServiceFactory( | 39 : BrowserContextKeyedServiceFactory( |
37 "DomDistillerService", | 40 "DomDistillerService", |
38 BrowserContextDependencyManager::GetInstance()) {} | 41 BrowserContextDependencyManager::GetInstance()) {} |
39 | 42 |
40 DomDistillerServiceFactory::~DomDistillerServiceFactory() {} | 43 DomDistillerServiceFactory::~DomDistillerServiceFactory() {} |
41 | 44 |
42 BrowserContextKeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor( | 45 BrowserContextKeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor( |
43 content::BrowserContext* profile) const { | 46 content::BrowserContext* profile) const { |
| 47 content::URLDataSource::Add( |
| 48 profile, new DomDistillerViewerSource(chrome::kDomDistillerScheme)); |
44 | 49 |
45 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 50 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
46 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( | 51 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( |
47 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); | 52 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); |
48 | 53 |
49 scoped_ptr<DomDistillerDatabase> db( | 54 scoped_ptr<DomDistillerDatabase> db( |
50 new DomDistillerDatabase(background_task_runner)); | 55 new DomDistillerDatabase(background_task_runner)); |
51 | 56 |
52 base::FilePath database_dir( | 57 base::FilePath database_dir( |
53 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); | 58 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); |
(...skipping 16 matching lines...) Expand all Loading... |
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 |