Commit 6c35041e authored by Jay Civelli's avatar Jay Civelli Committed by Commit Bot

Servicifying PdfToEmfConverter.

Moving the PdfToEmfConverter interface to the printing service.
As a result, simplified the client of that interface in
chrome/browser/printing/pdf_to_emf_converter.cc:
- merging PdfConverterUtilityProcessHostClient and PdfConverterImpl.
- calls on the service can now happen on the UI thread instead of the
  IO thread

Renamed the mojom::PdfToEmfConverter implementation from
PdfToEmfConverterImpl to PdfToEmfConverter as is now preferred naming
style for Mojo interface implementation.

Bug: 766451
Change-Id: Ic748547f56bb193a558210f97558640ef8d6e44b
Reviewed-on: https://chromium-review.googlesource.com/826308Reviewed-by: default avatarWill Harris <wfh@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Jay Civelli <jcivelli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524534}
parent a834c680
...@@ -3271,6 +3271,7 @@ split_static_library("browser") { ...@@ -3271,6 +3271,7 @@ split_static_library("browser") {
"printing/pdf_to_emf_converter.cc", "printing/pdf_to_emf_converter.cc",
"printing/pdf_to_emf_converter.h", "printing/pdf_to_emf_converter.h",
] ]
deps += [ "//chrome/services/printing/public/interfaces" ]
} }
if (enable_print_preview) { if (enable_print_preview) {
# Full printing on top of the above. # Full printing on top of the above.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <memory> #include <memory>
#include "base/callback.h" #include "base/callback_forward.h"
#include "base/memory/ref_counted_memory.h" #include "base/memory/ref_counted_memory.h"
namespace printing { namespace printing {
......
...@@ -275,7 +275,7 @@ void PrintJob::StartPdfToEmfConversion( ...@@ -275,7 +275,7 @@ void PrintJob::StartPdfToEmfConversion(
print_text_with_gdi ? PdfRenderSettings::Mode::GDI_TEXT print_text_with_gdi ? PdfRenderSettings::Mode::GDI_TEXT
: PdfRenderSettings::Mode::NORMAL); : PdfRenderSettings::Mode::NORMAL);
pdf_conversion_state_->Start( pdf_conversion_state_->Start(
bytes, settings, base::Bind(&PrintJob::OnPdfConversionStarted, this)); bytes, settings, base::BindOnce(&PrintJob::OnPdfConversionStarted, this));
} }
void PrintJob::OnPdfConversionStarted(int page_count) { void PrintJob::OnPdfConversionStarted(int page_count) {
...@@ -321,7 +321,7 @@ void PrintJob::StartPdfToTextConversion( ...@@ -321,7 +321,7 @@ void PrintJob::StartPdfToTextConversion(
/*autorotate=*/true, /*autorotate=*/true,
PdfRenderSettings::Mode::TEXTONLY); PdfRenderSettings::Mode::TEXTONLY);
pdf_conversion_state_->Start( pdf_conversion_state_->Start(
bytes, settings, base::Bind(&PrintJob::OnPdfConversionStarted, this)); bytes, settings, base::BindOnce(&PrintJob::OnPdfConversionStarted, this));
} }
void PrintJob::StartPdfToPostScriptConversion( void PrintJob::StartPdfToPostScriptConversion(
...@@ -338,7 +338,7 @@ void PrintJob::StartPdfToPostScriptConversion( ...@@ -338,7 +338,7 @@ void PrintJob::StartPdfToPostScriptConversion(
ps_level2 ? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2 ps_level2 ? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3); : PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3);
pdf_conversion_state_->Start( pdf_conversion_state_->Start(
bytes, settings, base::Bind(&PrintJob::OnPdfConversionStarted, this)); bytes, settings, base::BindOnce(&PrintJob::OnPdfConversionStarted, this));
} }
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
......
...@@ -213,7 +213,6 @@ static_library("common") { ...@@ -213,7 +213,6 @@ static_library("common") {
"//chrome/app/theme:theme_resources", "//chrome/app/theme:theme_resources",
"//chrome/common:constants", "//chrome/common:constants",
"//chrome/common/net", "//chrome/common/net",
"//chrome/common/printing:interfaces",
"//chrome/common/profiling", "//chrome/common/profiling",
"//chrome/installer/util:with_no_strings", "//chrome/installer/util:with_no_strings",
"//components/cast_certificate", "//components/cast_certificate",
......
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
mojom("interfaces") {
sources = [
"pdf_to_emf_converter.mojom",
]
deps = [
"//chrome/services/printing/public/interfaces",
"//mojo/common:common_custom_types",
"//ui/gfx/geometry/mojo",
]
}
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
...@@ -22,6 +22,17 @@ source_set("lib") { ...@@ -22,6 +22,17 @@ source_set("lib") {
"//chrome/services/printing/public/interfaces", "//chrome/services/printing/public/interfaces",
"//services/service_manager/public/cpp", "//services/service_manager/public/cpp",
] ]
if (is_win) {
sources += [
"pdf_to_emf_converter.cc",
"pdf_to_emf_converter.h",
"pdf_to_emf_converter_factory.cc",
"pdf_to_emf_converter_factory.h",
]
deps += [ "//skia" ]
}
} }
service_manifest("manifest") { service_manifest("manifest") {
......
{ {
"name": "chrome_printing", "name": "chrome_printing",
"display_name": "Printing", "display_name": "Printing",
"sandbox_type": "utility",
"interface_provider_specs": { "interface_provider_specs": {
"service_manager:connector": { "service_manager:connector": {
"provides": { "provides": {
"converter": [ "printing::mojom::PdfToPwgRasterConverter" ] "converter": [
"printing::mojom::PdfToEmfConverterFactory",
"printing::mojom::PdfToPwgRasterConverter" ]
}, },
"requires": { "requires": {
"service_manager": [ "service_manager:all_users" ] "service_manager": [ "service_manager:all_users" ]
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/utility/printing/pdf_to_emf_converter_impl.h" #include "chrome/services/printing/pdf_to_emf_converter.h"
#include <algorithm> #include <algorithm>
...@@ -61,7 +61,7 @@ void RegisterConverterClient(mojom::PdfToEmfConverterClientPtr client) { ...@@ -61,7 +61,7 @@ void RegisterConverterClient(mojom::PdfToEmfConverterClientPtr client) {
} // namespace } // namespace
PdfToEmfConverterImpl::PdfToEmfConverterImpl( PdfToEmfConverter::PdfToEmfConverter(
mojo::ScopedHandle pdf_file_in, mojo::ScopedHandle pdf_file_in,
const printing::PdfRenderSettings& pdf_render_settings, const printing::PdfRenderSettings& pdf_render_settings,
mojom::PdfToEmfConverterClientPtr client) mojom::PdfToEmfConverterClientPtr client)
...@@ -90,15 +90,15 @@ PdfToEmfConverterImpl::PdfToEmfConverterImpl( ...@@ -90,15 +90,15 @@ PdfToEmfConverterImpl::PdfToEmfConverterImpl(
base::PlatformFile pdf_file; base::PlatformFile pdf_file;
if (mojo::UnwrapPlatformFile(std::move(pdf_file_in), &pdf_file) != if (mojo::UnwrapPlatformFile(std::move(pdf_file_in), &pdf_file) !=
MOJO_RESULT_OK) { MOJO_RESULT_OK) {
LOG(ERROR) << "Invalid PDF file passed to PdfToEmfConverterImpl"; LOG(ERROR) << "Invalid PDF file passed to PdfToEmfConverter.";
return; return;
} }
LoadPdf(base::File(pdf_file)); LoadPdf(base::File(pdf_file));
} }
PdfToEmfConverterImpl::~PdfToEmfConverterImpl() = default; PdfToEmfConverter::~PdfToEmfConverter() = default;
void PdfToEmfConverterImpl::LoadPdf(base::File pdf_file) { void PdfToEmfConverter::LoadPdf(base::File pdf_file) {
int64_t length64 = pdf_file.GetLength(); int64_t length64 = pdf_file.GetLength();
if (length64 <= 0 || length64 > std::numeric_limits<int>::max()) if (length64 <= 0 || length64 > std::numeric_limits<int>::max())
return; return;
...@@ -114,10 +114,10 @@ void PdfToEmfConverterImpl::LoadPdf(base::File pdf_file) { ...@@ -114,10 +114,10 @@ void PdfToEmfConverterImpl::LoadPdf(base::File pdf_file) {
total_page_count_ = page_count; total_page_count_ = page_count;
} }
bool PdfToEmfConverterImpl::RenderPdfPageToMetafile(int page_number, bool PdfToEmfConverter::RenderPdfPageToMetafile(int page_number,
base::File output_file, base::File output_file,
float* scale_factor, float* scale_factor,
bool postscript) { bool postscript) {
Emf metafile; Emf metafile;
metafile.Init(); metafile.Init();
...@@ -160,9 +160,9 @@ bool PdfToEmfConverterImpl::RenderPdfPageToMetafile(int page_number, ...@@ -160,9 +160,9 @@ bool PdfToEmfConverterImpl::RenderPdfPageToMetafile(int page_number,
return metafile.SaveTo(&output_file); return metafile.SaveTo(&output_file);
} }
void PdfToEmfConverterImpl::ConvertPage(uint32_t page_number, void PdfToEmfConverter::ConvertPage(uint32_t page_number,
mojo::ScopedHandle emf_file_out, mojo::ScopedHandle emf_file_out,
ConvertPageCallback callback) { ConvertPageCallback callback) {
if (page_number >= total_page_count_) { if (page_number >= total_page_count_) {
std::move(callback).Run(/*success=*/false, /*scale_factor=*/0.0); std::move(callback).Run(/*success=*/false, /*scale_factor=*/0.0);
return; return;
......
...@@ -2,24 +2,24 @@ ...@@ -2,24 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_UTILITY_PRINTING_PDF_TO_EMF_CONVERTER_IMPL_H_ #ifndef CHROME_SERVICES_PRINTING_PDF_TO_EMF_CONVERTER_H_
#define CHROME_UTILITY_PRINTING_PDF_TO_EMF_CONVERTER_IMPL_H_ #define CHROME_SERVICES_PRINTING_PDF_TO_EMF_CONVERTER_H_
#include <vector> #include <vector>
#include "base/files/file.h" #include "base/files/file.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/common/printing/pdf_to_emf_converter.mojom.h" #include "chrome/services/printing/public/interfaces/pdf_to_emf_converter.mojom.h"
#include "printing/pdf_render_settings.h" #include "printing/pdf_render_settings.h"
namespace printing { namespace printing {
class PdfToEmfConverterImpl : public mojom::PdfToEmfConverter { class PdfToEmfConverter : public mojom::PdfToEmfConverter {
public: public:
PdfToEmfConverterImpl(mojo::ScopedHandle pdf_file_in, PdfToEmfConverter(mojo::ScopedHandle pdf_file_in,
const PdfRenderSettings& render_settings, const PdfRenderSettings& render_settings,
mojom::PdfToEmfConverterClientPtr client); mojom::PdfToEmfConverterClientPtr client);
~PdfToEmfConverterImpl() override; ~PdfToEmfConverter() override;
int total_page_count() const { return total_page_count_; } int total_page_count() const { return total_page_count_; }
...@@ -39,9 +39,9 @@ class PdfToEmfConverterImpl : public mojom::PdfToEmfConverter { ...@@ -39,9 +39,9 @@ class PdfToEmfConverterImpl : public mojom::PdfToEmfConverter {
PdfRenderSettings pdf_render_settings_; PdfRenderSettings pdf_render_settings_;
std::vector<char> pdf_data_; std::vector<char> pdf_data_;
DISALLOW_COPY_AND_ASSIGN(PdfToEmfConverterImpl); DISALLOW_COPY_AND_ASSIGN(PdfToEmfConverter);
}; };
} // namespace printing } // namespace printing
#endif // CHROME_UTILITY_PRINTING_PDF_TO_EMF_CONVERTER_IMPL_H_ #endif // CHROME_SERVICES_PRINTING_PDF_TO_EMF_CONVERTER_H_
...@@ -2,24 +2,26 @@ ...@@ -2,24 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/utility/printing/pdf_to_emf_converter_factory_impl.h" #include "chrome/services/printing/pdf_to_emf_converter_factory.h"
#include "chrome/utility/printing/pdf_to_emf_converter_impl.h" #include "chrome/services/printing/pdf_to_emf_converter.h"
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/system/platform_handle.h" #include "mojo/public/cpp/system/platform_handle.h"
namespace printing { namespace printing {
PdfToEmfConverterFactoryImpl::PdfToEmfConverterFactoryImpl() = default; PdfToEmfConverterFactory::PdfToEmfConverterFactory(
std::unique_ptr<service_manager::ServiceContextRef> service_ref)
: service_ref_(std::move(service_ref)) {}
PdfToEmfConverterFactoryImpl::~PdfToEmfConverterFactoryImpl() = default; PdfToEmfConverterFactory::~PdfToEmfConverterFactory() = default;
void PdfToEmfConverterFactoryImpl::CreateConverter( void PdfToEmfConverterFactory::CreateConverter(
mojo::ScopedHandle pdf_file_in, mojo::ScopedHandle pdf_file_in,
const printing::PdfRenderSettings& render_settings, const PdfRenderSettings& render_settings,
mojom::PdfToEmfConverterClientPtr client, mojom::PdfToEmfConverterClientPtr client,
CreateConverterCallback callback) { CreateConverterCallback callback) {
auto converter = std::make_unique<PdfToEmfConverterImpl>( auto converter = std::make_unique<PdfToEmfConverter>(
std::move(pdf_file_in), render_settings, std::move(client)); std::move(pdf_file_in), render_settings, std::move(client));
uint32_t page_count = converter->total_page_count(); uint32_t page_count = converter->total_page_count();
mojom::PdfToEmfConverterPtr converter_ptr; mojom::PdfToEmfConverterPtr converter_ptr;
...@@ -29,11 +31,4 @@ void PdfToEmfConverterFactoryImpl::CreateConverter( ...@@ -29,11 +31,4 @@ void PdfToEmfConverterFactoryImpl::CreateConverter(
std::move(callback).Run(std::move(converter_ptr), page_count); std::move(callback).Run(std::move(converter_ptr), page_count);
} }
// static
void PdfToEmfConverterFactoryImpl::Create(
mojom::PdfToEmfConverterFactoryRequest request) {
mojo::MakeStrongBinding(base::MakeUnique<PdfToEmfConverterFactoryImpl>(),
std::move(request));
}
} // namespace printing } // namespace printing
...@@ -2,31 +2,33 @@ ...@@ -2,31 +2,33 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_UTILITY_PRINTING_PDF_TO_EMF_CONVERTER_FACTORY_IMPL_H_ #ifndef CHROME_SERVICES_PRINTING_PDF_TO_EMF_CONVERTER_FACTORY_H_
#define CHROME_UTILITY_PRINTING_PDF_TO_EMF_CONVERTER_FACTORY_IMPL_H_ #define CHROME_SERVICES_PRINTING_PDF_TO_EMF_CONVERTER_FACTORY_H_
#include "base/macros.h" #include "base/macros.h"
#include "chrome/common/printing/pdf_to_emf_converter.mojom.h" #include "chrome/services/printing/public/interfaces/pdf_to_emf_converter.mojom.h"
#include "services/service_manager/public/cpp/service_context_ref.h"
namespace printing { namespace printing {
class PdfToEmfConverterFactoryImpl : public mojom::PdfToEmfConverterFactory { class PdfToEmfConverterFactory : public mojom::PdfToEmfConverterFactory {
public: public:
PdfToEmfConverterFactoryImpl(); explicit PdfToEmfConverterFactory(
~PdfToEmfConverterFactoryImpl() override; std::unique_ptr<service_manager::ServiceContextRef> service_ref);
~PdfToEmfConverterFactory() override;
static void Create(mojom::PdfToEmfConverterFactoryRequest request);
private: private:
// mojom::PdfToEmfConverterFactory implementation. // mojom::PdfToEmfConverterFactory implementation.
void CreateConverter(mojo::ScopedHandle pdf_file_in, void CreateConverter(mojo::ScopedHandle pdf_file_in,
const printing::PdfRenderSettings& render_settings, const PdfRenderSettings& render_settings,
mojom::PdfToEmfConverterClientPtr client, mojom::PdfToEmfConverterClientPtr client,
CreateConverterCallback callback) override; CreateConverterCallback callback) override;
DISALLOW_COPY_AND_ASSIGN(PdfToEmfConverterFactoryImpl); const std::unique_ptr<service_manager::ServiceContextRef> service_ref_;
DISALLOW_COPY_AND_ASSIGN(PdfToEmfConverterFactory);
}; };
} // namespace printing } // namespace printing
#endif // CHROME_UTILITY_PRINTING_PDF_TO_EMF_CONVERTER_FACTORY_IMPL_H_ #endif // CHROME_SERVICES_PRINTING_PDF_TO_EMF_CONVERTER_FACTORY_H_
...@@ -97,13 +97,13 @@ bool RenderPdfPagesToPwgRaster(base::File pdf_file, ...@@ -97,13 +97,13 @@ bool RenderPdfPagesToPwgRaster(base::File pdf_file,
} // namespace } // namespace
PdfToPwgRasterConverterImpl::PdfToPwgRasterConverterImpl( PdfToPwgRasterConverter::PdfToPwgRasterConverter(
std::unique_ptr<service_manager::ServiceContextRef> service_ref) std::unique_ptr<service_manager::ServiceContextRef> service_ref)
: service_ref_(std::move(service_ref)) {} : service_ref_(std::move(service_ref)) {}
PdfToPwgRasterConverterImpl::~PdfToPwgRasterConverterImpl() {} PdfToPwgRasterConverter::~PdfToPwgRasterConverter() {}
void PdfToPwgRasterConverterImpl::Convert( void PdfToPwgRasterConverter::Convert(
mojo::ScopedHandle pdf_file_in, mojo::ScopedHandle pdf_file_in,
const PdfRenderSettings& pdf_settings, const PdfRenderSettings& pdf_settings,
const PwgRasterSettings& pwg_raster_settings, const PwgRasterSettings& pwg_raster_settings,
...@@ -112,7 +112,7 @@ void PdfToPwgRasterConverterImpl::Convert( ...@@ -112,7 +112,7 @@ void PdfToPwgRasterConverterImpl::Convert(
base::PlatformFile pdf_file; base::PlatformFile pdf_file;
if (mojo::UnwrapPlatformFile(std::move(pdf_file_in), &pdf_file) != if (mojo::UnwrapPlatformFile(std::move(pdf_file_in), &pdf_file) !=
MOJO_RESULT_OK) { MOJO_RESULT_OK) {
LOG(ERROR) << "Invalid PDF file passed to PdfToPwgRasterConverterImpl"; LOG(ERROR) << "Invalid PDF file passed to PdfToPwgRasterConverter.";
std::move(callback).Run(false); std::move(callback).Run(false);
return; return;
} }
...@@ -120,8 +120,7 @@ void PdfToPwgRasterConverterImpl::Convert( ...@@ -120,8 +120,7 @@ void PdfToPwgRasterConverterImpl::Convert(
base::PlatformFile pwg_raster_file; base::PlatformFile pwg_raster_file;
if (mojo::UnwrapPlatformFile(std::move(pwg_raster_file_out), if (mojo::UnwrapPlatformFile(std::move(pwg_raster_file_out),
&pwg_raster_file) != MOJO_RESULT_OK) { &pwg_raster_file) != MOJO_RESULT_OK) {
LOG(ERROR) LOG(ERROR) << "Invalid PWGRaster file passed to PdfToPwgRasterConverter.";
<< "Invalid PWGRaster file passed to PdfToPwgRasterConverterImpl";
std::move(callback).Run(false); std::move(callback).Run(false);
return; return;
} }
......
...@@ -16,12 +16,12 @@ namespace printing { ...@@ -16,12 +16,12 @@ namespace printing {
struct PdfRenderSettings; struct PdfRenderSettings;
class PdfToPwgRasterConverterImpl class PdfToPwgRasterConverter
: public printing::mojom::PdfToPwgRasterConverter { : public printing::mojom::PdfToPwgRasterConverter {
public: public:
explicit PdfToPwgRasterConverterImpl( explicit PdfToPwgRasterConverter(
std::unique_ptr<service_manager::ServiceContextRef> service_ref); std::unique_ptr<service_manager::ServiceContextRef> service_ref);
~PdfToPwgRasterConverterImpl() override; ~PdfToPwgRasterConverter() override;
private: private:
// printing::mojom::PdfToPwgRasterConverter // printing::mojom::PdfToPwgRasterConverter
...@@ -33,7 +33,7 @@ class PdfToPwgRasterConverterImpl ...@@ -33,7 +33,7 @@ class PdfToPwgRasterConverterImpl
const std::unique_ptr<service_manager::ServiceContextRef> service_ref_; const std::unique_ptr<service_manager::ServiceContextRef> service_ref_;
DISALLOW_COPY_AND_ASSIGN(PdfToPwgRasterConverterImpl); DISALLOW_COPY_AND_ASSIGN(PdfToPwgRasterConverter);
}; };
} // namespace printing } // namespace printing
......
...@@ -8,17 +8,31 @@ ...@@ -8,17 +8,31 @@
#include "chrome/services/printing/pdf_to_pwg_raster_converter.h" #include "chrome/services/printing/pdf_to_pwg_raster_converter.h"
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/strong_binding.h"
#if defined(OS_WIN)
#include "chrome/services/printing/pdf_to_emf_converter.h"
#include "chrome/services/printing/pdf_to_emf_converter_factory.h"
#endif
namespace printing { namespace printing {
namespace { namespace {
#if defined(OS_WIN)
void OnPdfToEmfConverterFactoryRequest(
service_manager::ServiceContextRefFactory* ref_factory,
printing::mojom::PdfToEmfConverterFactoryRequest request) {
mojo::MakeStrongBinding(std::make_unique<printing::PdfToEmfConverterFactory>(
ref_factory->CreateRef()),
std::move(request));
}
#endif
void OnPdfToPwgRasterConverterRequest( void OnPdfToPwgRasterConverterRequest(
service_manager::ServiceContextRefFactory* ref_factory, service_manager::ServiceContextRefFactory* ref_factory,
printing::mojom::PdfToPwgRasterConverterRequest request) { printing::mojom::PdfToPwgRasterConverterRequest request) {
mojo::MakeStrongBinding( mojo::MakeStrongBinding(std::make_unique<printing::PdfToPwgRasterConverter>(
std::make_unique<printing::PdfToPwgRasterConverterImpl>( ref_factory->CreateRef()),
ref_factory->CreateRef()), std::move(request));
std::move(request));
} }
} // namespace } // namespace
...@@ -35,6 +49,10 @@ void PrintingService::OnStart() { ...@@ -35,6 +49,10 @@ void PrintingService::OnStart() {
ref_factory_ = std::make_unique<service_manager::ServiceContextRefFactory>( ref_factory_ = std::make_unique<service_manager::ServiceContextRefFactory>(
base::Bind(&service_manager::ServiceContext::RequestQuit, base::Bind(&service_manager::ServiceContext::RequestQuit,
base::Unretained(context()))); base::Unretained(context())));
#if defined(OS_WIN)
registry_.AddInterface(
base::Bind(&OnPdfToEmfConverterFactoryRequest, ref_factory_.get()));
#endif
registry_.AddInterface( registry_.AddInterface(
base::Bind(&OnPdfToPwgRasterConverterRequest, ref_factory_.get())); base::Bind(&OnPdfToPwgRasterConverterRequest, ref_factory_.get()));
} }
......
...@@ -11,6 +11,10 @@ mojom("interfaces") { ...@@ -11,6 +11,10 @@ mojom("interfaces") {
"pdf_to_pwg_raster_converter.mojom", "pdf_to_pwg_raster_converter.mojom",
] ]
if (is_win) {
sources += [ "pdf_to_emf_converter.mojom" ]
}
deps = [ deps = [
"//mojo/common:common_custom_types", "//mojo/common:common_custom_types",
"//ui/gfx/geometry/mojo", "//ui/gfx/geometry/mojo",
......
...@@ -184,15 +184,6 @@ static_library("utility") { ...@@ -184,15 +184,6 @@ static_library("utility") {
"printing_handler.cc", "printing_handler.cc",
"printing_handler.h", "printing_handler.h",
] ]
deps += [ "//pdf" ]
if (is_win) {
sources += [
"printing/pdf_to_emf_converter_factory_impl.cc",
"printing/pdf_to_emf_converter_factory_impl.h",
"printing/pdf_to_emf_converter_impl.cc",
"printing/pdf_to_emf_converter_impl.h",
]
}
} }
if (enable_basic_printing || enable_print_preview) { if (enable_basic_printing || enable_print_preview) {
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#if defined(OS_WIN) #if defined(OS_WIN)
#include "chrome/services/util_win/public/interfaces/constants.mojom.h" #include "chrome/services/util_win/public/interfaces/constants.mojom.h"
#include "chrome/services/util_win/util_win_service.h" #include "chrome/services/util_win/util_win_service.h"
#include "chrome/utility/printing/pdf_to_emf_converter_factory_impl.h"
#endif #endif
#if BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_EXTENSIONS)
...@@ -179,11 +178,6 @@ void ChromeContentUtilityClient::UtilityThreadStarted() { ...@@ -179,11 +178,6 @@ void ChromeContentUtilityClient::UtilityThreadStarted() {
registry->AddInterface(base::Bind(CreateResourceUsageReporter), registry->AddInterface(base::Bind(CreateResourceUsageReporter),
base::ThreadTaskRunnerHandle::Get()); base::ThreadTaskRunnerHandle::Get());
#endif // !defined(OS_ANDROID) #endif // !defined(OS_ANDROID)
#if defined(OS_WIN)
registry->AddInterface(
base::Bind(printing::PdfToEmfConverterFactoryImpl::Create),
base::ThreadTaskRunnerHandle::Get());
#endif
} }
connection->AddConnectionFilter( connection->AddConnectionFilter(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment