Chromium Code Reviews| 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 "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
| 11 #include "ipc/ipc_platform_file.h" | 11 #include "ipc/ipc_platform_file.h" |
| 12 #include "printing/backend/print_backend.h" | 12 #include "printing/backend/print_backend.h" |
| 13 #include "printing/page_range.h" | 13 #include "printing/page_range.h" |
| 14 #include "printing/pdf_render_settings.h" | 14 #include "printing/pdf_render_settings.h" |
| 15 #include "printing/pwg_raster_settings.h" | 15 #include "printing/pwg_raster_settings.h" |
| 16 | 16 |
| 17 #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart | 17 #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart |
| 18 | 18 |
| 19 // Preview and Cloud Print messages. | |
| 19 #if defined(ENABLE_FULL_PRINTING) | 20 #if defined(ENABLE_FULL_PRINTING) |
| 20 | |
| 21 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults) | 21 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults) |
| 22 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) | 22 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) |
| 23 IPC_STRUCT_TRAITS_MEMBER(caps_mime_type) | 23 IPC_STRUCT_TRAITS_MEMBER(caps_mime_type) |
| 24 IPC_STRUCT_TRAITS_MEMBER(printer_defaults) | 24 IPC_STRUCT_TRAITS_MEMBER(printer_defaults) |
| 25 IPC_STRUCT_TRAITS_MEMBER(defaults_mime_type) | 25 IPC_STRUCT_TRAITS_MEMBER(defaults_mime_type) |
| 26 IPC_STRUCT_TRAITS_END() | 26 IPC_STRUCT_TRAITS_END() |
| 27 | 27 |
| 28 IPC_ENUM_TRAITS_MAX_VALUE(printing::ColorModel, printing::PROCESSCOLORMODEL_RGB) | 28 IPC_ENUM_TRAITS_MAX_VALUE(printing::ColorModel, printing::PROCESSCOLORMODEL_RGB) |
| 29 | 29 |
| 30 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults::Paper) | 30 IPC_STRUCT_TRAITS_BEGIN(printing::PrinterSemanticCapsAndDefaults::Paper) |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 54 IPC_STRUCT_TRAITS_BEGIN(printing::PwgRasterSettings) | 54 IPC_STRUCT_TRAITS_BEGIN(printing::PwgRasterSettings) |
| 55 IPC_STRUCT_TRAITS_MEMBER(odd_page_transform) | 55 IPC_STRUCT_TRAITS_MEMBER(odd_page_transform) |
| 56 IPC_STRUCT_TRAITS_MEMBER(rotate_all_pages) | 56 IPC_STRUCT_TRAITS_MEMBER(rotate_all_pages) |
| 57 IPC_STRUCT_TRAITS_MEMBER(reverse_page_order) | 57 IPC_STRUCT_TRAITS_MEMBER(reverse_page_order) |
| 58 IPC_STRUCT_TRAITS_END() | 58 IPC_STRUCT_TRAITS_END() |
| 59 | 59 |
| 60 //------------------------------------------------------------------------------ | 60 //------------------------------------------------------------------------------ |
| 61 // Utility process messages: | 61 // Utility process messages: |
| 62 // These are messages from the browser to the utility process. | 62 // These are messages from the browser to the utility process. |
| 63 | 63 |
| 64 #if defined(OS_WIN) | |
| 65 // Tell the utility process to start rendering the given PDF into a metafile. | |
| 66 // Utility process would be alive until | |
| 67 // ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop message. | |
| 68 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles, | |
| 69 IPC::PlatformFileForTransit, /* input_file */ | |
| 70 printing::PdfRenderSettings /* settings */) | |
| 71 | |
| 72 // Requests conversion of the next page. | |
| 73 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage, | |
| 74 int /* page_number */, | |
| 75 IPC::PlatformFileForTransit /* output_file */) | |
| 76 | |
| 77 // Requests utility process to stop conversion and exit. | |
| 78 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop) | |
| 79 #endif // OS_WIN | |
| 80 | |
| 81 // Tell the utility process to render the given PDF into a PWGRaster. | 64 // Tell the utility process to render the given PDF into a PWGRaster. |
| 82 IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToPWGRaster, | 65 IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToPWGRaster, |
| 83 IPC::PlatformFileForTransit, /* Input PDF file */ | 66 IPC::PlatformFileForTransit, /* Input PDF file */ |
| 84 printing::PdfRenderSettings, /* PDF render settings */ | 67 printing::PdfRenderSettings, /* PDF render settings */ |
| 85 // PWG transform settings. | 68 // PWG transform settings. |
| 86 printing::PwgRasterSettings, | 69 printing::PwgRasterSettings, |
| 87 IPC::PlatformFileForTransit /* Output PWG file */) | 70 IPC::PlatformFileForTransit /* Output PWG file */) |
| 88 | 71 |
| 89 // Tells the utility process to get capabilities and defaults for the specified | 72 // Tells the utility process to get capabilities and defaults for the specified |
| 90 // printer. Used on Windows to isolate the service process from printer driver | 73 // printer. Used on Windows to isolate the service process from printer driver |
| 91 // crashes by executing this in a separate process. This does not run in a | 74 // crashes by executing this in a separate process. This does not run in a |
| 92 // sandbox. | 75 // sandbox. |
| 93 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults, | 76 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults, |
| 94 std::string /* printer name */) | 77 std::string /* printer name */) |
| 95 | 78 |
| 96 // Tells the utility process to get capabilities and defaults for the specified | 79 // Tells the utility process to get capabilities and defaults for the specified |
| 97 // printer. Used on Windows to isolate the service process from printer driver | 80 // printer. Used on Windows to isolate the service process from printer driver |
| 98 // crashes by executing this in a separate process. This does not run in a | 81 // crashes by executing this in a separate process. This does not run in a |
| 99 // sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults. | 82 // sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults. |
| 100 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults, | 83 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults, |
| 101 std::string /* printer name */) | 84 std::string /* printer name */) |
| 85 #endif // ENABLE_FULL_PRINTING | |
| 86 | |
| 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) | |
|
raymes
2014/09/26 04:47:29
Should this be #if defined(ENABLE_PRINTING) && !de
Vitaly Buka (NO REVIEWS)
2014/09/26 05:29:03
this messages windows only. it's for generation of
| |
| 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 */) | |
| 96 | |
| 97 // Requests conversion of the next page. | |
| 98 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage, | |
| 99 int /* page_number */, | |
| 100 IPC::PlatformFileForTransit /* output_file */) | |
| 101 | |
| 102 // Requests utility process to stop conversion and exit. | |
| 103 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop) | |
| 104 #endif // ENABLE_PRINTING && OS_WIN | |
| 102 | 105 |
| 103 //------------------------------------------------------------------------------ | 106 //------------------------------------------------------------------------------ |
| 104 // Utility process host messages: | 107 // Utility process host messages: |
| 105 // These are messages from the utility process to the browser. | 108 // These are messages from the utility process to the browser. |
| 106 | 109 |
| 107 #if defined(OS_WIN) | 110 #if defined(ENABLE_FULL_PRINTING) |
| 108 // Reply when the utility process loaded PDF. |page_count| is 0, if loading | |
| 109 // failed. | |
| 110 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, | |
| 111 int /* page_count */) | |
| 112 | |
| 113 // Reply when the utility process rendered the PDF page. | |
| 114 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone, | |
| 115 bool /* success */, | |
| 116 double /* scale_factor */) | |
| 117 #endif // OS_WIN | |
| 118 | |
| 119 // Reply when the utility process has succeeded in rendering the PDF to PWG. | 111 // Reply when the utility process has succeeded in rendering the PDF to PWG. |
| 120 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded) | 112 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded) |
| 121 | 113 |
| 122 // Reply when an error occurred rendering the PDF to PWG. | 114 // Reply when an error occurred rendering the PDF to PWG. |
| 123 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed) | 115 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Failed) |
| 124 | 116 |
| 125 // Reply when the utility process has succeeded in obtaining the printer | 117 // Reply when the utility process has succeeded in obtaining the printer |
| 126 // capabilities and defaults. | 118 // capabilities and defaults. |
| 127 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded, | 119 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded, |
| 128 std::string /* printer name */, | 120 std::string /* printer name */, |
| 129 printing::PrinterCapsAndDefaults) | 121 printing::PrinterCapsAndDefaults) |
| 130 | 122 |
| 131 // Reply when the utility process has succeeded in obtaining the printer | 123 // Reply when the utility process has succeeded in obtaining the printer |
| 132 // semantic capabilities and defaults. | 124 // semantic capabilities and defaults. |
| 133 IPC_MESSAGE_CONTROL2( | 125 IPC_MESSAGE_CONTROL2( |
| 134 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Succeeded, | 126 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Succeeded, |
| 135 std::string /* printer name */, | 127 std::string /* printer name */, |
| 136 printing::PrinterSemanticCapsAndDefaults) | 128 printing::PrinterSemanticCapsAndDefaults) |
| 137 | 129 |
| 138 // Reply when the utility process has failed to obtain the printer | 130 // Reply when the utility process has failed to obtain the printer |
| 139 // capabilities and defaults. | 131 // capabilities and defaults. |
| 140 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed, | 132 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed, |
| 141 std::string /* printer name */) | 133 std::string /* printer name */) |
| 142 | 134 |
| 143 // Reply when the utility process has failed to obtain the printer | 135 // Reply when the utility process has failed to obtain the printer |
| 144 // semantic capabilities and defaults. | 136 // semantic capabilities and defaults. |
| 145 IPC_MESSAGE_CONTROL1( | 137 IPC_MESSAGE_CONTROL1( |
| 146 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed, | 138 ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed, |
| 147 std::string /* printer name */) | 139 std::string /* printer name */) |
| 140 #endif // ENABLE_FULL_PRINTING | |
| 148 | 141 |
| 149 #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 | |
| 144 // failed. | |
| 145 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, | |
| 146 int /* page_count */) | |
| 147 | |
| 148 // Reply when the utility process rendered the PDF page. | |
| 149 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone, | |
| 150 bool /* success */, | |
| 151 double /* scale_factor */) | |
| 152 #endif // ENABLE_PRINTING && OS_WIN | |
| OLD | NEW |