| 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> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/values.h" | 11 #include "base/values.h" |
| 11 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 12 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
| 13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 14 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 15 | 16 |
| 16 #ifndef CHROME_COMMON_PRINT_MESSAGES_H_ | 17 #ifndef CHROME_COMMON_PRINT_MESSAGES_H_ |
| 17 #define CHROME_COMMON_PRINT_MESSAGES_H_ | 18 #define CHROME_COMMON_PRINT_MESSAGES_H_ |
| 18 | 19 |
| 19 struct PrintMsg_Print_Params { | 20 struct PrintMsg_Print_Params { |
| 20 PrintMsg_Print_Params(); | 21 PrintMsg_Print_Params(); |
| 21 ~PrintMsg_Print_Params(); | 22 ~PrintMsg_Print_Params(); |
| 22 | 23 |
| 23 // Resets the members of the struct to 0. | 24 // Resets the members of the struct to 0. |
| 24 void Reset(); | 25 void Reset(); |
| 25 | 26 |
| 26 gfx::Size page_size; | 27 gfx::Size page_size; |
| 27 gfx::Size printable_size; | 28 gfx::Size printable_size; |
| 28 int margin_top; | 29 int margin_top; |
| 29 int margin_left; | 30 int margin_left; |
| 30 double dpi; | 31 double dpi; |
| 31 double min_shrink; | 32 double min_shrink; |
| 32 double max_shrink; | 33 double max_shrink; |
| 33 int desired_dpi; | 34 int desired_dpi; |
| 34 int document_cookie; | 35 int document_cookie; |
| 35 bool selection_only; | 36 bool selection_only; |
| 36 bool supports_alpha_blend; | 37 bool supports_alpha_blend; |
| 38 std::string preview_ui_addr; |
| 37 int preview_request_id; | 39 int preview_request_id; |
| 38 bool is_first_request; | 40 bool is_first_request; |
| 39 bool display_header_footer; | 41 bool display_header_footer; |
| 40 string16 date; | 42 string16 date; |
| 41 string16 title; | 43 string16 title; |
| 42 string16 url; | 44 string16 url; |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 struct PrintMsg_PrintPages_Params { | 47 struct PrintMsg_PrintPages_Params { |
| 46 PrintMsg_PrintPages_Params(); | 48 PrintMsg_PrintPages_Params(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 88 |
| 87 // Cookie for the document to ensure correctness. | 89 // Cookie for the document to ensure correctness. |
| 88 IPC_STRUCT_TRAITS_MEMBER(document_cookie) | 90 IPC_STRUCT_TRAITS_MEMBER(document_cookie) |
| 89 | 91 |
| 90 // Should only print currently selected text. | 92 // Should only print currently selected text. |
| 91 IPC_STRUCT_TRAITS_MEMBER(selection_only) | 93 IPC_STRUCT_TRAITS_MEMBER(selection_only) |
| 92 | 94 |
| 93 // Does the printer support alpha blending? | 95 // Does the printer support alpha blending? |
| 94 IPC_STRUCT_TRAITS_MEMBER(supports_alpha_blend) | 96 IPC_STRUCT_TRAITS_MEMBER(supports_alpha_blend) |
| 95 | 97 |
| 96 // The id of the preview request, used only for print preview. | 98 // *** Parameters below are used only for print preview. *** |
| 99 |
| 100 // The print preview ui associated with this request. |
| 101 IPC_STRUCT_TRAITS_MEMBER(preview_ui_addr) |
| 102 |
| 103 // The id of the preview request. |
| 97 IPC_STRUCT_TRAITS_MEMBER(preview_request_id) | 104 IPC_STRUCT_TRAITS_MEMBER(preview_request_id) |
| 98 | 105 |
| 99 // True if this is the first preview request, used only for print preview. | 106 // True if this is the first preview request. |
| 100 IPC_STRUCT_TRAITS_MEMBER(is_first_request) | 107 IPC_STRUCT_TRAITS_MEMBER(is_first_request) |
| 101 | 108 |
| 102 // Specifies if the header and footer should be rendered. | 109 // Specifies if the header and footer should be rendered. |
| 103 IPC_STRUCT_TRAITS_MEMBER(display_header_footer) | 110 IPC_STRUCT_TRAITS_MEMBER(display_header_footer) |
| 104 | 111 |
| 105 // Date string to be printed as header if requested by the user. | 112 // Date string to be printed as header if requested by the user. |
| 106 IPC_STRUCT_TRAITS_MEMBER(date) | 113 IPC_STRUCT_TRAITS_MEMBER(date) |
| 107 | 114 |
| 108 // Title string to be printed as header if requested by the user. | 115 // Title string to be printed as header if requested by the user. |
| 109 IPC_STRUCT_TRAITS_MEMBER(title) | 116 IPC_STRUCT_TRAITS_MEMBER(title) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // called multiple times as the user updates settings. | 264 // called multiple times as the user updates settings. |
| 258 IPC_MESSAGE_ROUTED1(PrintMsg_PrintPreview, | 265 IPC_MESSAGE_ROUTED1(PrintMsg_PrintPreview, |
| 259 DictionaryValue /* settings */) | 266 DictionaryValue /* settings */) |
| 260 | 267 |
| 261 // Like PrintMsg_PrintPages, but using the print preview document's frame/node. | 268 // Like PrintMsg_PrintPages, but using the print preview document's frame/node. |
| 262 IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog) | 269 IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog) |
| 263 | 270 |
| 264 // Tells a renderer to stop blocking script initiated printing. | 271 // Tells a renderer to stop blocking script initiated printing. |
| 265 IPC_MESSAGE_ROUTED0(PrintMsg_ResetScriptedPrintCount) | 272 IPC_MESSAGE_ROUTED0(PrintMsg_ResetScriptedPrintCount) |
| 266 | 273 |
| 267 // Tells a renderer to continue generating the print preview. | |
| 268 // Use |requested_preview_page_index| to request a specific preview page data. | |
| 269 // |requested_preview_page_index| is 1-based or |printing::INVALID_PAGE_INDEX| | |
| 270 // to render the next page. | |
| 271 IPC_MESSAGE_ROUTED1(PrintMsg_ContinuePreview, | |
| 272 int /* requested_preview_page_index */) | |
| 273 | |
| 274 // Tells a renderer to abort the print preview and reset all state. | |
| 275 IPC_MESSAGE_ROUTED0(PrintMsg_AbortPreview) | |
| 276 | |
| 277 // Messages sent from the renderer to the browser. | 274 // Messages sent from the renderer to the browser. |
| 278 | 275 |
| 279 #if defined(OS_WIN) | 276 #if defined(OS_WIN) |
| 280 // Duplicates a shared memory handle from the renderer to the browser. Then | 277 // Duplicates a shared memory handle from the renderer to the browser. Then |
| 281 // the renderer can flush the handle. | 278 // the renderer can flush the handle. |
| 282 IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_DuplicateSection, | 279 IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_DuplicateSection, |
| 283 base::SharedMemoryHandle /* renderer handle */, | 280 base::SharedMemoryHandle /* renderer handle */, |
| 284 base::SharedMemoryHandle /* browser handle */) | 281 base::SharedMemoryHandle /* browser handle */) |
| 285 #endif | 282 #endif |
| 286 | 283 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 IPC_MESSAGE_ROUTED0(PrintHostMsg_RequestPrintPreview) | 334 IPC_MESSAGE_ROUTED0(PrintHostMsg_RequestPrintPreview) |
| 338 | 335 |
| 339 // Notify the browser the number of pages in the print preview document. | 336 // Notify the browser the number of pages in the print preview document. |
| 340 IPC_MESSAGE_ROUTED1(PrintHostMsg_DidGetPreviewPageCount, | 337 IPC_MESSAGE_ROUTED1(PrintHostMsg_DidGetPreviewPageCount, |
| 341 PrintHostMsg_DidGetPreviewPageCount_Params /* params */) | 338 PrintHostMsg_DidGetPreviewPageCount_Params /* params */) |
| 342 | 339 |
| 343 // Notify the browser a print preview page has been rendered. | 340 // Notify the browser a print preview page has been rendered. |
| 344 IPC_MESSAGE_ROUTED1(PrintHostMsg_DidPreviewPage, | 341 IPC_MESSAGE_ROUTED1(PrintHostMsg_DidPreviewPage, |
| 345 PrintHostMsg_DidPreviewPage_Params /* params */) | 342 PrintHostMsg_DidPreviewPage_Params /* params */) |
| 346 | 343 |
| 344 // Asks the browser whether the print preview has been cancelled, |
| 345 // and if not, what page to render next. |
| 346 IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, |
| 347 std::string /* print preview ui address */, |
| 348 int /* request id */, |
| 349 bool /* print preview cancelled */) |
| 350 |
| 347 // Sends back to the browser the complete rendered document for print preview | 351 // Sends back to the browser the complete rendered document for print preview |
| 348 // that was requested by a PrintMsg_PrintPreview message. The memory handle in | 352 // that was requested by a PrintMsg_PrintPreview message. The memory handle in |
| 349 // this message is already valid in the browser process. | 353 // this message is already valid in the browser process. |
| 350 IPC_MESSAGE_ROUTED1(PrintHostMsg_PagesReadyForPreview, | 354 IPC_MESSAGE_ROUTED1(PrintHostMsg_PagesReadyForPreview, |
| 351 PrintHostMsg_DidPreviewDocument_Params /* params */) | 355 PrintHostMsg_DidPreviewDocument_Params /* params */) |
| 352 | 356 |
| 353 // Tell the browser printing failed. | 357 // Tell the browser printing failed. |
| 354 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, | 358 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, |
| 355 int /* document cookie */) | 359 int /* document cookie */) |
| 356 | 360 |
| 357 // Tell the browser print preview failed. | 361 // Tell the browser print preview failed. |
| 358 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, | 362 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, |
| 359 int /* document cookie */) | 363 int /* document cookie */) |
| 364 |
| 365 // Tell the browser print preview was cancelled. |
| 366 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewCancelled, |
| 367 int /* document cookie */) |
| OLD | NEW |