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 // IPC messages for printing. | 5 // IPC messages for printing. |
6 // Multiply-included message file, hence no include guard. | 6 // Multiply-included message file, hence no include guard. |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/values.h" | 10 #include "base/values.h" |
9 #include "base/shared_memory.h" | 11 #include "base/shared_memory.h" |
10 #include "ipc/ipc_message_macros.h" | 12 #include "ipc/ipc_message_macros.h" |
11 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
13 | 15 |
| 16 #ifndef CHROME_COMMON_PRINT_MESSAGES_H_ |
| 17 #define CHROME_COMMON_PRINT_MESSAGES_H_ |
| 18 |
| 19 struct PrintMsg_Print_Params { |
| 20 PrintMsg_Print_Params(); |
| 21 ~PrintMsg_Print_Params(); |
| 22 |
| 23 // Resets the members of the struct to 0. |
| 24 void Reset(); |
| 25 |
| 26 gfx::Size page_size; |
| 27 gfx::Size printable_size; |
| 28 int margin_top; |
| 29 int margin_left; |
| 30 double dpi; |
| 31 double min_shrink; |
| 32 double max_shrink; |
| 33 int desired_dpi; |
| 34 int document_cookie; |
| 35 bool selection_only; |
| 36 bool supports_alpha_blend; |
| 37 int preview_request_id; |
| 38 bool is_first_request; |
| 39 bool display_header_footer; |
| 40 string16 date; |
| 41 string16 title; |
| 42 string16 url; |
| 43 }; |
| 44 |
| 45 struct PrintMsg_PrintPages_Params { |
| 46 PrintMsg_PrintPages_Params(); |
| 47 ~PrintMsg_PrintPages_Params(); |
| 48 |
| 49 // Resets the members of the struct to 0. |
| 50 void Reset(); |
| 51 |
| 52 PrintMsg_Print_Params params; |
| 53 std::vector<int> pages; |
| 54 }; |
| 55 |
| 56 #endif // CHROME_COMMON_PRINT_MESSAGES_H_ |
| 57 |
14 #define IPC_MESSAGE_START PrintMsgStart | 58 #define IPC_MESSAGE_START PrintMsgStart |
15 | 59 |
16 // Parameters for a render request. | 60 // Parameters for a render request. |
17 IPC_STRUCT_BEGIN(PrintMsg_Print_Params) | 61 IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params) |
18 // Physical size of the page, including non-printable margins, | 62 // Physical size of the page, including non-printable margins, |
19 // in pixels according to dpi. | 63 // in pixels according to dpi. |
20 IPC_STRUCT_MEMBER(gfx::Size, page_size) | 64 IPC_STRUCT_TRAITS_MEMBER(page_size) |
21 | 65 |
22 // In pixels according to dpi_x and dpi_y. | 66 // In pixels according to dpi_x and dpi_y. |
23 IPC_STRUCT_MEMBER(gfx::Size, printable_size) | 67 IPC_STRUCT_TRAITS_MEMBER(printable_size) |
24 | 68 |
25 // The y-offset of the printable area, in pixels according to dpi. | 69 // The y-offset of the printable area, in pixels according to dpi. |
26 IPC_STRUCT_MEMBER(int, margin_top) | 70 IPC_STRUCT_TRAITS_MEMBER(margin_top) |
27 | 71 |
28 // The x-offset of the printable area, in pixels according to dpi. | 72 // The x-offset of the printable area, in pixels according to dpi. |
29 IPC_STRUCT_MEMBER(int, margin_left) | 73 IPC_STRUCT_TRAITS_MEMBER(margin_left) |
30 | 74 |
31 // Specifies dots per inch. | 75 // Specifies dots per inch. |
32 IPC_STRUCT_MEMBER(double, dpi) | 76 IPC_STRUCT_TRAITS_MEMBER(dpi) |
33 | 77 |
34 // Minimum shrink factor. See PrintSettings::min_shrink for more information. | 78 // Minimum shrink factor. See PrintSettings::min_shrink for more information. |
35 IPC_STRUCT_MEMBER(double, min_shrink) | 79 IPC_STRUCT_TRAITS_MEMBER(min_shrink) |
36 | 80 |
37 // Maximum shrink factor. See PrintSettings::max_shrink for more information. | 81 // Maximum shrink factor. See PrintSettings::max_shrink for more information. |
38 IPC_STRUCT_MEMBER(double, max_shrink) | 82 IPC_STRUCT_TRAITS_MEMBER(max_shrink) |
39 | 83 |
40 // Desired apparent dpi on paper. | 84 // Desired apparent dpi on paper. |
41 IPC_STRUCT_MEMBER(int, desired_dpi) | 85 IPC_STRUCT_TRAITS_MEMBER(desired_dpi) |
42 | 86 |
43 // Cookie for the document to ensure correctness. | 87 // Cookie for the document to ensure correctness. |
44 IPC_STRUCT_MEMBER(int, document_cookie) | 88 IPC_STRUCT_TRAITS_MEMBER(document_cookie) |
45 | 89 |
46 // Should only print currently selected text. | 90 // Should only print currently selected text. |
47 IPC_STRUCT_MEMBER(bool, selection_only) | 91 IPC_STRUCT_TRAITS_MEMBER(selection_only) |
48 | 92 |
49 // Does the printer support alpha blending? | 93 // Does the printer support alpha blending? |
50 IPC_STRUCT_MEMBER(bool, supports_alpha_blend) | 94 IPC_STRUCT_TRAITS_MEMBER(supports_alpha_blend) |
51 | 95 |
52 // The id of the preview request, used only for print preview. | 96 // The id of the preview request, used only for print preview. |
53 IPC_STRUCT_MEMBER(int, preview_request_id) | 97 IPC_STRUCT_TRAITS_MEMBER(preview_request_id) |
54 | 98 |
55 // True if this is the first preview request, used only for print preview. | 99 // True if this is the first preview request, used only for print preview. |
56 IPC_STRUCT_MEMBER(bool, is_first_request) | 100 IPC_STRUCT_TRAITS_MEMBER(is_first_request) |
57 | 101 |
58 // Specifies if the header and footer should be rendered. | 102 // Specifies if the header and footer should be rendered. |
59 IPC_STRUCT_MEMBER(bool, display_header_footer) | 103 IPC_STRUCT_TRAITS_MEMBER(display_header_footer) |
60 | 104 |
61 // Date string to be printed as header if requested by the user. | 105 // Date string to be printed as header if requested by the user. |
62 IPC_STRUCT_MEMBER(string16, date) | 106 IPC_STRUCT_TRAITS_MEMBER(date) |
63 | 107 |
64 // Title string to be printed as header if requested by the user. | 108 // Title string to be printed as header if requested by the user. |
65 IPC_STRUCT_MEMBER(string16, title) | 109 IPC_STRUCT_TRAITS_MEMBER(title) |
66 | 110 |
67 // URL string to be printed as footer if requested by the user. | 111 // URL string to be printed as footer if requested by the user. |
68 IPC_STRUCT_MEMBER(string16, url) | 112 IPC_STRUCT_TRAITS_MEMBER(url) |
69 IPC_STRUCT_END() | 113 IPC_STRUCT_TRAITS_END() |
70 | 114 |
71 IPC_STRUCT_BEGIN(PrintMsg_PrintPage_Params) | 115 IPC_STRUCT_BEGIN(PrintMsg_PrintPage_Params) |
72 // Parameters to render the page as a printed page. It must always be the same | 116 // Parameters to render the page as a printed page. It must always be the same |
73 // value for all the document. | 117 // value for all the document. |
74 IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params) | 118 IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params) |
75 | 119 |
76 // The page number is the indicator of the square that should be rendered | 120 // The page number is the indicator of the square that should be rendered |
77 // according to the layout specified in PrintMsg_Print_Params. | 121 // according to the layout specified in PrintMsg_Print_Params. |
78 IPC_STRUCT_MEMBER(int, page_number) | 122 IPC_STRUCT_MEMBER(int, page_number) |
79 IPC_STRUCT_END() | 123 IPC_STRUCT_END() |
80 | 124 |
81 IPC_STRUCT_BEGIN(PrintMsg_PrintPages_Params) | 125 IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) |
82 // Parameters to render the page as a printed page. It must always be the same | 126 // Parameters to render the page as a printed page. It must always be the same |
83 // value for all the document. | 127 // value for all the document. |
84 IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params) | 128 IPC_STRUCT_TRAITS_MEMBER(params) |
85 | 129 |
86 // If empty, this means a request to render all the printed pages. | 130 // If empty, this means a request to render all the printed pages. |
87 IPC_STRUCT_MEMBER(std::vector<int>, pages) | 131 IPC_STRUCT_TRAITS_MEMBER(pages) |
88 IPC_STRUCT_END() | 132 IPC_STRUCT_TRAITS_END() |
89 | 133 |
90 // Parameters to describe a rendered document. | 134 // Parameters to describe a rendered document. |
91 IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) | 135 IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) |
92 // True when we can reuse existing preview data. |metafile_data_handle| and | 136 // True when we can reuse existing preview data. |metafile_data_handle| and |
93 // |data_size| should not be used when this is true. | 137 // |data_size| should not be used when this is true. |
94 IPC_STRUCT_MEMBER(bool, reuse_existing_data) | 138 IPC_STRUCT_MEMBER(bool, reuse_existing_data) |
95 | 139 |
96 // A shared memory handle to metafile data. | 140 // A shared memory handle to metafile data. |
97 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle) | 141 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle) |
98 | 142 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 IPC_MESSAGE_ROUTED1(PrintHostMsg_PagesReadyForPreview, | 350 IPC_MESSAGE_ROUTED1(PrintHostMsg_PagesReadyForPreview, |
307 PrintHostMsg_DidPreviewDocument_Params /* params */) | 351 PrintHostMsg_DidPreviewDocument_Params /* params */) |
308 | 352 |
309 // Tell the browser printing failed. | 353 // Tell the browser printing failed. |
310 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, | 354 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, |
311 int /* document cookie */) | 355 int /* document cookie */) |
312 | 356 |
313 // Tell the browser print preview failed. | 357 // Tell the browser print preview failed. |
314 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, | 358 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, |
315 int /* document cookie */) | 359 int /* document cookie */) |
OLD | NEW |