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

Side by Side Diff: chrome/common/print_messages.h

Issue 7693017: Removed use of memset with PrintMsg_Print_Params struct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: New snapshot uploaded Created 9 years, 4 months 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
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/print_messages.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 PRINTMSG_PARAMS_H_
kmadhusu 2011/08/22 04:53:46 PRINTMSG_PARAMS_H_ => CHROME_COMMON_PRINT_MESSAGES
Aayush Kumar 2011/08/22 17:17:44 Done.
17 #define PRINTMSG_PARAMS_H_
18 struct PrintMsg_Print_Params {
kmadhusu 2011/08/22 04:53:46 nit: Add a blank line before this.
Aayush Kumar 2011/08/22 17:17:44 Done.
19 PrintMsg_Print_Params();
20 ~PrintMsg_Print_Params();
21
22 // Resets the members of the struct to 0.
23 void Reset();
24
25 gfx::Size page_size;
26 gfx::Size printable_size;
27 int margin_top;
28 int margin_left;
29 double dpi;
30 double min_shrink;
31 double max_shrink;
32 int desired_dpi;
33 int document_cookie;
34 bool selection_only;
35 bool supports_alpha_blend;
36 int preview_request_id;
37 bool is_first_request;
38 bool display_header_footer;
39 string16 date;
40 string16 title;
41 string16 url;
42 };
43
44 struct PrintMsg_PrintPages_Params {
45 PrintMsg_PrintPages_Params();
46 ~PrintMsg_PrintPages_Params();
47
48 // Resets the members of the struct to 0.
49 void Reset();
50
51 PrintMsg_Print_Params params;
52 std::vector<int> pages;
53 };
54 #endif // PRINTMSG_PARAMS_H_
kmadhusu 2011/08/22 04:53:46 nit: Add a blank line before this.
Aayush Kumar 2011/08/22 17:17:44 Done.
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 // The id of the preview request, used only for print preview.
53 IPC_STRUCT_MEMBER(int, preview_request_id) 95 IPC_STRUCT_TRAITS_MEMBER(preview_request_id)
54 96
55 // True if this is the first preview request, used only for print preview. 97 // True if this is the first preview request, used only for print preview.
56 IPC_STRUCT_MEMBER(bool, is_first_request) 98 IPC_STRUCT_TRAITS_MEMBER(is_first_request)
57 99
58 // Specifies if the header and footer should be rendered. 100 // Specifies if the header and footer should be rendered.
59 IPC_STRUCT_MEMBER(bool, display_header_footer) 101 IPC_STRUCT_TRAITS_MEMBER(display_header_footer)
60 102
61 // Date string to be printed as header if requested by the user. 103 // Date string to be printed as header if requested by the user.
62 IPC_STRUCT_MEMBER(string16, date) 104 IPC_STRUCT_TRAITS_MEMBER(date)
63 105
64 // Title string to be printed as header if requested by the user. 106 // Title string to be printed as header if requested by the user.
65 IPC_STRUCT_MEMBER(string16, title) 107 IPC_STRUCT_TRAITS_MEMBER(title)
66 108
67 // URL string to be printed as footer if requested by the user. 109 // URL string to be printed as footer if requested by the user.
68 IPC_STRUCT_MEMBER(string16, url) 110 IPC_STRUCT_TRAITS_MEMBER(url)
69 IPC_STRUCT_END() 111 IPC_STRUCT_TRAITS_END()
70 112
71 IPC_STRUCT_BEGIN(PrintMsg_PrintPage_Params) 113 IPC_STRUCT_BEGIN(PrintMsg_PrintPage_Params)
72 // Parameters to render the page as a printed page. It must always be the same 114 // Parameters to render the page as a printed page. It must always be the same
73 // value for all the document. 115 // value for all the document.
74 IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params) 116 IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params)
75 117
76 // The page number is the indicator of the square that should be rendered 118 // The page number is the indicator of the square that should be rendered
77 // according to the layout specified in PrintMsg_Print_Params. 119 // according to the layout specified in PrintMsg_Print_Params.
78 IPC_STRUCT_MEMBER(int, page_number) 120 IPC_STRUCT_MEMBER(int, page_number)
79 IPC_STRUCT_END() 121 IPC_STRUCT_END()
80 122
81 IPC_STRUCT_BEGIN(PrintMsg_PrintPages_Params) 123 IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params)
82 // Parameters to render the page as a printed page. It must always be the same 124 // Parameters to render the page as a printed page. It must always be the same
83 // value for all the document. 125 // value for all the document.
84 IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params) 126 IPC_STRUCT_TRAITS_MEMBER(params)
85 127
86 // If empty, this means a request to render all the printed pages. 128 // If empty, this means a request to render all the printed pages.
87 IPC_STRUCT_MEMBER(std::vector<int>, pages) 129 IPC_STRUCT_TRAITS_MEMBER(pages)
88 IPC_STRUCT_END() 130 IPC_STRUCT_TRAITS_END()
89 131
90 // Parameters to describe a rendered document. 132 // Parameters to describe a rendered document.
91 IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) 133 IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params)
92 // True when we can reuse existing preview data. |metafile_data_handle| and 134 // True when we can reuse existing preview data. |metafile_data_handle| and
93 // |data_size| should not be used when this is true. 135 // |data_size| should not be used when this is true.
94 IPC_STRUCT_MEMBER(bool, reuse_existing_data) 136 IPC_STRUCT_MEMBER(bool, reuse_existing_data)
95 137
96 // A shared memory handle to metafile data. 138 // A shared memory handle to metafile data.
97 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle) 139 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle)
98 140
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 IPC_MESSAGE_ROUTED1(PrintHostMsg_PagesReadyForPreview, 348 IPC_MESSAGE_ROUTED1(PrintHostMsg_PagesReadyForPreview,
307 PrintHostMsg_DidPreviewDocument_Params /* params */) 349 PrintHostMsg_DidPreviewDocument_Params /* params */)
308 350
309 // Tell the browser printing failed. 351 // Tell the browser printing failed.
310 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, 352 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed,
311 int /* document cookie */) 353 int /* document cookie */)
312 354
313 // Tell the browser print preview failed. 355 // Tell the browser print preview failed.
314 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, 356 IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed,
315 int /* document cookie */) 357 int /* document cookie */)
OLDNEW
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/print_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698