| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Multiply-included message file, so no include guard. | 5 // Multiply-included message file, so no include guard. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "components/printing/common/printing_param_traits_macros.h" | 12 #include "components/printing/common/printing_param_traits_macros.h" |
| 13 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
| 14 #include "ipc/ipc_param_traits.h" |
| 14 #include "ipc/ipc_platform_file.h" | 15 #include "ipc/ipc_platform_file.h" |
| 15 #include "printing/backend/print_backend.h" | 16 #include "printing/backend/print_backend.h" |
| 16 #include "printing/features/features.h" | 17 #include "printing/features/features.h" |
| 17 #include "printing/page_range.h" | 18 #include "printing/page_range.h" |
| 18 #include "printing/pdf_render_settings.h" | 19 #include "printing/pdf_render_settings.h" |
| 19 #include "printing/pwg_raster_settings.h" | 20 #include "printing/pwg_raster_settings.h" |
| 20 | 21 |
| 21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 22 #include <windows.h> | 23 #include <windows.h> |
| 23 #endif | 24 #endif |
| 24 | 25 |
| 25 #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart | 26 #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart |
| 26 | 27 |
| 27 // Preview and Cloud Print messages. | 28 // Preview and Cloud Print messages. |
| 28 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 29 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 30 #if defined(OS_WIN) |
| 31 IPC_ENUM_TRAITS_MAX_VALUE( |
| 32 printing::PdfRenderSettings::Mode, |
| 33 printing::PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3) |
| 34 #else |
| 35 IPC_ENUM_TRAITS_MAX_VALUE(printing::PdfRenderSettings::Mode, |
| 36 printing::PdfRenderSettings::Mode::NORMAL) |
| 37 #endif |
| 38 |
| 39 IPC_STRUCT_TRAITS_BEGIN(printing::PdfRenderSettings) |
| 40 IPC_STRUCT_TRAITS_MEMBER(area) |
| 41 IPC_STRUCT_TRAITS_MEMBER(offsets) |
| 42 IPC_STRUCT_TRAITS_MEMBER(dpi) |
| 43 IPC_STRUCT_TRAITS_MEMBER(autorotate) |
| 44 IPC_STRUCT_TRAITS_MEMBER(mode) |
| 45 IPC_STRUCT_TRAITS_END() |
| 46 |
| 29 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults) | 47 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults) |
| 30 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) | 48 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) |
| 31 IPC_STRUCT_TRAITS_MEMBER(caps_mime_type) | 49 IPC_STRUCT_TRAITS_MEMBER(caps_mime_type) |
| 32 IPC_STRUCT_TRAITS_MEMBER(printer_defaults) | 50 IPC_STRUCT_TRAITS_MEMBER(printer_defaults) |
| 33 IPC_STRUCT_TRAITS_MEMBER(defaults_mime_type) | 51 IPC_STRUCT_TRAITS_MEMBER(defaults_mime_type) |
| 34 IPC_STRUCT_TRAITS_END() | 52 IPC_STRUCT_TRAITS_END() |
| 35 | 53 |
| 36 IPC_ENUM_TRAITS_MAX_VALUE(printing::ColorModel, printing::PROCESSCOLORMODEL_RGB) | 54 IPC_ENUM_TRAITS_MAX_VALUE(printing::ColorModel, printing::PROCESSCOLORMODEL_RGB) |
| 37 | 55 |
| 38 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults::Paper) | 56 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults::Paper) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 62 | 80 |
| 63 IPC_STRUCT_TRAITS_BEGIN(printing::PwgRasterSettings) | 81 IPC_STRUCT_TRAITS_BEGIN(printing::PwgRasterSettings) |
| 64 IPC_STRUCT_TRAITS_MEMBER(odd_page_transform) | 82 IPC_STRUCT_TRAITS_MEMBER(odd_page_transform) |
| 65 IPC_STRUCT_TRAITS_MEMBER(rotate_all_pages) | 83 IPC_STRUCT_TRAITS_MEMBER(rotate_all_pages) |
| 66 IPC_STRUCT_TRAITS_MEMBER(reverse_page_order) | 84 IPC_STRUCT_TRAITS_MEMBER(reverse_page_order) |
| 67 IPC_STRUCT_TRAITS_END() | 85 IPC_STRUCT_TRAITS_END() |
| 68 | 86 |
| 69 //------------------------------------------------------------------------------ | 87 //------------------------------------------------------------------------------ |
| 70 // Utility process messages: | 88 // Utility process messages: |
| 71 // These are messages from the browser to the utility process. | 89 // These are messages from the browser to the utility process. |
| 72 | |
| 73 // Tell the utility process to render the given PDF into a PWGRaster. | 90 // Tell the utility process to render the given PDF into a PWGRaster. |
| 74 IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToPWGRaster, | 91 IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToPWGRaster, |
| 75 IPC::PlatformFileForTransit /* Input PDF file */, | 92 IPC::PlatformFileForTransit /* Input PDF file */, |
| 76 printing::PdfRenderSettings /* PDF render settings */, | 93 printing::PdfRenderSettings /* PDF render settings */, |
| 77 // PWG transform settings. | 94 // PWG transform settings. |
| 78 printing::PwgRasterSettings, | 95 printing::PwgRasterSettings, |
| 79 IPC::PlatformFileForTransit /* Output PWG file */) | 96 IPC::PlatformFileForTransit /* Output PWG file */) |
| 80 | 97 |
| 81 // Tells the utility process to get capabilities and defaults for the specified | 98 // 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 | 99 // 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 | 100 // crashes by executing this in a separate process. This does not run in a |
| 84 // sandbox. | 101 // sandbox. |
| 85 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults, | 102 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults, |
| 86 std::string /* printer name */) | 103 std::string /* printer name */) |
| 87 | 104 |
| 88 // Tells the utility process to get capabilities and defaults for the specified | 105 // Tells the utility process to get capabilities and defaults for the specified |
| 89 // printer. Used on Windows to isolate the service process from printer driver | 106 // printer. Used on Windows to isolate the service process from printer driver |
| 90 // crashes by executing this in a separate process. This does not run in a | 107 // crashes by executing this in a separate process. This does not run in a |
| 91 // sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults. | 108 // sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults. |
| 92 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults, | 109 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults, |
| 93 std::string /* printer name */) | 110 std::string /* printer name */) |
| 94 #endif // ENABLE_PRINT_PREVIEW | 111 #endif // ENABLE_PRINT_PREVIEW |
| 95 | 112 |
| 96 // Windows uses messages for printing even without preview. crbug.com/170859 | 113 // Windows uses messages for printing even without preview. crbug.com/170859 |
| 97 // Primary user of Windows without preview is CEF. crbug.com/417967 | 114 // Primary user of Windows without preview is CEF. crbug.com/417967 |
| 98 #if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN) | 115 #if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN) |
| 99 // Tell the utility process to start rendering the given PDF into a metafile. | 116 // Tell the utility process to start rendering the given PDF into a metafile. |
| 100 // Utility process would be alive until | 117 // Utility process would be alive until |
| 101 // ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop message. | 118 // ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop message. |
| 102 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_RenderPDFPagesToMetafiles, | 119 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles, |
| 103 IPC::PlatformFileForTransit /* input_file */, | 120 IPC::PlatformFileForTransit /* input_file */, |
| 104 printing::PdfRenderSettings /* settings */, | 121 printing::PdfRenderSettings /* settings */) |
| 105 bool /* print_text_with_gdi */) | |
| 106 | 122 |
| 107 // Requests conversion of the next page. | 123 // Requests conversion of the next page. |
| 108 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage, | 124 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage, |
| 109 int /* page_number */, | 125 int /* page_number */, |
| 110 IPC::PlatformFileForTransit /* output_file */) | 126 IPC::PlatformFileForTransit /* output_file */) |
| 111 | 127 |
| 112 // Requests utility process to stop conversion and exit. | 128 // Requests utility process to stop conversion and exit. |
| 113 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop) | 129 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop) |
| 114 #endif // ENABLE_PRINTING && OS_WIN | 130 |
| 131 // Tell the utility process to start rendering the given PDF into PS. |
| 132 // Utility process would be alive until |
| 133 // ChromeUtilityMsg_RenderPDFPagesToPostScript_Stop message. |
| 134 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToPostScript_Start, |
| 135 IPC::PlatformFileForTransit /* input_file */, |
| 136 printing::PdfRenderSettings /* settings */) |
| 137 |
| 138 // Requests conversion of the next page. |
| 139 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToPostScript_GetPage, |
| 140 int /* page_number */, |
| 141 IPC::PlatformFileForTransit /* output_file */) |
| 142 |
| 143 // Requests utility process to stop conversion and exit. |
| 144 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToPostScript_Stop) |
| 145 #endif // BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN) |
| 115 | 146 |
| 116 //------------------------------------------------------------------------------ | 147 //------------------------------------------------------------------------------ |
| 117 // Utility process host messages: | 148 // Utility process host messages: |
| 118 // These are messages from the utility process to the browser. | 149 // These are messages from the utility process to the browser. |
| 119 | 150 |
| 120 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 151 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 121 // Reply when the utility process has succeeded in rendering the PDF to PWG. | 152 // Reply when the utility process has succeeded in rendering the PDF to PWG. |
| 122 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded) | 153 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded) |
| 123 | 154 |
| 124 // Reply when an error occurred rendering the PDF to PWG. | 155 // Reply when an error occurred rendering the PDF to PWG. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 153 // Reply when the utility process loaded PDF. |page_count| is 0, if loading | 184 // Reply when the utility process loaded PDF. |page_count| is 0, if loading |
| 154 // failed. | 185 // failed. |
| 155 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, | 186 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, |
| 156 int /* page_count */) | 187 int /* page_count */) |
| 157 | 188 |
| 158 // Reply when the utility process rendered the PDF page. | 189 // Reply when the utility process rendered the PDF page. |
| 159 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone, | 190 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone, |
| 160 bool /* success */, | 191 bool /* success */, |
| 161 float /* scale_factor */) | 192 float /* scale_factor */) |
| 162 | 193 |
| 194 // Reply when the utility process loaded PDF. |page_count| is 0, if loading |
| 195 // failed. |
| 196 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToPostScript_PageCount, |
| 197 int /* page_count */) |
| 198 |
| 199 // Reply when the utility process rendered the PDF page. |
| 200 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToPostScript_PageDone, |
| 201 bool /* success */) |
| 202 |
| 163 // Request that the given font characters be loaded by the browser so it's | 203 // Request that the given font characters be loaded by the browser so it's |
| 164 // cached by the OS. Please see | 204 // cached by the OS. Please see |
| 165 // PdfToEmfUtilityProcessHostClient::OnPreCacheFontCharacters for details. | 205 // PdfToEmfUtilityProcessHostClient::OnPreCacheFontCharacters for details. |
| 166 IPC_SYNC_MESSAGE_CONTROL2_0(ChromeUtilityHostMsg_PreCacheFontCharacters, | 206 IPC_SYNC_MESSAGE_CONTROL2_0(ChromeUtilityHostMsg_PreCacheFontCharacters, |
| 167 LOGFONT /* font_data */, | 207 LOGFONT /* font_data */, |
| 168 base::string16 /* characters */) | 208 base::string16 /* characters */) |
| 169 | 209 |
| 170 #endif // ENABLE_PRINTING && OS_WIN | 210 #endif // ENABLE_PRINTING && OS_WIN |
| OLD | NEW |