OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_rect.h" | 10 #include "ppapi/c/pp_rect.h" |
11 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
12 #include "ppapi/c/pp_stdint.h" | 12 #include "ppapi/c/pp_stdint.h" |
13 | 13 |
14 typedef enum { | 14 typedef enum { |
15 PP_PRINTORIENTATION_NORMAL = 0, | 15 PP_PRINTORIENTATION_NORMAL = 0, |
16 PP_PRINTORIENTATION_ROTATED_90_CW = 1, | 16 PP_PRINTORIENTATION_ROTATED_90_CW = 1, |
17 PP_PRINTORIENTATION_ROTATED_180 = 2, | 17 PP_PRINTORIENTATION_ROTATED_180 = 2, |
18 PP_PRINTORIENTATION_ROTATED_90_CCW = 3 | 18 PP_PRINTORIENTATION_ROTATED_90_CCW = 3 |
19 } PP_PrintOrientation_Dev; | 19 } PP_PrintOrientation_Dev; |
| 20 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); |
20 | 21 |
21 typedef enum { | 22 typedef enum { |
22 PP_PRINTOUTPUTFORMAT_RASTER = 0, | 23 PP_PRINTOUTPUTFORMAT_RASTER = 0, |
23 PP_PRINTOUTPUTFORMAT_PDF = 1, | 24 PP_PRINTOUTPUTFORMAT_PDF = 1, |
24 PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 2 | 25 PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 2 |
25 } PP_PrintOutputFormat_Dev; | 26 } PP_PrintOutputFormat_Dev; |
| 27 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); |
26 | 28 |
27 struct PP_PrintSettings_Dev { | 29 struct PP_PrintSettings_Dev { |
28 // This is the size of the printable area in points (1/72 of an inch) | 30 // This is the size of the printable area in points (1/72 of an inch) |
29 struct PP_Rect printable_area; | 31 struct PP_Rect printable_area; |
30 int32_t dpi; | 32 int32_t dpi; |
31 PP_PrintOrientation_Dev orientation; | 33 PP_PrintOrientation_Dev orientation; |
32 PP_Bool grayscale; | 34 PP_Bool grayscale; |
33 PP_PrintOutputFormat_Dev format; | 35 PP_PrintOutputFormat_Dev format; |
34 }; | 36 }; |
| 37 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 32); |
35 | 38 |
36 // Specifies a contiguous range of page numbers to be printed. | 39 // Specifies a contiguous range of page numbers to be printed. |
37 // The page numbers use a zero-based index. | 40 // The page numbers use a zero-based index. |
38 struct PP_PrintPageNumberRange_Dev { | 41 struct PP_PrintPageNumberRange_Dev { |
39 uint32_t first_page_number; | 42 uint32_t first_page_number; |
40 uint32_t last_page_number; | 43 uint32_t last_page_number; |
41 }; | 44 }; |
| 45 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); |
42 | 46 |
43 // Interface for the plugin to implement printing. | 47 // Interface for the plugin to implement printing. |
44 #define PPP_PRINTING_DEV_INTERFACE "PPP_Printing(Dev);0.2" | 48 #define PPP_PRINTING_DEV_INTERFACE "PPP_Printing(Dev);0.2" |
45 | 49 |
46 struct PPP_Printing_Dev { | 50 struct PPP_Printing_Dev { |
47 // Returns array of supported print output formats. The array is allocated | 51 // Returns array of supported print output formats. The array is allocated |
48 // using PPB_Core.MemAlloc. The caller is responsible for freeing the array | 52 // using PPB_Core.MemAlloc. The caller is responsible for freeing the array |
49 // using PPB_Core.MemFree. | 53 // using PPB_Core.MemFree. |
50 // Sets |*format_count| to 0 returns NULL if printing is not supported at all. | 54 // Sets |*format_count| to 0 returns NULL if printing is not supported at all. |
51 PP_PrintOutputFormat_Dev* (*QuerySupportedFormats)(PP_Instance instance, | 55 PP_PrintOutputFormat_Dev* (*QuerySupportedFormats)(PP_Instance instance, |
(...skipping 13 matching lines...) Expand all Loading... |
65 PP_Resource (*PrintPages)( | 69 PP_Resource (*PrintPages)( |
66 PP_Instance instance, | 70 PP_Instance instance, |
67 const struct PP_PrintPageNumberRange_Dev* page_ranges, | 71 const struct PP_PrintPageNumberRange_Dev* page_ranges, |
68 uint32_t page_range_count); | 72 uint32_t page_range_count); |
69 | 73 |
70 // Ends the print session. Further calls to PrintPage will fail. | 74 // Ends the print session. Further calls to PrintPage will fail. |
71 void (*End)(PP_Instance instance); | 75 void (*End)(PP_Instance instance); |
72 }; | 76 }; |
73 | 77 |
74 #endif // PPAPI_C_DEV_PPP_PRINTING_DEV_H_ | 78 #endif // PPAPI_C_DEV_PPP_PRINTING_DEV_H_ |
OLD | NEW |