| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 #ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_ |
| 6 #define PPAPI_C_DEV_PPP_PRINTING_DEV_H_ | 6 #define PPAPI_C_DEV_PPP_PRINTING_DEV_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/c/pp_macros.h" | 10 #include "ppapi/c/pp_macros.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 PP_PRINTOUTPUTFORMAT_RASTER_0_3 = 0, | 29 PP_PRINTOUTPUTFORMAT_RASTER_0_3 = 0, |
| 30 PP_PRINTOUTPUTFORMAT_PDF_0_3 = 1, | 30 PP_PRINTOUTPUTFORMAT_PDF_0_3 = 1, |
| 31 PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_3 = 2 | 31 PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_3 = 2 |
| 32 } PP_PrintOutputFormat_Dev_0_3; | 32 } PP_PrintOutputFormat_Dev_0_3; |
| 33 typedef enum { | 33 typedef enum { |
| 34 PP_PRINTOUTPUTFORMAT_RASTER_0_4 = 1u << 0, | 34 PP_PRINTOUTPUTFORMAT_RASTER_0_4 = 1u << 0, |
| 35 PP_PRINTOUTPUTFORMAT_PDF_0_4 = 1u << 1, | 35 PP_PRINTOUTPUTFORMAT_PDF_0_4 = 1u << 1, |
| 36 PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_4 = 1u << 2 | 36 PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_4 = 1u << 2 |
| 37 } PP_PrintOutputFormat_Dev_0_4; | 37 } PP_PrintOutputFormat_Dev_0_4; |
| 38 | 38 |
| 39 /* TODO(dmichael): Remove the conditional compilation when NaCl proxy is | |
| 40 ported to 0.4. Remove 0.3 when PDF is ported. */ | |
| 41 #ifdef PPP_PRINTING_DEV_USE_0_4 | |
| 42 typedef PP_PrintOutputFormat_Dev_0_4 PP_PrintOutputFormat_Dev; | 39 typedef PP_PrintOutputFormat_Dev_0_4 PP_PrintOutputFormat_Dev; |
| 43 #define PP_PRINTOUTPUTFORMAT_RASTER PP_PRINTOUTPUTFORMAT_RASTER_0_4 | 40 #define PP_PRINTOUTPUTFORMAT_RASTER PP_PRINTOUTPUTFORMAT_RASTER_0_4 |
| 44 #define PP_PRINTOUTPUTFORMAT_PDF PP_PRINTOUTPUTFORMAT_PDF_0_4 | 41 #define PP_PRINTOUTPUTFORMAT_PDF PP_PRINTOUTPUTFORMAT_PDF_0_4 |
| 45 #define PP_PRINTOUTPUTFORMAT_POSTSCRIPT PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_4 | 42 #define PP_PRINTOUTPUTFORMAT_POSTSCRIPT PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_4 |
| 46 #else | |
| 47 typedef PP_PrintOutputFormat_Dev_0_3 PP_PrintOutputFormat_Dev; | |
| 48 #define PP_PRINTOUTPUTFORMAT_RASTER PP_PRINTOUTPUTFORMAT_RASTER_0_3 | |
| 49 #define PP_PRINTOUTPUTFORMAT_PDF PP_PRINTOUTPUTFORMAT_PDF_0_3 | |
| 50 #define PP_PRINTOUTPUTFORMAT_POSTSCRIPT PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_3 | |
| 51 #endif | |
| 52 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); | 43 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); |
| 53 | 44 |
| 54 struct PP_PrintSettings_Dev { | 45 struct PP_PrintSettings_Dev { |
| 55 /** This is the size of the printable area in points (1/72 of an inch) */ | 46 /** This is the size of the printable area in points (1/72 of an inch) */ |
| 56 struct PP_Rect printable_area; | 47 struct PP_Rect printable_area; |
| 57 int32_t dpi; | 48 int32_t dpi; |
| 58 PP_PrintOrientation_Dev orientation; | 49 PP_PrintOrientation_Dev orientation; |
| 59 PP_Bool grayscale; | 50 PP_Bool grayscale; |
| 60 PP_PrintOutputFormat_Dev format; | 51 PP_PrintOutputFormat_Dev format; |
| 61 }; | 52 }; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 91 */ | 82 */ |
| 92 struct PP_PrintPageNumberRange_Dev { | 83 struct PP_PrintPageNumberRange_Dev { |
| 93 uint32_t first_page_number; | 84 uint32_t first_page_number; |
| 94 uint32_t last_page_number; | 85 uint32_t last_page_number; |
| 95 }; | 86 }; |
| 96 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); | 87 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); |
| 97 | 88 |
| 98 /* Interface for the plugin to implement printing. */ | 89 /* Interface for the plugin to implement printing. */ |
| 99 #define PPP_PRINTING_DEV_INTERFACE_0_3 "PPP_Printing(Dev);0.3" | 90 #define PPP_PRINTING_DEV_INTERFACE_0_3 "PPP_Printing(Dev);0.3" |
| 100 #define PPP_PRINTING_DEV_INTERFACE_0_4 "PPP_Printing(Dev);0.4" | 91 #define PPP_PRINTING_DEV_INTERFACE_0_4 "PPP_Printing(Dev);0.4" |
| 101 #ifdef PPP_PRINTING_DEV_USE_0_4 | |
| 102 #define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_4 | 92 #define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_4 |
| 103 #else | |
| 104 #define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_3 | |
| 105 #endif | |
| 106 | 93 |
| 107 #ifdef PPP_PRINTING_DEV_USE_0_4 | |
| 108 struct PPP_Printing_Dev { | 94 struct PPP_Printing_Dev { |
| 109 /** | 95 /** |
| 110 * Returns a bit field representing the supported print output formats. For | 96 * Returns a bit field representing the supported print output formats. For |
| 111 * example, if only Raster and PostScript are supported, | 97 * example, if only Raster and PostScript are supported, |
| 112 * QuerySupportedFormats returns a value equivalent to: | 98 * QuerySupportedFormats returns a value equivalent to: |
| 113 * (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) | 99 * (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) |
| 114 */ | 100 */ |
| 115 uint32_t (*QuerySupportedFormats)(PP_Instance instance); | 101 uint32_t (*QuerySupportedFormats)(PP_Instance instance); |
| 116 | 102 |
| 117 /** | 103 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 131 * failure. | 117 * failure. |
| 132 */ | 118 */ |
| 133 PP_Resource (*PrintPages)( | 119 PP_Resource (*PrintPages)( |
| 134 PP_Instance instance, | 120 PP_Instance instance, |
| 135 const struct PP_PrintPageNumberRange_Dev* page_ranges, | 121 const struct PP_PrintPageNumberRange_Dev* page_ranges, |
| 136 uint32_t page_range_count); | 122 uint32_t page_range_count); |
| 137 | 123 |
| 138 /** Ends the print session. Further calls to PrintPage will fail. */ | 124 /** Ends the print session. Further calls to PrintPage will fail. */ |
| 139 void (*End)(PP_Instance instance); | 125 void (*End)(PP_Instance instance); |
| 140 }; | 126 }; |
| 141 #else | |
| 142 struct PPP_Printing_Dev { | |
| 143 /** | |
| 144 * Returns an array of supported print output formats. The array is allocated | |
| 145 * using PPB_Core.MemAlloc. The caller is responsible for freeing the array | |
| 146 * using PPB_Core.MemFree. | |
| 147 * Sets |*format_count| to 0 returns NULL if printing is not supported at | |
| 148 * all. | |
| 149 */ | |
| 150 PP_PrintOutputFormat_Dev* (*QuerySupportedFormats)( | |
| 151 PP_Instance instance, uint32_t* format_count); | |
| 152 | 127 |
| 153 /* See the alternate definition of PPP_Printing_Dev above for documentation | |
| 154 * on these functions. | |
| 155 */ | |
| 156 int32_t (*Begin)(PP_Instance instance, | |
| 157 const struct PP_PrintSettings_Dev* print_settings); | |
| 158 PP_Resource (*PrintPages)( | |
| 159 PP_Instance instance, | |
| 160 const struct PP_PrintPageNumberRange_Dev* page_ranges, | |
| 161 uint32_t page_range_count); | |
| 162 void (*End)(PP_Instance instance); | |
| 163 }; | |
| 164 #endif | |
| 165 /* The following versioned structs are exact copies of the above unversioned | 128 /* The following versioned structs are exact copies of the above unversioned |
| 166 structs, except that PP_PrintSettings_Dev_0_3 or PP_PrintSettings_Dev_0_4 is | 129 struct, except that PP_PrintSettings_Dev_0_3 or PP_PrintSettings_Dev_0_4 is |
| 167 used instead of PP_PrintSettings_Dev. This is for use by Chrome & NaCl, which | 130 used instead of PP_PrintSettings_Dev. This is for use by Chrome & NaCl, which |
| 168 always use versioned type names. Each must be bit-for-bit compatible with the | 131 always use versioned type names. Each must be bit-for-bit compatible with the |
| 169 associated version of PPP_Printing_Dev above. | 132 associated version of PPP_Printing_Dev above. |
| 170 TODO(dmichael,noelallen): Fix this by having separate internal vs external | 133 TODO(dmichael): Remove versioning from this header. */ |
| 171 headers generated by IDL. */ | |
| 172 struct PPP_Printing_Dev_0_4 { | 134 struct PPP_Printing_Dev_0_4 { |
| 173 uint32_t (*QuerySupportedFormats)(PP_Instance instance); | 135 uint32_t (*QuerySupportedFormats)(PP_Instance instance); |
| 174 int32_t (*Begin)(PP_Instance instance, | 136 int32_t (*Begin)(PP_Instance instance, |
| 175 const struct PP_PrintSettings_Dev_0_4* print_settings); | 137 const struct PP_PrintSettings_Dev_0_4* print_settings); |
| 176 PP_Resource (*PrintPages)( | 138 PP_Resource (*PrintPages)( |
| 177 PP_Instance instance, | 139 PP_Instance instance, |
| 178 const struct PP_PrintPageNumberRange_Dev* page_ranges, | 140 const struct PP_PrintPageNumberRange_Dev* page_ranges, |
| 179 uint32_t page_range_count); | 141 uint32_t page_range_count); |
| 180 void (*End)(PP_Instance instance); | 142 void (*End)(PP_Instance instance); |
| 181 }; | 143 }; |
| 182 | 144 |
| 183 struct PPP_Printing_Dev_0_3 { | 145 struct PPP_Printing_Dev_0_3 { |
| 184 PP_PrintOutputFormat_Dev* (*QuerySupportedFormats)( | 146 PP_PrintOutputFormat_Dev_0_3* (*QuerySupportedFormats)( |
| 185 PP_Instance instance, uint32_t* format_count); | 147 PP_Instance instance, uint32_t* format_count); |
| 186 int32_t (*Begin)(PP_Instance instance, | 148 int32_t (*Begin)(PP_Instance instance, |
| 187 const struct PP_PrintSettings_Dev_0_3* print_settings); | 149 const struct PP_PrintSettings_Dev_0_3* print_settings); |
| 188 PP_Resource (*PrintPages)( | 150 PP_Resource (*PrintPages)( |
| 189 PP_Instance instance, | 151 PP_Instance instance, |
| 190 const struct PP_PrintPageNumberRange_Dev* page_ranges, | 152 const struct PP_PrintPageNumberRange_Dev* page_ranges, |
| 191 uint32_t page_range_count); | 153 uint32_t page_range_count); |
| 192 void (*End)(PP_Instance instance); | 154 void (*End)(PP_Instance instance); |
| 193 }; | 155 }; |
| 194 | 156 |
| 195 #endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */ | 157 #endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */ |
| 196 | 158 |
| OLD | NEW |