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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "components/dom_distiller/content/browser/distiller_page_web_contents.h
" | 12 #include "components/dom_distiller/content/browser/distiller_page_web_contents.h
" |
13 #include "components/dom_distiller/core/article_entry.h" | 13 #include "components/dom_distiller/core/article_entry.h" |
14 #include "components/dom_distiller/core/distiller.h" | 14 #include "components/dom_distiller/core/distiller.h" |
15 #include "components/dom_distiller/core/dom_distiller_store.h" | 15 #include "components/dom_distiller/core/dom_distiller_store.h" |
16 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
17 #include "components/leveldb_proto/proto_database.h" | 17 #include "components/leveldb_proto/proto_database.h" |
18 #include "components/leveldb_proto/proto_database_impl.h" | 18 #include "components/leveldb_proto/proto_database_impl.h" |
19 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/storage_partition.h" |
21 | 22 |
22 namespace dom_distiller { | 23 namespace dom_distiller { |
23 | 24 |
24 DomDistillerContextKeyedService::DomDistillerContextKeyedService( | 25 DomDistillerContextKeyedService::DomDistillerContextKeyedService( |
25 scoped_ptr<DomDistillerStoreInterface> store, | 26 scoped_ptr<DomDistillerStoreInterface> store, |
26 scoped_ptr<DistillerFactory> distiller_factory, | 27 scoped_ptr<DistillerFactory> distiller_factory, |
27 scoped_ptr<DistillerPageFactory> distiller_page_factory, | 28 scoped_ptr<DistillerPageFactory> distiller_page_factory, |
28 scoped_ptr<DistilledPagePrefs> distilled_page_prefs) | 29 scoped_ptr<DistilledPagePrefs> distilled_page_prefs) |
29 : DomDistillerService(std::move(store), | 30 : DomDistillerService(std::move(store), |
30 std::move(distiller_factory), | 31 std::move(distiller_factory), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 64 |
64 base::FilePath database_dir( | 65 base::FilePath database_dir( |
65 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); | 66 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); |
66 | 67 |
67 scoped_ptr<DomDistillerStore> dom_distiller_store( | 68 scoped_ptr<DomDistillerStore> dom_distiller_store( |
68 new DomDistillerStore(std::move(db), database_dir)); | 69 new DomDistillerStore(std::move(db), database_dir)); |
69 | 70 |
70 scoped_ptr<DistillerPageFactory> distiller_page_factory( | 71 scoped_ptr<DistillerPageFactory> distiller_page_factory( |
71 new DistillerPageWebContentsFactory(profile)); | 72 new DistillerPageWebContentsFactory(profile)); |
72 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( | 73 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( |
73 new DistillerURLFetcherFactory(profile->GetRequestContext())); | 74 new DistillerURLFetcherFactory( |
| 75 content::BrowserContext::GetDefaultStoragePartition(profile)-> |
| 76 GetURLRequestContext())); |
74 | 77 |
75 dom_distiller::proto::DomDistillerOptions options; | 78 dom_distiller::proto::DomDistillerOptions options; |
76 if (VLOG_IS_ON(1)) { | 79 if (VLOG_IS_ON(1)) { |
77 options.set_debug_level(logging::GetVlogLevelHelper( | 80 options.set_debug_level(logging::GetVlogLevelHelper( |
78 FROM_HERE.file_name(), ::strlen(FROM_HERE.file_name()))); | 81 FROM_HERE.file_name(), ::strlen(FROM_HERE.file_name()))); |
79 } | 82 } |
80 // Options for pagination algorithm: | 83 // Options for pagination algorithm: |
81 // - "next": detect anchors with "next" text | 84 // - "next": detect anchors with "next" text |
82 // - "pagenum": detect anchors with numeric page numbers | 85 // - "pagenum": detect anchors with numeric page numbers |
83 // Default is "next". | 86 // Default is "next". |
(...skipping 11 matching lines...) Expand all Loading... |
95 return service; | 98 return service; |
96 } | 99 } |
97 | 100 |
98 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( | 101 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( |
99 content::BrowserContext* context) const { | 102 content::BrowserContext* context) const { |
100 // Makes normal profile and off-the-record profile use same service instance. | 103 // Makes normal profile and off-the-record profile use same service instance. |
101 return chrome::GetBrowserContextRedirectedInIncognito(context); | 104 return chrome::GetBrowserContextRedirectedInIncognito(context); |
102 } | 105 } |
103 | 106 |
104 } // namespace dom_distiller | 107 } // namespace dom_distiller |
OLD | NEW |