| Index: chrome/utility/printing_handler.h
|
| diff --git a/chrome/utility/printing_handler.h b/chrome/utility/printing_handler.h
|
| index 99b6eeb6a28399e4077c254a037585b70c3efe14..f5cf0da2ea7ae87565e8bcd470a614644882ec03 100644
|
| --- a/chrome/utility/printing_handler.h
|
| +++ b/chrome/utility/printing_handler.h
|
| @@ -8,8 +8,9 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/macros.h"
|
| #include "build/build_config.h"
|
| -#include "chrome/utility/utility_message_handler.h"
|
| +#include "components/printing/common/printing.mojom.h"
|
| #include "ipc/ipc_platform_file.h"
|
| +#include "mojo/public/cpp/bindings/interface_request.h"
|
| #include "printing/features/features.h"
|
| #include "printing/pdf_render_settings.h"
|
|
|
| @@ -23,31 +24,41 @@ namespace printing {
|
| struct PwgRasterSettings;
|
|
|
| // Dispatches IPCs for printing.
|
| -class PrintingHandler : public UtilityMessageHandler {
|
| +class PrintingHandler : public mojom::Printing {
|
| public:
|
| - PrintingHandler();
|
| + explicit PrintingHandler(mojom::FontPreCachingPtr font_pre_caching);
|
| ~PrintingHandler() override;
|
|
|
| - // IPC::Listener:
|
| - bool OnMessageReceived(const IPC::Message& message) override;
|
| + static void Create(mojom::PrintingFactoryRequest request);
|
|
|
| private:
|
| - // IPC message handlers.
|
| -#if defined(OS_WIN)
|
| - void OnRenderPDFPagesToMetafile(IPC::PlatformFileForTransit pdf_transit,
|
| - const PdfRenderSettings& settings,
|
| - bool print_text_with_gdi);
|
| - void OnRenderPDFPagesToMetafileGetPage(
|
| + class PrintingHandlerFactory : public mojom::PrintingFactory {
|
| + public:
|
| + // mojom::PrintingFactory:
|
| + void MakePrinting(mojom::PrintingRequest request,
|
| + mojom::FontPreCachingPtr font_pre_caching) override;
|
| + };
|
| +
|
| + // mojom::Printing:
|
| + void RenderPDFPagesToMetafiles(
|
| + base::File pdf_file,
|
| + const PdfRenderSettings& settings,
|
| + bool print_text_with_gdi,
|
| + const RenderPDFPagesToMetafilesCallback& callback) override;
|
| + void RenderPDFPagesToMetafilesGetPage(
|
| int page_number,
|
| - IPC::PlatformFileForTransit output_file);
|
| - void OnRenderPDFPagesToMetafileStop();
|
| -#endif // OS_WIN
|
| -#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
| - void OnRenderPDFPagesToPWGRaster(IPC::PlatformFileForTransit pdf_transit,
|
| - const PdfRenderSettings& settings,
|
| - const PwgRasterSettings& bitmap_settings,
|
| - IPC::PlatformFileForTransit bitmap_transit);
|
| -#endif // ENABLE_PRINT_PREVIEW
|
| + base::File emf_file,
|
| + const RenderPDFPagesToMetafilesGetPageCallback& callback) override;
|
| + void RenderPDFPagesToPWGRaster(
|
| + base::File pdf,
|
| + const PdfRenderSettings& settings,
|
| + const PwgRasterSettings& bitmap_settings,
|
| + base::File bitmap,
|
| + const RenderPDFPagesToPWGRasterCallback& callback) override;
|
| +
|
| + // Called when the Mojo connection is closed. Causes the utility process to
|
| + // stop conversion and exit.
|
| + void OnConnectionClosed();
|
|
|
| #if defined(OS_WIN)
|
| int LoadPDF(base::File pdf_file);
|
| @@ -60,16 +71,23 @@ class PrintingHandler : public UtilityMessageHandler {
|
| const PdfRenderSettings& settings,
|
| const PwgRasterSettings& bitmap_settings,
|
| base::File bitmap_file);
|
| -
|
| - void OnGetPrinterCapsAndDefaults(const std::string& printer_name);
|
| - void OnGetPrinterSemanticCapsAndDefaults(const std::string& printer_name);
|
| #endif // ENABLE_PRINT_PREVIEW
|
|
|
| + // mojom::Printing:
|
| + void GetPrinterCapsAndDefaults(
|
| + const std::string& printer_name,
|
| + const GetPrinterCapsAndDefaultsCallback& callback) override;
|
| + void GetPrinterSemanticCapsAndDefaults(
|
| + const std::string& printer_name,
|
| + const GetPrinterSemanticCapsAndDefaultsCallback& callback) override;
|
| +
|
| #if defined(OS_WIN)
|
| std::vector<char> pdf_data_;
|
| PdfRenderSettings pdf_rendering_settings_;
|
| #endif
|
|
|
| + mojom::FontPreCachingPtr font_pre_caching_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(PrintingHandler);
|
| };
|
|
|
|
|