Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chrome/browser/dom_distiller/dom_distiller_service_factory.cc

Issue 341563002: Theme Preferences for Distilled Pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/profiles/profile.h"
8 #include "components/dom_distiller/content/distiller_page_web_contents.h" 9 #include "components/dom_distiller/content/distiller_page_web_contents.h"
9 #include "components/dom_distiller/core/article_entry.h" 10 #include "components/dom_distiller/core/article_entry.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 "components/keyed_service/content/browser_context_dependency_manager.h" 13 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "components/leveldb_proto/proto_database.h" 14 #include "components/leveldb_proto/proto_database.h"
14 #include "components/leveldb_proto/proto_database_impl.h" 15 #include "components/leveldb_proto/proto_database_impl.h"
15 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 18
18 namespace dom_distiller { 19 namespace dom_distiller {
19 20
20 DomDistillerContextKeyedService::DomDistillerContextKeyedService( 21 DomDistillerContextKeyedService::DomDistillerContextKeyedService(
21 scoped_ptr<DomDistillerStoreInterface> store, 22 scoped_ptr<DomDistillerStoreInterface> store,
22 scoped_ptr<DistillerFactory> distiller_factory, 23 scoped_ptr<DistillerFactory> distiller_factory,
23 scoped_ptr<DistillerPageFactory> distiller_page_factory) 24 scoped_ptr<DistillerPageFactory> distiller_page_factory,
24 : DomDistillerService(store.Pass(), distiller_factory.Pass(), 25 scoped_ptr<ReaderModePrefs> reader_mode_prefs)
25 distiller_page_factory.Pass()) {} 26 : DomDistillerService(store.Pass(),
27 distiller_factory.Pass(),
28 distiller_page_factory.Pass(),
29 reader_mode_prefs.Pass()) {}
26 30
27 // static 31 // static
28 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() { 32 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() {
29 return Singleton<DomDistillerServiceFactory>::get(); 33 return Singleton<DomDistillerServiceFactory>::get();
30 } 34 }
31 35
32 // static 36 // static
33 DomDistillerContextKeyedService* 37 DomDistillerContextKeyedService*
34 DomDistillerServiceFactory::GetForBrowserContext( 38 DomDistillerServiceFactory::GetForBrowserContext(
35 content::BrowserContext* context) { 39 content::BrowserContext* context) {
(...skipping 29 matching lines...) Expand all
65 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( 69 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory(
66 new DistillerURLFetcherFactory(profile->GetRequestContext())); 70 new DistillerURLFetcherFactory(profile->GetRequestContext()));
67 71
68 dom_distiller::proto::DomDistillerOptions options; 72 dom_distiller::proto::DomDistillerOptions options;
69 if (VLOG_IS_ON(1)) { 73 if (VLOG_IS_ON(1)) {
70 options.set_debug_level(logging::GetVlogLevelHelper( 74 options.set_debug_level(logging::GetVlogLevelHelper(
71 FROM_HERE.file_name(), ::strlen(FROM_HERE.file_name()))); 75 FROM_HERE.file_name(), ::strlen(FROM_HERE.file_name())));
72 } 76 }
73 scoped_ptr<DistillerFactory> distiller_factory( 77 scoped_ptr<DistillerFactory> distiller_factory(
74 new DistillerFactoryImpl(distiller_url_fetcher_factory.Pass(), options)); 78 new DistillerFactoryImpl(distiller_url_fetcher_factory.Pass(), options));
79 scoped_ptr<ReaderModePrefs> reader_mode_prefs(
80 new ReaderModePrefs(Profile::FromBrowserContext(profile)->GetPrefs()));
81
75 82
76 DomDistillerContextKeyedService* service = 83 DomDistillerContextKeyedService* service =
77 new DomDistillerContextKeyedService( 84 new DomDistillerContextKeyedService(
78 dom_distiller_store.PassAs<DomDistillerStoreInterface>(), 85 dom_distiller_store.PassAs<DomDistillerStoreInterface>(),
79 distiller_factory.Pass(), distiller_page_factory.Pass()); 86 distiller_factory.Pass(), distiller_page_factory.Pass(),
80 87 reader_mode_prefs.Pass());
81 return service; 88 return service;
82 } 89 }
83 90
84 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( 91 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse(
85 content::BrowserContext* context) const { 92 content::BrowserContext* context) const {
86 // TODO(cjhopman): Do we want this to be 93 // TODO(cjhopman): Do we want this to be
87 // GetBrowserContextRedirectedInIncognito? 94 // GetBrowserContextRedirectedInIncognito?
88 return context; 95 return context;
89 } 96 }
90 97
91 } // namespace dom_distiller 98 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698