Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: ppapi/c/dev/ppp_printing_dev.h

Issue 5674004: Add compile assertions to enforce the sizes of all structs and enums in the C... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_macros.h"
10 #include "ppapi/c/pp_rect.h" 11 #include "ppapi/c/pp_rect.h"
11 #include "ppapi/c/pp_resource.h" 12 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_stdint.h" 13 #include "ppapi/c/pp_stdint.h"
13 14
14 typedef enum { 15 typedef enum {
15 PP_PRINTORIENTATION_NORMAL = 0, 16 PP_PRINTORIENTATION_NORMAL = 0,
16 PP_PRINTORIENTATION_ROTATED_90_CW = 1, 17 PP_PRINTORIENTATION_ROTATED_90_CW = 1,
17 PP_PRINTORIENTATION_ROTATED_180 = 2, 18 PP_PRINTORIENTATION_ROTATED_180 = 2,
18 PP_PRINTORIENTATION_ROTATED_90_CCW = 3 19 PP_PRINTORIENTATION_ROTATED_90_CCW = 3
19 } PP_PrintOrientation_Dev; 20 } PP_PrintOrientation_Dev;
21 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4);
20 22
21 typedef enum { 23 typedef enum {
22 PP_PRINTOUTPUTFORMAT_RASTER = 0, 24 PP_PRINTOUTPUTFORMAT_RASTER = 0,
23 PP_PRINTOUTPUTFORMAT_PDF = 1, 25 PP_PRINTOUTPUTFORMAT_PDF = 1,
24 PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 2 26 PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 2
25 } PP_PrintOutputFormat_Dev; 27 } PP_PrintOutputFormat_Dev;
28 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4);
26 29
27 struct PP_PrintSettings_Dev { 30 struct PP_PrintSettings_Dev {
28 // 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)
29 struct PP_Rect printable_area; 32 struct PP_Rect printable_area;
30 int32_t dpi; 33 int32_t dpi;
31 PP_PrintOrientation_Dev orientation; 34 PP_PrintOrientation_Dev orientation;
32 PP_Bool grayscale; 35 PP_Bool grayscale;
33 PP_PrintOutputFormat_Dev format; 36 PP_PrintOutputFormat_Dev format;
34 }; 37 };
38 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 32);
35 39
36 // Specifies a contiguous range of page numbers to be printed. 40 // Specifies a contiguous range of page numbers to be printed.
37 // The page numbers use a zero-based index. 41 // The page numbers use a zero-based index.
38 struct PP_PrintPageNumberRange_Dev { 42 struct PP_PrintPageNumberRange_Dev {
39 uint32_t first_page_number; 43 uint32_t first_page_number;
40 uint32_t last_page_number; 44 uint32_t last_page_number;
41 }; 45 };
46 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8);
42 47
43 // Interface for the plugin to implement printing. 48 // Interface for the plugin to implement printing.
44 #define PPP_PRINTING_DEV_INTERFACE "PPP_Printing(Dev);0.2" 49 #define PPP_PRINTING_DEV_INTERFACE "PPP_Printing(Dev);0.2"
45 50
46 struct PPP_Printing_Dev { 51 struct PPP_Printing_Dev {
47 // Returns array of supported print output formats. The array is allocated 52 // Returns array of supported print output formats. The array is allocated
48 // using PPB_Core.MemAlloc. The caller is responsible for freeing the array 53 // using PPB_Core.MemAlloc. The caller is responsible for freeing the array
49 // using PPB_Core.MemFree. 54 // using PPB_Core.MemFree.
50 // Sets |*format_count| to 0 returns NULL if printing is not supported at all. 55 // Sets |*format_count| to 0 returns NULL if printing is not supported at all.
51 PP_PrintOutputFormat_Dev* (*QuerySupportedFormats)(PP_Instance instance, 56 PP_PrintOutputFormat_Dev* (*QuerySupportedFormats)(PP_Instance instance,
(...skipping 13 matching lines...) Expand all
65 PP_Resource (*PrintPages)( 70 PP_Resource (*PrintPages)(
66 PP_Instance instance, 71 PP_Instance instance,
67 const struct PP_PrintPageNumberRange_Dev* page_ranges, 72 const struct PP_PrintPageNumberRange_Dev* page_ranges,
68 uint32_t page_range_count); 73 uint32_t page_range_count);
69 74
70 // Ends the print session. Further calls to PrintPage will fail. 75 // Ends the print session. Further calls to PrintPage will fail.
71 void (*End)(PP_Instance instance); 76 void (*End)(PP_Instance instance);
72 }; 77 };
73 78
74 #endif // PPAPI_C_DEV_PPP_PRINTING_DEV_H_ 79 #endif // PPAPI_C_DEV_PPP_PRINTING_DEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698