OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
13 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
14 #include "printing/page_size_margins.h" | 14 #include "printing/page_size_margins.h" |
15 #include "printing/print_job_constants.h" | 15 #include "printing/print_job_constants.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPrintScalingOption
.h" |
16 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
18 | 19 |
19 #ifndef CHROME_COMMON_PRINT_MESSAGES_H_ | 20 #ifndef CHROME_COMMON_PRINT_MESSAGES_H_ |
20 #define CHROME_COMMON_PRINT_MESSAGES_H_ | 21 #define CHROME_COMMON_PRINT_MESSAGES_H_ |
21 | 22 |
22 struct PrintMsg_Print_Params { | 23 struct PrintMsg_Print_Params { |
23 PrintMsg_Print_Params(); | 24 PrintMsg_Print_Params(); |
24 ~PrintMsg_Print_Params(); | 25 ~PrintMsg_Print_Params(); |
25 | 26 |
26 // Resets the members of the struct to 0. | 27 // Resets the members of the struct to 0. |
27 void Reset(); | 28 void Reset(); |
28 | 29 |
29 gfx::Size page_size; | 30 gfx::Size page_size; |
30 gfx::Size content_size; | 31 gfx::Size content_size; |
31 gfx::Rect printable_area; | 32 gfx::Rect printable_area; |
32 int margin_top; | 33 int margin_top; |
33 int margin_left; | 34 int margin_left; |
34 double dpi; | 35 double dpi; |
35 double min_shrink; | 36 double min_shrink; |
36 double max_shrink; | 37 double max_shrink; |
37 int desired_dpi; | 38 int desired_dpi; |
38 int document_cookie; | 39 int document_cookie; |
39 bool selection_only; | 40 bool selection_only; |
40 bool supports_alpha_blend; | 41 bool supports_alpha_blend; |
41 std::string preview_ui_addr; | 42 std::string preview_ui_addr; |
42 int preview_request_id; | 43 int preview_request_id; |
43 bool is_first_request; | 44 bool is_first_request; |
44 bool fit_to_paper_size; | 45 WebKit::WebPrintScalingOption print_scaling_option; |
45 bool print_to_pdf; | 46 bool print_to_pdf; |
46 bool display_header_footer; | 47 bool display_header_footer; |
47 string16 date; | 48 string16 date; |
48 string16 title; | 49 string16 title; |
49 string16 url; | 50 string16 url; |
50 }; | 51 }; |
51 | 52 |
52 struct PrintMsg_PrintPages_Params { | 53 struct PrintMsg_PrintPages_Params { |
53 PrintMsg_PrintPages_Params(); | 54 PrintMsg_PrintPages_Params(); |
54 ~PrintMsg_PrintPages_Params(); | 55 ~PrintMsg_PrintPages_Params(); |
55 | 56 |
56 // Resets the members of the struct to 0. | 57 // Resets the members of the struct to 0. |
57 void Reset(); | 58 void Reset(); |
58 | 59 |
59 PrintMsg_Print_Params params; | 60 PrintMsg_Print_Params params; |
60 std::vector<int> pages; | 61 std::vector<int> pages; |
61 }; | 62 }; |
62 | 63 |
63 #endif // CHROME_COMMON_PRINT_MESSAGES_H_ | 64 #endif // CHROME_COMMON_PRINT_MESSAGES_H_ |
64 | 65 |
65 #define IPC_MESSAGE_START PrintMsgStart | 66 #define IPC_MESSAGE_START PrintMsgStart |
66 | 67 |
67 IPC_ENUM_TRAITS(printing::MarginType) | 68 IPC_ENUM_TRAITS(printing::MarginType) |
| 69 IPC_ENUM_TRAITS(WebKit::WebPrintScalingOption) |
68 | 70 |
69 // Parameters for a render request. | 71 // Parameters for a render request. |
70 IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params) | 72 IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params) |
71 // Physical size of the page, including non-printable margins, | 73 // Physical size of the page, including non-printable margins, |
72 // in pixels according to dpi. | 74 // in pixels according to dpi. |
73 IPC_STRUCT_TRAITS_MEMBER(page_size) | 75 IPC_STRUCT_TRAITS_MEMBER(page_size) |
74 | 76 |
75 // In pixels according to dpi_x and dpi_y. | 77 // In pixels according to dpi_x and dpi_y. |
76 IPC_STRUCT_TRAITS_MEMBER(content_size) | 78 IPC_STRUCT_TRAITS_MEMBER(content_size) |
77 | 79 |
(...skipping 31 matching lines...) Loading... |
109 | 111 |
110 // The print preview ui associated with this request. | 112 // The print preview ui associated with this request. |
111 IPC_STRUCT_TRAITS_MEMBER(preview_ui_addr) | 113 IPC_STRUCT_TRAITS_MEMBER(preview_ui_addr) |
112 | 114 |
113 // The id of the preview request. | 115 // The id of the preview request. |
114 IPC_STRUCT_TRAITS_MEMBER(preview_request_id) | 116 IPC_STRUCT_TRAITS_MEMBER(preview_request_id) |
115 | 117 |
116 // True if this is the first preview request. | 118 // True if this is the first preview request. |
117 IPC_STRUCT_TRAITS_MEMBER(is_first_request) | 119 IPC_STRUCT_TRAITS_MEMBER(is_first_request) |
118 | 120 |
| 121 // Specifies the page scaling option for preview printing. |
| 122 IPC_STRUCT_TRAITS_MEMBER(print_scaling_option) |
| 123 |
119 // True if print to pdf is requested. | 124 // True if print to pdf is requested. |
120 IPC_STRUCT_TRAITS_MEMBER(print_to_pdf) | 125 IPC_STRUCT_TRAITS_MEMBER(print_to_pdf) |
121 | 126 |
122 // Specifies if the header and footer should be rendered. | 127 // Specifies if the header and footer should be rendered. |
123 IPC_STRUCT_TRAITS_MEMBER(display_header_footer) | 128 IPC_STRUCT_TRAITS_MEMBER(display_header_footer) |
124 | 129 |
125 // Date string to be printed as header if requested by the user. | 130 // Date string to be printed as header if requested by the user. |
126 IPC_STRUCT_TRAITS_MEMBER(date) | 131 IPC_STRUCT_TRAITS_MEMBER(date) |
127 | 132 |
128 // Title string to be printed as header if requested by the user. | 133 // Title string to be printed as header if requested by the user. |
(...skipping 284 matching lines...) Loading... |
413 int /* document cookie */) | 418 int /* document cookie */) |
414 | 419 |
415 // Run a nested message loop in the renderer until print preview for | 420 // Run a nested message loop in the renderer until print preview for |
416 // window.print() finishes. | 421 // window.print() finishes. |
417 IPC_SYNC_MESSAGE_ROUTED1_0(PrintHostMsg_ScriptedPrintPreview, | 422 IPC_SYNC_MESSAGE_ROUTED1_0(PrintHostMsg_ScriptedPrintPreview, |
418 bool /* is_modifiable */) | 423 bool /* is_modifiable */) |
419 | 424 |
420 // Notify the browser that the PDF in the initiator renderer has disabled print | 425 // Notify the browser that the PDF in the initiator renderer has disabled print |
421 // scaling option. | 426 // scaling option. |
422 IPC_MESSAGE_ROUTED0(PrintHostMsg_PrintPreviewScalingDisabled) | 427 IPC_MESSAGE_ROUTED0(PrintHostMsg_PrintPreviewScalingDisabled) |
OLD | NEW |