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

Unified Diff: content/utility/utility_service_factory.cc

Issue 2832633002: Add PDF compositor service (Closed)
Patch Set: remove headers Created 3 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 side-by-side diff with in-line comments
Download patch
Index: content/utility/utility_service_factory.cc
diff --git a/content/utility/utility_service_factory.cc b/content/utility/utility_service_factory.cc
index 73c2cf8e242ec6c5af2eb1b5ce7287bfc60aa711..cae7a1381af366213b3b1569e6d0c9b14721ab2b 100644
--- a/content/utility/utility_service_factory.cc
+++ b/content/utility/utility_service_factory.cc
@@ -4,6 +4,9 @@
#include "content/utility/utility_service_factory.h"
+#include <memory>
+#include <utility>
+
#include "base/bind.h"
#include "base/command_line.h"
#include "content/child/child_process.h"
@@ -14,6 +17,7 @@
#include "content/public/utility/content_utility_client.h"
#include "content/public/utility/utility_thread.h"
#include "content/utility/utility_thread_impl.h"
+#include "printing/features/features.h"
#include "services/data_decoder/data_decoder_service.h"
#include "services/data_decoder/public/interfaces/constants.mojom.h"
#include "services/shape_detection/public/interfaces/constants.mojom.h"
@@ -23,6 +27,13 @@
#include "media/mojo/services/media_service_factory.h" // nogncheck
#endif
+#if BUILDFLAG(ENABLE_PRINTING)
+// nogncheck because dependency on //printing is conditional upon
jam 2017/04/24 15:18:05 content/ currently doesn't know about components/p
Wei Li 2017/04/27 05:34:16 Done.
+// enable_basic_printing or enable_print_preview flags.
+#include "components/printing/service/pdf_compositor_service.h" // nogncheck
+#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h" // nogncheck
+#endif
+
namespace content {
namespace {
@@ -32,6 +43,16 @@ std::unique_ptr<service_manager::Service> CreateDataDecoderService() {
return data_decoder::DataDecoderService::Create();
}
+#if BUILDFLAG(ENABLE_PRINTING)
+std::unique_ptr<service_manager::Service> CreatePdfCompositorService() {
+ content::UtilityThread::Get()->EnsureBlinkInitialized();
+ content::UtilityThread::Get()->EnsureReadyForSkia();
+ return printing::PdfCompositorService::Create(
+ GetContentClient()->GetUserAgent(),
+ ChildProcess::current()->io_task_runner());
+}
+#endif
+
} // namespace
UtilityServiceFactory::UtilityServiceFactory() {}
@@ -65,6 +86,13 @@ void UtilityServiceFactory::RegisterServices(ServiceMap* services) {
services->insert(
std::make_pair(content::mojom::kNetworkServiceName, network_info));
}
+
+#if BUILDFLAG(ENABLE_PRINTING)
+ ServiceInfo pdf_compositor_info;
+ pdf_compositor_info.factory = base::Bind(&CreatePdfCompositorService);
+ services->insert(
+ std::make_pair(printing::mojom::kServiceName, pdf_compositor_info));
+#endif
}
void UtilityServiceFactory::OnServiceQuit() {

Powered by Google App Engine
This is Rietveld 408576698