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 // Multiply-included message file, so no include guard.
10 #include "ipc/ipc_message_macros.h"
11 #include "ipc/ipc_platform_file.h"
12 #include "printing/backend/print_backend.h"
13 #include "printing/page_range.h"
14 #include "printing/pdf_render_settings.h"
15 #include "printing/pwg_raster_settings.h"
17 #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart
19 // Preview and Cloud Print messages.
20 #if defined(ENABLE_FULL_PRINTING)
21 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults
)
22 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities
)
23 IPC_STRUCT_TRAITS_MEMBER(caps_mime_type
)
24 IPC_STRUCT_TRAITS_MEMBER(printer_defaults
)
25 IPC_STRUCT_TRAITS_MEMBER(defaults_mime_type
)
26 IPC_STRUCT_TRAITS_END()
28 IPC_ENUM_TRAITS_MAX_VALUE(printing::ColorModel
, printing::PROCESSCOLORMODEL_RGB
)
30 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults::Paper
)
31 IPC_STRUCT_TRAITS_MEMBER(display_name
)
32 IPC_STRUCT_TRAITS_MEMBER(vendor_id
)
33 IPC_STRUCT_TRAITS_MEMBER(size_um
)
34 IPC_STRUCT_TRAITS_END()
36 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults
)
37 IPC_STRUCT_TRAITS_MEMBER(collate_capable
)
38 IPC_STRUCT_TRAITS_MEMBER(collate_default
)
39 IPC_STRUCT_TRAITS_MEMBER(copies_capable
)
40 IPC_STRUCT_TRAITS_MEMBER(duplex_capable
)
41 IPC_STRUCT_TRAITS_MEMBER(duplex_default
)
42 IPC_STRUCT_TRAITS_MEMBER(color_changeable
)
43 IPC_STRUCT_TRAITS_MEMBER(color_default
)
44 IPC_STRUCT_TRAITS_MEMBER(color_model
)
45 IPC_STRUCT_TRAITS_MEMBER(bw_model
)
46 IPC_STRUCT_TRAITS_MEMBER(papers
)
47 IPC_STRUCT_TRAITS_MEMBER(default_paper
)
48 IPC_STRUCT_TRAITS_MEMBER(dpis
)
49 IPC_STRUCT_TRAITS_MEMBER(default_dpi
)
50 IPC_STRUCT_TRAITS_END()
52 IPC_ENUM_TRAITS(printing::PwgRasterTransformType
)
54 IPC_STRUCT_TRAITS_BEGIN(printing::PwgRasterSettings
)
55 IPC_STRUCT_TRAITS_MEMBER(odd_page_transform
)
56 IPC_STRUCT_TRAITS_MEMBER(rotate_all_pages
)
57 IPC_STRUCT_TRAITS_MEMBER(reverse_page_order
)
58 IPC_STRUCT_TRAITS_END()
60 //------------------------------------------------------------------------------
61 // Utility process messages:
62 // These are messages from the browser to the utility process.
64 // Tell the utility process to render the given PDF into a PWGRaster.
65 IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToPWGRaster
,
66 IPC::PlatformFileForTransit
, /* Input PDF file */
67 printing::PdfRenderSettings
, /* PDF render settings */
68 // PWG transform settings.
69 printing::PwgRasterSettings
,
70 IPC::PlatformFileForTransit
/* Output PWG file */)
72 // Tells the utility process to get capabilities and defaults for the specified
73 // printer. Used on Windows to isolate the service process from printer driver
74 // crashes by executing this in a separate process. This does not run in a
76 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults
,
77 std::string
/* printer name */)
79 // Tells the utility process to get capabilities and defaults for the specified
80 // printer. Used on Windows to isolate the service process from printer driver
81 // crashes by executing this in a separate process. This does not run in a
82 // sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults.
83 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults
,
84 std::string
/* printer name */)
85 #endif // ENABLE_FULL_PRINTING
87 // Windows uses messages for printing even without preview. crbug.com/170859
88 // Primary user of Windows without preview is CEF. crbug.com/417967
89 #if defined(ENABLE_PRINTING) && defined(OS_WIN)
90 // Tell the utility process to start rendering the given PDF into a metafile.
91 // Utility process would be alive until
92 // ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop message.
93 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles
,
94 IPC::PlatformFileForTransit
, /* input_file */
95 printing::PdfRenderSettings
/* settings */)
97 // Requests conversion of the next page.
98 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage
,
99 int /* page_number */,
100 IPC::PlatformFileForTransit
/* output_file */)
102 // Requests utility process to stop conversion and exit.
103 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop
)
104 #endif // ENABLE_PRINTING && OS_WIN
106 //------------------------------------------------------------------------------
107 // Utility process host messages:
108 // These are messages from the utility process to the browser.
110 #if defined(ENABLE_FULL_PRINTING)
111 // Reply when the utility process has succeeded in rendering the PDF to PWG.
112 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded
)
114 // Reply when an error occurred rendering the PDF to PWG.
115 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed
)
117 // Reply when the utility process has succeeded in obtaining the printer
118 // capabilities and defaults.
119 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded
,
120 std::string
/* printer name */,
121 printing::PrinterCapsAndDefaults
)
123 // Reply when the utility process has succeeded in obtaining the printer
124 // semantic capabilities and defaults.
125 IPC_MESSAGE_CONTROL2(
126 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Succeeded
,
127 std::string
/* printer name */,
128 printing::PrinterSemanticCapsAndDefaults
)
130 // Reply when the utility process has failed to obtain the printer
131 // capabilities and defaults.
132 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed
,
133 std::string
/* printer name */)
135 // Reply when the utility process has failed to obtain the printer
136 // semantic capabilities and defaults.
137 IPC_MESSAGE_CONTROL1(
138 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed
,
139 std::string
/* printer name */)
140 #endif // ENABLE_FULL_PRINTING
142 #if defined(ENABLE_PRINTING) && defined(OS_WIN)
143 // Reply when the utility process loaded PDF. |page_count| is 0, if loading
145 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount
,
146 int /* page_count */)
148 // Reply when the utility process rendered the PDF page.
149 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone
,
151 double /* scale_factor */)
152 #endif // ENABLE_PRINTING && OS_WIN