| 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" |
| 11 #include "ppapi/c/pp_rect.h" | 11 #include "ppapi/c/pp_rect.h" |
| 12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
| 13 #include "ppapi/c/pp_stdint.h" | 13 #include "ppapi/c/pp_stdint.h" |
| 14 | 14 |
| 15 typedef enum { | 15 typedef enum { |
| 16 PP_PRINTORIENTATION_NORMAL = 0, | 16 PP_PRINTORIENTATION_NORMAL = 0, |
| 17 PP_PRINTORIENTATION_ROTATED_90_CW = 1, | 17 PP_PRINTORIENTATION_ROTATED_90_CW = 1, |
| 18 PP_PRINTORIENTATION_ROTATED_180 = 2, | 18 PP_PRINTORIENTATION_ROTATED_180 = 2, |
| 19 PP_PRINTORIENTATION_ROTATED_90_CCW = 3 | 19 PP_PRINTORIENTATION_ROTATED_90_CCW = 3 |
| 20 } PP_PrintOrientation_Dev; | 20 } PP_PrintOrientation_Dev; |
| 21 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); | 21 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); |
| 22 | 22 |
| 23 /* TODO(dmichael): We should make published .h files contain only the latest | |
| 24 version, with no explicit version number in the type name. | |
| 25 For internal versions to be used by Chrome and NaCl, we | |
| 26 should include all versions for every type, with no 'default' | |
| 27 version (i.e., all type names are versioned). */ | |
| 28 typedef enum { | 23 typedef enum { |
| 29 PP_PRINTOUTPUTFORMAT_RASTER_0_3 = 0, | 24 PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0, |
| 30 PP_PRINTOUTPUTFORMAT_PDF_0_3 = 1, | 25 PP_PRINTOUTPUTFORMAT_PDF = 1u << 1, |
| 31 PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_3 = 2 | 26 PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2 |
| 32 } PP_PrintOutputFormat_Dev_0_3; | 27 } PP_PrintOutputFormat_Dev; |
| 33 typedef enum { | |
| 34 PP_PRINTOUTPUTFORMAT_RASTER_0_4 = 1u << 0, | |
| 35 PP_PRINTOUTPUTFORMAT_PDF_0_4 = 1u << 1, | |
| 36 PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_4 = 1u << 2 | |
| 37 } PP_PrintOutputFormat_Dev_0_4; | |
| 38 | |
| 39 typedef PP_PrintOutputFormat_Dev_0_4 PP_PrintOutputFormat_Dev; | |
| 40 #define PP_PRINTOUTPUTFORMAT_RASTER PP_PRINTOUTPUTFORMAT_RASTER_0_4 | |
| 41 #define PP_PRINTOUTPUTFORMAT_PDF PP_PRINTOUTPUTFORMAT_PDF_0_4 | |
| 42 #define PP_PRINTOUTPUTFORMAT_POSTSCRIPT PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_4 | |
| 43 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); | 28 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); |
| 44 | 29 |
| 45 struct PP_PrintSettings_Dev { | 30 struct PP_PrintSettings_Dev { |
| 46 /** This is the size of the printable area in points (1/72 of an inch) */ | 31 /** This is the size of the printable area in points (1/72 of an inch) */ |
| 47 struct PP_Rect printable_area; | 32 struct PP_Rect printable_area; |
| 48 int32_t dpi; | 33 int32_t dpi; |
| 49 PP_PrintOrientation_Dev orientation; | 34 PP_PrintOrientation_Dev orientation; |
| 50 PP_Bool grayscale; | 35 PP_Bool grayscale; |
| 51 PP_PrintOutputFormat_Dev format; | 36 PP_PrintOutputFormat_Dev format; |
| 52 }; | 37 }; |
| 53 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 32); | 38 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 32); |
| 54 | 39 |
| 55 /* The following versioned structs are exact copies of the above unversioned | |
| 56 struct, except that PP_PrintOutputFormat_Dev_0_3 or | |
| 57 PP_PrintOutputFormat_Dev_0_4 is used instead of PP_PrintOutputFormat_Dev. | |
| 58 This is for use by Chrome & NaCl, which always use versioned type names. Each | |
| 59 must be bit-for-bit compatible with the associated version of | |
| 60 PPP_PrintOutputFormat_Dev above. | |
| 61 TODO(dmichael,noelallen): Fix this by having separate internal vs external | |
| 62 headers generated by IDL. */ | |
| 63 struct PP_PrintSettings_Dev_0_3 { | |
| 64 struct PP_Rect printable_area; | |
| 65 int32_t dpi; | |
| 66 PP_PrintOrientation_Dev orientation; | |
| 67 PP_Bool grayscale; | |
| 68 PP_PrintOutputFormat_Dev_0_3 format; | |
| 69 }; | |
| 70 | |
| 71 struct PP_PrintSettings_Dev_0_4 { | |
| 72 struct PP_Rect printable_area; | |
| 73 int32_t dpi; | |
| 74 PP_PrintOrientation_Dev orientation; | |
| 75 PP_Bool grayscale; | |
| 76 PP_PrintOutputFormat_Dev_0_4 format; | |
| 77 }; | |
| 78 | |
| 79 /** | 40 /** |
| 80 * Specifies a contiguous range of page numbers to be printed. | 41 * Specifies a contiguous range of page numbers to be printed. |
| 81 * The page numbers use a zero-based index. | 42 * The page numbers use a zero-based index. |
| 82 */ | 43 */ |
| 83 struct PP_PrintPageNumberRange_Dev { | 44 struct PP_PrintPageNumberRange_Dev { |
| 84 uint32_t first_page_number; | 45 uint32_t first_page_number; |
| 85 uint32_t last_page_number; | 46 uint32_t last_page_number; |
| 86 }; | 47 }; |
| 87 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); | 48 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); |
| 88 | 49 |
| 89 /* Interface for the plugin to implement printing. */ | 50 /* Interface for the plugin to implement printing. */ |
| 90 #define PPP_PRINTING_DEV_INTERFACE_0_3 "PPP_Printing(Dev);0.3" | |
| 91 #define PPP_PRINTING_DEV_INTERFACE_0_4 "PPP_Printing(Dev);0.4" | 51 #define PPP_PRINTING_DEV_INTERFACE_0_4 "PPP_Printing(Dev);0.4" |
| 92 #define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_4 | 52 #define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_4 |
| 93 | 53 |
| 94 struct PPP_Printing_Dev { | 54 struct PPP_Printing_Dev { |
| 95 /** | 55 /** |
| 96 * Returns a bit field representing the supported print output formats. For | 56 * Returns a bit field representing the supported print output formats. For |
| 97 * example, if only Raster and PostScript are supported, | 57 * example, if only Raster and PostScript are supported, |
| 98 * QuerySupportedFormats returns a value equivalent to: | 58 * QuerySupportedFormats returns a value equivalent to: |
| 99 * (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) | 59 * (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) |
| 100 */ | 60 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 118 */ | 78 */ |
| 119 PP_Resource (*PrintPages)( | 79 PP_Resource (*PrintPages)( |
| 120 PP_Instance instance, | 80 PP_Instance instance, |
| 121 const struct PP_PrintPageNumberRange_Dev* page_ranges, | 81 const struct PP_PrintPageNumberRange_Dev* page_ranges, |
| 122 uint32_t page_range_count); | 82 uint32_t page_range_count); |
| 123 | 83 |
| 124 /** Ends the print session. Further calls to PrintPage will fail. */ | 84 /** Ends the print session. Further calls to PrintPage will fail. */ |
| 125 void (*End)(PP_Instance instance); | 85 void (*End)(PP_Instance instance); |
| 126 }; | 86 }; |
| 127 | 87 |
| 128 /* The following versioned structs are exact copies of the above unversioned | |
| 129 struct, except that PP_PrintSettings_Dev_0_3 or PP_PrintSettings_Dev_0_4 is | |
| 130 used instead of PP_PrintSettings_Dev. This is for use by Chrome & NaCl, which | |
| 131 always use versioned type names. Each must be bit-for-bit compatible with the | |
| 132 associated version of PPP_Printing_Dev above. | |
| 133 TODO(dmichael): Remove versioning from this header. */ | |
| 134 struct PPP_Printing_Dev_0_4 { | |
| 135 uint32_t (*QuerySupportedFormats)(PP_Instance instance); | |
| 136 int32_t (*Begin)(PP_Instance instance, | |
| 137 const struct PP_PrintSettings_Dev_0_4* print_settings); | |
| 138 PP_Resource (*PrintPages)( | |
| 139 PP_Instance instance, | |
| 140 const struct PP_PrintPageNumberRange_Dev* page_ranges, | |
| 141 uint32_t page_range_count); | |
| 142 void (*End)(PP_Instance instance); | |
| 143 }; | |
| 144 | |
| 145 struct PPP_Printing_Dev_0_3 { | |
| 146 PP_PrintOutputFormat_Dev_0_3* (*QuerySupportedFormats)( | |
| 147 PP_Instance instance, uint32_t* format_count); | |
| 148 int32_t (*Begin)(PP_Instance instance, | |
| 149 const struct PP_PrintSettings_Dev_0_3* print_settings); | |
| 150 PP_Resource (*PrintPages)( | |
| 151 PP_Instance instance, | |
| 152 const struct PP_PrintPageNumberRange_Dev* page_ranges, | |
| 153 uint32_t page_range_count); | |
| 154 void (*End)(PP_Instance instance); | |
| 155 }; | |
| 156 | |
| 157 #endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */ | 88 #endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */ |
| 158 | 89 |
| OLD | NEW |