2014-07-03 20:34:58 +02:00
|
|
|
// Copyright 2014 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.
|
|
|
|
|
|
|
|
#ifndef LIBCEF_UTILITY_PRINTING_HANDLER_H_
|
|
|
|
#define LIBCEF_UTILITY_PRINTING_HANDLER_H_
|
|
|
|
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "base/macros.h"
|
|
|
|
#include "chrome/utility/utility_message_handler.h"
|
|
|
|
#include "ipc/ipc_platform_file.h"
|
2015-03-04 02:00:13 +01:00
|
|
|
#include "pdf/pdf.h"
|
2014-09-27 01:48:19 +02:00
|
|
|
#include "printing/pdf_render_settings.h"
|
2014-07-03 20:34:58 +02:00
|
|
|
|
2014-09-27 01:48:19 +02:00
|
|
|
#if !defined(OS_WIN)
|
|
|
|
#error "Must be building on Windows."
|
2014-07-03 20:34:58 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace printing {
|
|
|
|
class PdfRenderSettings;
|
2014-09-27 01:48:19 +02:00
|
|
|
struct PwgRasterSettings;
|
2014-07-03 20:34:58 +02:00
|
|
|
struct PageRange;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dispatches IPCs for printing.
|
|
|
|
class PrintingHandler : public UtilityMessageHandler {
|
|
|
|
public:
|
|
|
|
PrintingHandler();
|
2014-11-12 20:25:15 +01:00
|
|
|
~PrintingHandler() override;
|
2014-07-03 20:34:58 +02:00
|
|
|
|
|
|
|
// IPC::Listener:
|
2014-11-12 20:25:15 +01:00
|
|
|
bool OnMessageReceived(const IPC::Message& message) override;
|
2014-07-03 20:34:58 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
// IPC message handlers.
|
2014-09-27 01:48:19 +02:00
|
|
|
#if defined(OS_WIN)
|
|
|
|
void OnRenderPDFPagesToMetafile(IPC::PlatformFileForTransit pdf_transit,
|
2016-08-31 13:25:56 +02:00
|
|
|
const printing::PdfRenderSettings& settings,
|
|
|
|
bool print_text_with_gdi);
|
2014-09-27 01:48:19 +02:00
|
|
|
void OnRenderPDFPagesToMetafileGetPage(
|
|
|
|
int page_number,
|
|
|
|
IPC::PlatformFileForTransit output_file);
|
|
|
|
void OnRenderPDFPagesToMetafileStop();
|
|
|
|
|
|
|
|
int LoadPDF(base::File pdf_file);
|
|
|
|
bool RenderPdfPageToMetafile(int page_number,
|
|
|
|
base::File output_file,
|
|
|
|
double* scale_factor);
|
|
|
|
|
|
|
|
std::vector<char> pdf_data_;
|
|
|
|
printing::PdfRenderSettings pdf_rendering_settings_;
|
|
|
|
#endif // defined(OS_WIN)
|
2014-07-03 20:34:58 +02:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(PrintingHandler);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LIBCEF_UTILITY_PRINTING_HANDLER_H_
|