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

Unified 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: Changes as per Kausalya's comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/print_messages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/print_messages.h
diff --git a/chrome/common/print_messages.h b/chrome/common/print_messages.h
index 8f3d9509fae6b68087dcb29e98eb483e18c25619..beb666549ed7b2522f3332e9e1c8b9db1711f26f 100644
--- a/chrome/common/print_messages.h
+++ b/chrome/common/print_messages.h
@@ -5,68 +5,112 @@
// IPC messages for printing.
// Multiply-included message file, hence no include guard.
+#include <vector>
+
#include "base/values.h"
#include "base/shared_memory.h"
#include "ipc/ipc_message_macros.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
+#ifndef CHROME_COMMON_PRINT_MESSAGES_H_
+#define CHROME_COMMON_PRINT_MESSAGES_H_
+
+struct PrintMsg_Print_Params {
+ PrintMsg_Print_Params();
+ ~PrintMsg_Print_Params();
+
+ // Resets the members of the struct to 0.
+ void Reset();
+
+ gfx::Size page_size;
+ gfx::Size printable_size;
+ int margin_top;
+ int margin_left;
+ double dpi;
+ double min_shrink;
+ double max_shrink;
+ int desired_dpi;
+ int document_cookie;
+ bool selection_only;
+ bool supports_alpha_blend;
+ int preview_request_id;
+ bool is_first_request;
+ bool display_header_footer;
+ string16 date;
+ string16 title;
+ string16 url;
+};
+
+struct PrintMsg_PrintPages_Params {
+ PrintMsg_PrintPages_Params();
+ ~PrintMsg_PrintPages_Params();
+
+ // Resets the members of the struct to 0.
+ void Reset();
+
+ PrintMsg_Print_Params params;
+ std::vector<int> pages;
+};
+
+#endif // CHROME_COMMON_PRINT_MESSAGES_H_
+
#define IPC_MESSAGE_START PrintMsgStart
// Parameters for a render request.
-IPC_STRUCT_BEGIN(PrintMsg_Print_Params)
+IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params)
// Physical size of the page, including non-printable margins,
// in pixels according to dpi.
- IPC_STRUCT_MEMBER(gfx::Size, page_size)
+ IPC_STRUCT_TRAITS_MEMBER(page_size)
// In pixels according to dpi_x and dpi_y.
- IPC_STRUCT_MEMBER(gfx::Size, printable_size)
+ IPC_STRUCT_TRAITS_MEMBER(printable_size)
// The y-offset of the printable area, in pixels according to dpi.
- IPC_STRUCT_MEMBER(int, margin_top)
+ IPC_STRUCT_TRAITS_MEMBER(margin_top)
// The x-offset of the printable area, in pixels according to dpi.
- IPC_STRUCT_MEMBER(int, margin_left)
+ IPC_STRUCT_TRAITS_MEMBER(margin_left)
// Specifies dots per inch.
- IPC_STRUCT_MEMBER(double, dpi)
+ IPC_STRUCT_TRAITS_MEMBER(dpi)
// Minimum shrink factor. See PrintSettings::min_shrink for more information.
- IPC_STRUCT_MEMBER(double, min_shrink)
+ IPC_STRUCT_TRAITS_MEMBER(min_shrink)
// Maximum shrink factor. See PrintSettings::max_shrink for more information.
- IPC_STRUCT_MEMBER(double, max_shrink)
+ IPC_STRUCT_TRAITS_MEMBER(max_shrink)
// Desired apparent dpi on paper.
- IPC_STRUCT_MEMBER(int, desired_dpi)
+ IPC_STRUCT_TRAITS_MEMBER(desired_dpi)
// Cookie for the document to ensure correctness.
- IPC_STRUCT_MEMBER(int, document_cookie)
+ IPC_STRUCT_TRAITS_MEMBER(document_cookie)
// Should only print currently selected text.
- IPC_STRUCT_MEMBER(bool, selection_only)
+ IPC_STRUCT_TRAITS_MEMBER(selection_only)
// Does the printer support alpha blending?
- IPC_STRUCT_MEMBER(bool, supports_alpha_blend)
+ IPC_STRUCT_TRAITS_MEMBER(supports_alpha_blend)
// The id of the preview request, used only for print preview.
- IPC_STRUCT_MEMBER(int, preview_request_id)
+ IPC_STRUCT_TRAITS_MEMBER(preview_request_id)
// True if this is the first preview request, used only for print preview.
- IPC_STRUCT_MEMBER(bool, is_first_request)
+ IPC_STRUCT_TRAITS_MEMBER(is_first_request)
// Specifies if the header and footer should be rendered.
- IPC_STRUCT_MEMBER(bool, display_header_footer)
+ IPC_STRUCT_TRAITS_MEMBER(display_header_footer)
// Date string to be printed as header if requested by the user.
- IPC_STRUCT_MEMBER(string16, date)
+ IPC_STRUCT_TRAITS_MEMBER(date)
// Title string to be printed as header if requested by the user.
- IPC_STRUCT_MEMBER(string16, title)
+ IPC_STRUCT_TRAITS_MEMBER(title)
// URL string to be printed as footer if requested by the user.
- IPC_STRUCT_MEMBER(string16, url)
-IPC_STRUCT_END()
+ IPC_STRUCT_TRAITS_MEMBER(url)
+IPC_STRUCT_TRAITS_END()
IPC_STRUCT_BEGIN(PrintMsg_PrintPage_Params)
// Parameters to render the page as a printed page. It must always be the same
@@ -78,14 +122,14 @@ IPC_STRUCT_BEGIN(PrintMsg_PrintPage_Params)
IPC_STRUCT_MEMBER(int, page_number)
IPC_STRUCT_END()
-IPC_STRUCT_BEGIN(PrintMsg_PrintPages_Params)
+IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params)
// Parameters to render the page as a printed page. It must always be the same
// value for all the document.
- IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params)
+ IPC_STRUCT_TRAITS_MEMBER(params)
// If empty, this means a request to render all the printed pages.
- IPC_STRUCT_MEMBER(std::vector<int>, pages)
-IPC_STRUCT_END()
+ IPC_STRUCT_TRAITS_MEMBER(pages)
+IPC_STRUCT_TRAITS_END()
// Parameters to describe a rendered document.
IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params)
« 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