One-time migration of NPAPI Flash to PPAPI Flash.
[chromium-blink-merge.git] / chrome / common / chrome_utility_printing_messages.h
blobb2ce86ee54362d15a0b6d5dca71bff282ae08855
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.
7 #include <string>
8 #include <vector>
10 #include "components/printing/common/printing_param_traits_macros.h"
11 #include "ipc/ipc_message_macros.h"
12 #include "ipc/ipc_platform_file.h"
13 #include "printing/backend/print_backend.h"
14 #include "printing/page_range.h"
15 #include "printing/pdf_render_settings.h"
16 #include "printing/pwg_raster_settings.h"
18 #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart
20 // Preview and Cloud Print messages.
21 #if defined(ENABLE_PRINT_PREVIEW)
22 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults)
23 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities)
24 IPC_STRUCT_TRAITS_MEMBER(caps_mime_type)
25 IPC_STRUCT_TRAITS_MEMBER(printer_defaults)
26 IPC_STRUCT_TRAITS_MEMBER(defaults_mime_type)
27 IPC_STRUCT_TRAITS_END()
29 IPC_ENUM_TRAITS_MAX_VALUE(printing::ColorModel, printing::PROCESSCOLORMODEL_RGB)
31 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults::Paper)
32 IPC_STRUCT_TRAITS_MEMBER(display_name)
33 IPC_STRUCT_TRAITS_MEMBER(vendor_id)
34 IPC_STRUCT_TRAITS_MEMBER(size_um)
35 IPC_STRUCT_TRAITS_END()
37 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults)
38 IPC_STRUCT_TRAITS_MEMBER(collate_capable)
39 IPC_STRUCT_TRAITS_MEMBER(collate_default)
40 IPC_STRUCT_TRAITS_MEMBER(copies_capable)
41 IPC_STRUCT_TRAITS_MEMBER(duplex_capable)
42 IPC_STRUCT_TRAITS_MEMBER(duplex_default)
43 IPC_STRUCT_TRAITS_MEMBER(color_changeable)
44 IPC_STRUCT_TRAITS_MEMBER(color_default)
45 IPC_STRUCT_TRAITS_MEMBER(color_model)
46 IPC_STRUCT_TRAITS_MEMBER(bw_model)
47 IPC_STRUCT_TRAITS_MEMBER(papers)
48 IPC_STRUCT_TRAITS_MEMBER(default_paper)
49 IPC_STRUCT_TRAITS_MEMBER(dpis)
50 IPC_STRUCT_TRAITS_MEMBER(default_dpi)
51 IPC_STRUCT_TRAITS_END()
53 IPC_ENUM_TRAITS_MAX_VALUE(printing::PwgRasterTransformType,
54 printing::TRANSFORM_TYPE_LAST)
56 IPC_STRUCT_TRAITS_BEGIN(printing::PwgRasterSettings)
57 IPC_STRUCT_TRAITS_MEMBER(odd_page_transform)
58 IPC_STRUCT_TRAITS_MEMBER(rotate_all_pages)
59 IPC_STRUCT_TRAITS_MEMBER(reverse_page_order)
60 IPC_STRUCT_TRAITS_END()
62 //------------------------------------------------------------------------------
63 // Utility process messages:
64 // These are messages from the browser to the utility process.
66 // Tell the utility process to render the given PDF into a PWGRaster.
67 IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToPWGRaster,
68 IPC::PlatformFileForTransit, /* Input PDF file */
69 printing::PdfRenderSettings, /* PDF render settings */
70 // PWG transform settings.
71 printing::PwgRasterSettings,
72 IPC::PlatformFileForTransit /* Output PWG file */)
74 // Tells the utility process to get capabilities and defaults for the specified
75 // printer. Used on Windows to isolate the service process from printer driver
76 // crashes by executing this in a separate process. This does not run in a
77 // sandbox.
78 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
79 std::string /* printer name */)
81 // Tells the utility process to get capabilities and defaults for the specified
82 // printer. Used on Windows to isolate the service process from printer driver
83 // crashes by executing this in a separate process. This does not run in a
84 // sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults.
85 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults,
86 std::string /* printer name */)
87 #endif // ENABLE_PRINT_PREVIEW
89 // Windows uses messages for printing even without preview. crbug.com/170859
90 // Primary user of Windows without preview is CEF. crbug.com/417967
91 #if defined(ENABLE_PRINTING) && defined(OS_WIN)
92 // Tell the utility process to start rendering the given PDF into a metafile.
93 // Utility process would be alive until
94 // ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop message.
95 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
96 IPC::PlatformFileForTransit, /* input_file */
97 printing::PdfRenderSettings /* settings */)
99 // Requests conversion of the next page.
100 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage,
101 int /* page_number */,
102 IPC::PlatformFileForTransit /* output_file */)
104 // Requests utility process to stop conversion and exit.
105 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop)
106 #endif // ENABLE_PRINTING && OS_WIN
108 //------------------------------------------------------------------------------
109 // Utility process host messages:
110 // These are messages from the utility process to the browser.
112 #if defined(ENABLE_PRINT_PREVIEW)
113 // Reply when the utility process has succeeded in rendering the PDF to PWG.
114 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded)
116 // Reply when an error occurred rendering the PDF to PWG.
117 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed)
119 // Reply when the utility process has succeeded in obtaining the printer
120 // capabilities and defaults.
121 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded,
122 std::string /* printer name */,
123 printing::PrinterCapsAndDefaults)
125 // Reply when the utility process has succeeded in obtaining the printer
126 // semantic capabilities and defaults.
127 IPC_MESSAGE_CONTROL2(
128 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Succeeded,
129 std::string /* printer name */,
130 printing::PrinterSemanticCapsAndDefaults)
132 // Reply when the utility process has failed to obtain the printer
133 // capabilities and defaults.
134 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed,
135 std::string /* printer name */)
137 // Reply when the utility process has failed to obtain the printer
138 // semantic capabilities and defaults.
139 IPC_MESSAGE_CONTROL1(
140 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed,
141 std::string /* printer name */)
142 #endif // ENABLE_PRINT_PREVIEW
144 #if defined(ENABLE_PRINTING) && defined(OS_WIN)
145 // Reply when the utility process loaded PDF. |page_count| is 0, if loading
146 // failed.
147 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount,
148 int /* page_count */)
150 // Reply when the utility process rendered the PDF page.
151 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone,
152 bool /* success */,
153 float /* scale_factor */)
154 #endif // ENABLE_PRINTING && OS_WIN