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

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

Issue 254483003: Start requiring DistillerPage for calls to DomDistillerService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 "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()) {}
21 24
22 // static 25 // static
23 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() { 26 DomDistillerServiceFactory* DomDistillerServiceFactory::GetInstance() {
24 return Singleton<DomDistillerServiceFactory>::get(); 27 return Singleton<DomDistillerServiceFactory>::get();
25 } 28 }
26 29
27 // static 30 // static
28 DomDistillerContextKeyedService* 31 DomDistillerContextKeyedService*
29 DomDistillerServiceFactory::GetForBrowserContext( 32 DomDistillerServiceFactory::GetForBrowserContext(
30 content::BrowserContext* context) { 33 content::BrowserContext* context) {
(...skipping 20 matching lines...) Expand all
51 base::FilePath database_dir( 54 base::FilePath database_dir(
52 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); 55 profile->GetPath().Append(FILE_PATH_LITERAL("Articles")));
53 56
54 scoped_ptr<DomDistillerStore> dom_distiller_store(new DomDistillerStore( 57 scoped_ptr<DomDistillerStore> dom_distiller_store(new DomDistillerStore(
55 db.PassAs<DomDistillerDatabaseInterface>(), database_dir)); 58 db.PassAs<DomDistillerDatabaseInterface>(), database_dir));
56 59
57 scoped_ptr<DistillerPageFactory> distiller_page_factory( 60 scoped_ptr<DistillerPageFactory> distiller_page_factory(
58 new DistillerPageWebContentsFactory(profile)); 61 new DistillerPageWebContentsFactory(profile));
59 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( 62 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory(
60 new DistillerURLFetcherFactory(profile->GetRequestContext())); 63 new DistillerURLFetcherFactory(profile->GetRequestContext()));
61 scoped_ptr<DistillerFactory> distiller_factory(new DistillerFactoryImpl( 64 scoped_ptr<DistillerFactory> distiller_factory(
62 distiller_page_factory.Pass(), distiller_url_fetcher_factory.Pass())); 65 new DistillerFactoryImpl(distiller_url_fetcher_factory.Pass()));
63 66
64 DomDistillerContextKeyedService* service = 67 DomDistillerContextKeyedService* service =
65 new DomDistillerContextKeyedService( 68 new DomDistillerContextKeyedService(
66 dom_distiller_store.PassAs<DomDistillerStoreInterface>(), 69 dom_distiller_store.PassAs<DomDistillerStoreInterface>(),
67 distiller_factory.Pass()); 70 distiller_factory.Pass(),
71 distiller_page_factory.Pass());
68 72
69 return service; 73 return service;
70 } 74 }
71 75
72 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( 76 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse(
73 content::BrowserContext* context) const { 77 content::BrowserContext* context) const {
74 // TODO(cjhopman): Do we want this to be 78 // TODO(cjhopman): Do we want this to be
75 // GetBrowserContextRedirectedInIncognito? 79 // GetBrowserContextRedirectedInIncognito?
76 return context; 80 return context;
77 } 81 }
78 82
79 } // namespace dom_distiller 83 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698