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 <string> |
| 9 #include <vector> |
| 10 |
8 #include "base/values.h" | 11 #include "base/values.h" |
9 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
10 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
11 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
13 | 16 |
| 17 #ifndef CHROME_COMMON_PRINT_MESSAGES_H_ |
| 18 #define CHROME_COMMON_PRINT_MESSAGES_H_ |
| 19 |
| 20 struct PrintMsg_Print_Params { |
| 21 PrintMsg_Print_Params(); |
| 22 ~PrintMsg_Print_Params(); |
| 23 |
| 24 // Resets the members of the struct to 0. |
| 25 void Reset(); |
| 26 |
| 27 gfx::Size page_size; |
| 28 gfx::Size printable_size; |
| 29 int margin_top; |
| 30 int margin_left; |
| 31 double dpi; |
| 32 double min_shrink; |
| 33 double max_shrink; |
| 34 int desired_dpi; |
| 35 int document_cookie; |
| 36 bool selection_only; |
| 37 bool supports_alpha_blend; |
| 38 std::string preview_ui_addr; |
| 39 int preview_request_id; |
| 40 bool is_first_request; |
| 41 }; |
| 42 |
| 43 struct PrintMsg_PrintPages_Params { |
| 44 PrintMsg_PrintPages_Params(); |
| 45 ~PrintMsg_PrintPages_Params(); |
| 46 |
| 47 // Resets the members of the struct to 0. |
| 48 void Reset(); |
| 49 |
| 50 PrintMsg_Print_Params params; |
| 51 std::vector<int> pages; |
| 52 }; |
| 53 |
| 54 #endif // CHROME_COMMON_PRINT_MESSAGES_H_ |
| 55 |
14 #define IPC_MESSAGE_START PrintMsgStart | 56 #define IPC_MESSAGE_START PrintMsgStart |
15 | 57 |
16 // Parameters for a render request. | 58 // Parameters for a render request. |
17 IPC_STRUCT_BEGIN(PrintMsg_Print_Params) | 59 IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params) |
18 // Physical size of the page, including non-printable margins, | 60 // Physical size of the page, including non-printable margins, |
19 // in pixels according to dpi. | 61 // in pixels according to dpi. |
20 IPC_STRUCT_MEMBER(gfx::Size, page_size) | 62 IPC_STRUCT_TRAITS_MEMBER(page_size) |
21 | 63 |
22 // In pixels according to dpi_x and dpi_y. | 64 // In pixels according to dpi_x and dpi_y. |
23 IPC_STRUCT_MEMBER(gfx::Size, printable_size) | 65 IPC_STRUCT_TRAITS_MEMBER(printable_size) |
24 | 66 |
25 // The y-offset of the printable area, in pixels according to dpi. | 67 // The y-offset of the printable area, in pixels according to dpi. |
26 IPC_STRUCT_MEMBER(int, margin_top) | 68 IPC_STRUCT_TRAITS_MEMBER(margin_top) |
27 | 69 |
28 // The x-offset of the printable area, in pixels according to dpi. | 70 // The x-offset of the printable area, in pixels according to dpi. |
29 IPC_STRUCT_MEMBER(int, margin_left) | 71 IPC_STRUCT_TRAITS_MEMBER(margin_left) |
30 | 72 |
31 // Specifies dots per inch. | 73 // Specifies dots per inch. |
32 IPC_STRUCT_MEMBER(double, dpi) | 74 IPC_STRUCT_TRAITS_MEMBER(dpi) |
33 | 75 |
34 // Minimum shrink factor. See PrintSettings::min_shrink for more information. | 76 // Minimum shrink factor. See PrintSettings::min_shrink for more information. |
35 IPC_STRUCT_MEMBER(double, min_shrink) | 77 IPC_STRUCT_TRAITS_MEMBER(min_shrink) |
36 | 78 |
37 // Maximum shrink factor. See PrintSettings::max_shrink for more information. | 79 // Maximum shrink factor. See PrintSettings::max_shrink for more information. |
38 IPC_STRUCT_MEMBER(double, max_shrink) | 80 IPC_STRUCT_TRAITS_MEMBER(max_shrink) |
39 | 81 |
40 // Desired apparent dpi on paper. | 82 // Desired apparent dpi on paper. |
41 IPC_STRUCT_MEMBER(int, desired_dpi) | 83 IPC_STRUCT_TRAITS_MEMBER(desired_dpi) |
42 | 84 |
43 // Cookie for the document to ensure correctness. | 85 // Cookie for the document to ensure correctness. |
44 IPC_STRUCT_MEMBER(int, document_cookie) | 86 IPC_STRUCT_TRAITS_MEMBER(document_cookie) |
45 | 87 |
46 // Should only print currently selected text. | 88 // Should only print currently selected text. |
47 IPC_STRUCT_MEMBER(bool, selection_only) | 89 IPC_STRUCT_TRAITS_MEMBER(selection_only) |
48 | 90 |
49 // Does the printer support alpha blending? | 91 // Does the printer support alpha blending? |
50 IPC_STRUCT_MEMBER(bool, supports_alpha_blend) | 92 IPC_STRUCT_TRAITS_MEMBER(supports_alpha_blend) |
51 | 93 |
52 // The id of the preview request, used only for print preview. | 94 // *** Parameters below are used only for print preview. *** |
53 IPC_STRUCT_MEMBER(int, preview_request_id) | |
54 | 95 |
55 // True if this is the first preview request, used only for print preview. | 96 // The print preview ui associated with this request. |
56 IPC_STRUCT_MEMBER(bool, is_first_request) | 97 IPC_STRUCT_TRAITS_MEMBER(preview_ui_addr) |
57 IPC_STRUCT_END() | 98 |
| 99 // The id of the preview request. |
| 100 IPC_STRUCT_TRAITS_MEMBER(preview_request_id) |
| 101 |
| 102 // True if this is the first preview request. |
| 103 IPC_STRUCT_TRAITS_MEMBER(is_first_request) |
| 104 IPC_STRUCT_TRAITS_END() |
58 | 105 |
59 IPC_STRUCT_BEGIN(PrintMsg_PrintPage_Params) | 106 IPC_STRUCT_BEGIN(PrintMsg_PrintPage_Params) |
60 // Parameters to render the page as a printed page. It must always be the same | 107 // Parameters to render the page as a printed page. It must always be the same |
61 // value for all the document. | 108 // value for all the document. |
62 IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params) | 109 IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params) |
63 | 110 |
64 // The page number is the indicator of the square that should be rendered | 111 // The page number is the indicator of the square that should be rendered |
65 // according to the layout specified in PrintMsg_Print_Params. | 112 // according to the layout specified in PrintMsg_Print_Params. |
66 IPC_STRUCT_MEMBER(int, page_number) | 113 IPC_STRUCT_MEMBER(int, page_number) |
67 IPC_STRUCT_END() | 114 IPC_STRUCT_END() |
68 | 115 |
69 IPC_STRUCT_BEGIN(PrintMsg_PrintPages_Params) | 116 IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) |
70 // Parameters to render the page as a printed page. It must always be the same | 117 // Parameters to render the page as a printed page. It must always be the same |
71 // value for all the document. | 118 // value for all the document. |
72 IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params) | 119 IPC_STRUCT_TRAITS_MEMBER(params) |
73 | 120 |
74 // If empty, this means a request to render all the printed pages. | 121 // If empty, this means a request to render all the printed pages. |
75 IPC_STRUCT_MEMBER(std::vector<int>, pages) | 122 IPC_STRUCT_TRAITS_MEMBER(pages) |
76 IPC_STRUCT_END() | 123 IPC_STRUCT_TRAITS_END() |
77 | 124 |
78 // Parameters to describe a rendered document. | 125 // Parameters to describe a rendered document. |
79 IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) | 126 IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) |
80 // True when we can reuse existing preview data. |metafile_data_handle| and | 127 // True when we can reuse existing preview data. |metafile_data_handle| and |
81 // |data_size| should not be used when this is true. | 128 // |data_size| should not be used when this is true. |
82 IPC_STRUCT_MEMBER(bool, reuse_existing_data) | 129 IPC_STRUCT_MEMBER(bool, reuse_existing_data) |
83 | 130 |
84 // A shared memory handle to metafile data. | 131 // A shared memory handle to metafile data. |
85 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle) | 132 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle) |
86 | 133 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // called multiple times as the user updates settings. | 248 // called multiple times as the user updates settings. |
202 IPC_MESSAGE_ROUTED1(PrintMsg_PrintPreview, | 249 IPC_MESSAGE_ROUTED1(PrintMsg_PrintPreview, |
203 DictionaryValue /* settings */) | 250 DictionaryValue /* settings */) |
204 | 251 |
205 // Like PrintMsg_PrintPages, but using the print preview document's frame/node. | 252 // Like PrintMsg_PrintPages, but using the print preview document's frame/node. |
206 IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog) | 253 IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog) |
207 | 254 |
208 // Tells a renderer to stop blocking script initiated printing. | 255 // Tells a renderer to stop blocking script initiated printing. |
209 IPC_MESSAGE_ROUTED0(PrintMsg_ResetScriptedPrintCount) | 256 IPC_MESSAGE_ROUTED0(PrintMsg_ResetScriptedPrintCount) |
210 | 257 |
211 // Tells a renderer to continue generating the print preview. | |
212 // Use |requested_preview_page_index| to request a specific preview page data. | |
213 // |requested_preview_page_index| is 1-based or |printing::INVALID_PAGE_INDEX| | |
214 // to render the next page. | |
215 IPC_MESSAGE_ROUTED1(PrintMsg_ContinuePreview, | |
216 int /* requested_preview_page_index */) | |
217 | |
218 // Tells a renderer to abort the print preview and reset all state. | |
219 IPC_MESSAGE_ROUTED0(PrintMsg_AbortPreview) | |
220 | |
221 // Messages sent from the renderer to the browser. | 258 // Messages sent from the renderer to the browser. |
222 | 259 |
223 #if defined(OS_WIN) | 260 #if defined(OS_WIN) |
224 // Duplicates a shared memory handle from the renderer to the browser. Then | 261 // Duplicates a shared memory handle from the renderer to the browser. Then |
225 // the renderer can flush the handle. | 262 // the renderer can flush the handle. |
226 IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_DuplicateSection, | 263 IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_DuplicateSection, |
227 base::SharedMemoryHandle /* renderer handle */, | 264 base::SharedMemoryHandle /* renderer handle */, |
228 base::SharedMemoryHandle /* browser handle */) | 265 base::SharedMemoryHandle /* browser handle */) |
229 #endif | 266 #endif |
230 | 267 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 IPC_MESSAGE_ROUTED0(PrintHostMsg_RequestPrintPreview) | 318 IPC_MESSAGE_ROUTED0(PrintHostMsg_RequestPrintPreview) |
282 | 319 |
283 // Notify the browser the number of pages in the print preview document. | 320 // Notify the browser the number of pages in the print preview document. |
284 IPC_MESSAGE_ROUTED1(PrintHostMsg_DidGetPreviewPageCount, | 321 IPC_MESSAGE_ROUTED1(PrintHostMsg_DidGetPreviewPageCount, |
285 PrintHostMsg_DidGetPreviewPageCount_Params /* params */) | 322 PrintHostMsg_DidGetPreviewPageCount_Params /* params */) |
286 | 323 |
287 // Notify the browser a print preview page has been rendered. | 324 // Notify the browser a print preview page has been rendered. |
288 IPC_MESSAGE_ROUTED1(PrintHostMsg_DidPreviewPage, | 325 IPC_MESSAGE_ROUTED1(PrintHostMsg_DidPreviewPage, |
289 PrintHostMsg_DidPreviewPage_Params /* params */) | 326 PrintHostMsg_DidPreviewPage_Params /* params */) |
290 | 327 |
| 328 // Asks the browser whether the print preview has been cancelled. |
| 329 IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, |
| 330 std::string /* print preview ui address */, |
| 331 int /* request id */, |
| 332 bool /* print preview cancelled */) |
| 333 |
291 // Sends back to the browser the complete rendered document for print preview | 334 // Sends back to the browser the complete rendered document for print preview |
292 // that was requested by a PrintMsg_PrintPreview message. The memory handle in | 335 // that was requested by a PrintMsg_PrintPreview message. The memory handle in |
293 // this message is already valid in the browser process. | 336 // this message is already valid in the browser process. |
294 IPC_MESSAGE_ROUTED1(PrintHostMsg_PagesReadyForPreview, | 337 IPC_MESSAGE_ROUTED1(PrintHostMsg_PagesReadyForPreview, |
295 PrintHostMsg_DidPreviewDocument_Params /* params */) | 338 PrintHostMsg_DidPreviewDocument_Params /* params */) |
296 | 339 |
297 // Tell the browser printing failed. | 340 // Tell the browser printing failed. |
298 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, | 341 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, |
299 int /* document cookie */) | 342 int /* document cookie */) |
300 | 343 |
301 // Tell the browser print preview failed. | 344 // Tell the browser print preview failed. |
302 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, | 345 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, |
303 int /* document cookie */) | 346 int /* document cookie */) |
| 347 |
| 348 // Tell the browser print preview was cancelled. |
| 349 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewCancelled, |
| 350 int /* document cookie */) |
OLD | NEW |