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

Unified Diff: components/dom_distiller/content/dom_distiller_service_factory.cc

Issue 63553009: Initialize DomDistillerStore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add include Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/dom_distiller/core/dom_distiller_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/content/dom_distiller_service_factory.cc
diff --git a/components/dom_distiller/content/dom_distiller_service_factory.cc b/components/dom_distiller/content/dom_distiller_service_factory.cc
index a5d7e0de44ed86915381d4b5c9194210c681a7f5..0b88cf3d632cb18cc047703c633689ce53bf55e4 100644
--- a/components/dom_distiller/content/dom_distiller_service_factory.cc
+++ b/components/dom_distiller/content/dom_distiller_service_factory.cc
@@ -4,11 +4,13 @@
#include "components/dom_distiller/content/dom_distiller_service_factory.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "components/dom_distiller/content/distiller_page_web_contents.h"
#include "components/dom_distiller/core/distiller.h"
#include "components/dom_distiller/core/dom_distiller_store.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/browser_thread.h"
namespace dom_distiller {
@@ -39,15 +41,32 @@ DomDistillerServiceFactory::~DomDistillerServiceFactory() {}
BrowserContextKeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const {
- scoped_ptr<DomDistillerStoreInterface> dom_distiller_store;
+
+ scoped_refptr<base::SequencedTaskRunner> background_task_runner =
+ content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
+ content::BrowserThread::GetBlockingPool()->GetSequenceToken());
+
+ scoped_ptr<DomDistillerDatabase> db(
+ new DomDistillerDatabase(background_task_runner));
+
+ base::FilePath database_dir(
+ profile->GetPath().Append(FILE_PATH_LITERAL("Articles")));
+
+ scoped_ptr<DomDistillerStore> dom_distiller_store(
+ new DomDistillerStore(db.PassAs<DomDistillerDatabaseInterface>(),
+ database_dir));
+
scoped_ptr<DistillerPageFactory> distiller_page_factory(
new DistillerPageWebContentsFactory(profile));
scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory(
new DistillerURLFetcherFactory(profile->GetRequestContext()));
- scoped_ptr<DistillerFactory> distiller_factory(new DistillerFactoryImpl(
- distiller_page_factory.Pass(), distiller_url_fetcher_factory.Pass()));
- return new DomDistillerContextKeyedService(dom_distiller_store.Pass(),
- distiller_factory.Pass());
+ scoped_ptr<DistillerFactory> distiller_factory(
+ new DistillerFactoryImpl(distiller_page_factory.Pass(),
+ distiller_url_fetcher_factory.Pass()));
+ return new DomDistillerContextKeyedService(
+ dom_distiller_store.PassAs<DomDistillerStoreInterface>(),
+ distiller_factory.Pass());
+
}
content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse(
« no previous file with comments | « no previous file | components/dom_distiller/core/dom_distiller_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698