| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 // Multiply-included message file, so no include guard. | |
| 6 | |
| 7 #include <string> | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/strings/string16.h" | |
| 11 #include "build/build_config.h" | |
| 12 #include "components/printing/common/printing_param_traits_macros.h" | |
| 13 #include "ipc/ipc_message_macros.h" | |
| 14 #include "ipc/ipc_platform_file.h" | |
| 15 #include "printing/backend/print_backend.h" | |
| 16 #include "printing/features/features.h" | |
| 17 #include "printing/page_range.h" | |
| 18 #include "printing/pdf_render_settings.h" | |
| 19 #include "printing/pwg_raster_settings.h" | |
| 20 | |
| 21 #if defined(OS_WIN) | |
| 22 #include <windows.h> | |
| 23 #endif | |
| 24 | |
| 25 #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart | |
| 26 | |
| 27 // Preview and Cloud Print messages. | |
| 28 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | |
| 29 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults) | |
| 30 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) | |
| 31 IPC_STRUCT_TRAITS_MEMBER(caps_mime_type) | |
| 32 IPC_STRUCT_TRAITS_MEMBER(printer_defaults) | |
| 33 IPC_STRUCT_TRAITS_MEMBER(defaults_mime_type) | |
| 34 IPC_STRUCT_TRAITS_END() | |
| 35 | |
| 36 IPC_ENUM_TRAITS_MAX_VALUE(printing::ColorModel, printing::PROCESSCOLORMODEL_RGB) | |
| 37 | |
| 38 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults::Paper) | |
| 39 IPC_STRUCT_TRAITS_MEMBER(display_name) | |
| 40 IPC_STRUCT_TRAITS_MEMBER(vendor_id) | |
| 41 IPC_STRUCT_TRAITS_MEMBER(size_um) | |
| 42 IPC_STRUCT_TRAITS_END() | |
| 43 | |
| 44 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults) | |
| 45 IPC_STRUCT_TRAITS_MEMBER(collate_capable) | |
| 46 IPC_STRUCT_TRAITS_MEMBER(collate_default) | |
| 47 IPC_STRUCT_TRAITS_MEMBER(copies_capable) | |
| 48 IPC_STRUCT_TRAITS_MEMBER(duplex_capable) | |
| 49 IPC_STRUCT_TRAITS_MEMBER(duplex_default) | |
| 50 IPC_STRUCT_TRAITS_MEMBER(color_changeable) | |
| 51 IPC_STRUCT_TRAITS_MEMBER(color_default) | |
| 52 IPC_STRUCT_TRAITS_MEMBER(color_model) | |
| 53 IPC_STRUCT_TRAITS_MEMBER(bw_model) | |
| 54 IPC_STRUCT_TRAITS_MEMBER(papers) | |
| 55 IPC_STRUCT_TRAITS_MEMBER(default_paper) | |
| 56 IPC_STRUCT_TRAITS_MEMBER(dpis) | |
| 57 IPC_STRUCT_TRAITS_MEMBER(default_dpi) | |
| 58 IPC_STRUCT_TRAITS_END() | |
| 59 | |
| 60 IPC_ENUM_TRAITS_MAX_VALUE(printing::PwgRasterTransformType, | |
| 61 printing::TRANSFORM_TYPE_LAST) | |
| 62 | |
| 63 IPC_STRUCT_TRAITS_BEGIN(printing::PwgRasterSettings) | |
| 64 IPC_STRUCT_TRAITS_MEMBER(odd_page_transform) | |
| 65 IPC_STRUCT_TRAITS_MEMBER(rotate_all_pages) | |
| 66 IPC_STRUCT_TRAITS_MEMBER(reverse_page_order) | |
| 67 IPC_STRUCT_TRAITS_END() | |
| 68 | |
| 69 //------------------------------------------------------------------------------ | |
| 70 // Utility process messages: | |
| 71 // These are messages from the browser to the utility process. | |
| 72 | |
| 73 // Tell the utility process to render the given PDF into a PWGRaster. | |
| 74 IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToPWGRaster, | |
| 75 IPC::PlatformFileForTransit /* Input PDF file */, | |
| 76 printing::PdfRenderSettings /* PDF render settings */, | |
| 77 // PWG transform settings. | |
| 78 printing::PwgRasterSettings, | |
| 79 IPC::PlatformFileForTransit /* Output PWG file */) | |
| 80 | |
| 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. | |
| 85 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults, | |
| 86 std::string /* printer name */) | |
| 87 | |
| 88 // 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 | |
| 90 // crashes by executing this in a separate process. This does not run in a | |
| 91 // sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults. | |
| 92 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults, | |
| 93 std::string /* printer name */) | |
| 94 #endif // ENABLE_PRINT_PREVIEW | |
| 95 | |
| 96 // Windows uses messages for printing even without preview. crbug.com/170859 | |
| 97 // Primary user of Windows without preview is CEF. crbug.com/417967 | |
| 98 #if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN) | |
| 99 // Tell the utility process to start rendering the given PDF into a metafile. | |
| 100 // Utility process would be alive until | |
| 101 // ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop message. | |
| 102 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_RenderPDFPagesToMetafiles, | |
| 103 IPC::PlatformFileForTransit /* input_file */, | |
| 104 printing::PdfRenderSettings /* settings */, | |
| 105 bool /* print_text_with_gdi */) | |
| 106 | |
| 107 // Requests conversion of the next page. | |
| 108 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage, | |
| 109 int /* page_number */, | |
| 110 IPC::PlatformFileForTransit /* output_file */) | |
| 111 | |
| 112 // Requests utility process to stop conversion and exit. | |
| 113 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop) | |
| 114 #endif // ENABLE_PRINTING && OS_WIN | |
| 115 | |
| 116 //------------------------------------------------------------------------------ | |
| 117 // Utility process host messages: | |
| 118 // These are messages from the utility process to the browser. | |
| 119 | |
| 120 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | |
| 121 // Reply when the utility process has succeeded in rendering the PDF to PWG. | |
| 122 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded) | |
| 123 | |
| 124 // Reply when an error occurred rendering the PDF to PWG. | |
| 125 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed) | |
| 126 | |
| 127 // Reply when the utility process has succeeded in obtaining the printer | |
| 128 // capabilities and defaults. | |
| 129 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded, | |
| 130 std::string /* printer name */, | |
| 131 printing::PrinterCapsAndDefaults) | |
| 132 | |
| 133 // Reply when the utility process has succeeded in obtaining the printer | |
| 134 // semantic capabilities and defaults. | |
| 135 IPC_MESSAGE_CONTROL2( | |
| 136 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Succeeded, | |
| 137 std::string /* printer name */, | |
| 138 printing::PrinterSemanticCapsAndDefaults) | |
| 139 | |
| 140 // Reply when the utility process has failed to obtain the printer | |
| 141 // capabilities and defaults. | |
| 142 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed, | |
| 143 std::string /* printer name */) | |
| 144 | |
| 145 // Reply when the utility process has failed to obtain the printer | |
| 146 // semantic capabilities and defaults. | |
| 147 IPC_MESSAGE_CONTROL1( | |
| 148 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed, | |
| 149 std::string /* printer name */) | |
| 150 #endif // ENABLE_PRINT_PREVIEW | |
| 151 | |
| 152 #if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN) | |
| 153 // Reply when the utility process loaded PDF. |page_count| is 0, if loading | |
| 154 // failed. | |
| 155 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, | |
| 156 int /* page_count */) | |
| 157 | |
| 158 // Reply when the utility process rendered the PDF page. | |
| 159 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone, | |
| 160 bool /* success */, | |
| 161 float /* scale_factor */) | |
| 162 | |
| 163 // Request that the given font characters be loaded by the browser so it's | |
| 164 // cached by the OS. Please see | |
| 165 // PdfToEmfUtilityProcessHostClient::OnPreCacheFontCharacters for details. | |
| 166 IPC_SYNC_MESSAGE_CONTROL2_0(ChromeUtilityHostMsg_PreCacheFontCharacters, | |
| 167 LOGFONT /* font_data */, | |
| 168 base::string16 /* characters */) | |
| 169 | |
| 170 #endif // ENABLE_PRINTING && OS_WIN | |
| OLD | NEW |