Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / utility / printing_handler.h
blob341a358c7ef859dc48b106fea720241aee887410
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_UTILITY_PRINTING_HANDLER_H_
6 #define CHROME_UTILITY_PRINTING_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "chrome/utility/utility_message_handler.h"
11 #include "ipc/ipc_platform_file.h"
12 #include "printing/pdf_render_settings.h"
14 #if !defined(ENABLE_PRINT_PREVIEW) && !defined(OS_WIN)
15 #error "Windows or full printing must be enabled"
16 #endif
18 namespace printing {
19 class PdfRenderSettings;
20 struct PwgRasterSettings;
21 struct PageRange;
24 // Dispatches IPCs for printing.
25 class PrintingHandler : public UtilityMessageHandler {
26 public:
27 PrintingHandler();
28 ~PrintingHandler() override;
30 // IPC::Listener:
31 bool OnMessageReceived(const IPC::Message& message) override;
33 private:
34 // IPC message handlers.
35 #if defined(OS_WIN)
36 void OnRenderPDFPagesToMetafile(IPC::PlatformFileForTransit pdf_transit,
37 const printing::PdfRenderSettings& settings);
38 void OnRenderPDFPagesToMetafileGetPage(
39 int page_number,
40 IPC::PlatformFileForTransit output_file);
41 void OnRenderPDFPagesToMetafileStop();
42 #endif // OS_WIN
43 #if defined(ENABLE_PRINT_PREVIEW)
44 void OnRenderPDFPagesToPWGRaster(
45 IPC::PlatformFileForTransit pdf_transit,
46 const printing::PdfRenderSettings& settings,
47 const printing::PwgRasterSettings& bitmap_settings,
48 IPC::PlatformFileForTransit bitmap_transit);
49 #endif // ENABLE_PRINT_PREVIEW
51 #if defined(OS_WIN)
52 int LoadPDF(base::File pdf_file);
53 bool RenderPdfPageToMetafile(int page_number,
54 base::File output_file,
55 float* scale_factor);
56 #endif // OS_WIN
57 #if defined(ENABLE_PRINT_PREVIEW)
58 bool RenderPDFPagesToPWGRaster(
59 base::File pdf_file,
60 const printing::PdfRenderSettings& settings,
61 const printing::PwgRasterSettings& bitmap_settings,
62 base::File bitmap_file);
64 void OnGetPrinterCapsAndDefaults(const std::string& printer_name);
65 void OnGetPrinterSemanticCapsAndDefaults(const std::string& printer_name);
66 #endif // ENABLE_PRINT_PREVIEW
68 #if defined(OS_WIN)
69 std::vector<char> pdf_data_;
70 printing::PdfRenderSettings pdf_rendering_settings_;
71 #endif
73 DISALLOW_COPY_AND_ASSIGN(PrintingHandler);
76 #endif // CHROME_UTILITY_PRINTING_HANDLER_H_