summaryrefslogtreecommitdiffstats
path: root/components/printing/common
diff options
context:
space:
mode:
authordgn <dgn@chromium.org>2015-01-28 09:44:16 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-28 17:45:58 +0000
commit7cf873680f76a1f6190f64e3819b51dd64e31574 (patch)
tree5734324e584c92b865aa9a041c6d92ad81b5cc62 /components/printing/common
parent155761f5775bf744f1600ce7a518767d24853117 (diff)
downloadchromium_src-7cf873680f76a1f6190f64e3819b51dd64e31574.zip
chromium_src-7cf873680f76a1f6190f64e3819b51dd64e31574.tar.gz
chromium_src-7cf873680f76a1f6190f64e3819b51dd64e31574.tar.bz2
Generate the print messages in components/printing
Adds a new file to //printing to hold the enums to be included during the IPC generation. This allows to use them in more than one generator at the time. BUG=311308 Review URL: https://codereview.chromium.org/857053002 Cr-Commit-Position: refs/heads/master@{#313540}
Diffstat (limited to 'components/printing/common')
-rw-r--r--components/printing/common/BUILD.gn1
-rw-r--r--components/printing/common/OWNERS13
-rw-r--r--components/printing/common/print_messages.cc31
-rw-r--r--components/printing/common/print_messages.h9
-rw-r--r--components/printing/common/printing_param_traits_macros.h23
5 files changed, 70 insertions, 7 deletions
diff --git a/components/printing/common/BUILD.gn b/components/printing/common/BUILD.gn
index 3110072..d56e4e2 100644
--- a/components/printing/common/BUILD.gn
+++ b/components/printing/common/BUILD.gn
@@ -6,6 +6,7 @@ static_library("printing_common") {
sources = [
"print_messages.cc",
"print_messages.h",
+ "printing_param_traits_macros.h",
]
deps = [
diff --git a/components/printing/common/OWNERS b/components/printing/common/OWNERS
index cbc9bc9..062fcc6 100644
--- a/components/printing/common/OWNERS
+++ b/components/printing/common/OWNERS
@@ -12,3 +12,16 @@ per-file *messages*.h=nasko@chromium.org
per-file *messages*.h=palmer@chromium.org
per-file *messages*.h=tsepez@chromium.org
per-file *messages*.h=wfh@chromium.org
+
+per-file *_param_traits_macros.h=set noparent
+per-file *_param_traits_macros.h=dcheng@chromium.org
+per-file *_param_traits_macros.h=inferno@chromium.org
+per-file *_param_traits_macros.h=jln@chromium.org
+per-file *_param_traits_macros.h=jorgelo@chromium.org
+per-file *_param_traits_macros.h=jschuh@chromium.org
+per-file *_param_traits_macros.h=kenrb@chromium.org
+per-file *_param_traits_macros.h=mkwst@chromium.org
+per-file *_param_traits_macros.h=nasko@chromium.org
+per-file *_param_traits_macros.h=palmer@chromium.org
+per-file *_param_traits_macros.h=tsepez@chromium.org
+per-file *_param_traits_macros.h=wfh@chromium.org
diff --git a/components/printing/common/print_messages.cc b/components/printing/common/print_messages.cc
index 3a5cddd..8853502 100644
--- a/components/printing/common/print_messages.cc
+++ b/components/printing/common/print_messages.cc
@@ -2,12 +2,39 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/printing/common/print_messages.h"
-
#include "base/basictypes.h"
#include "base/strings/string16.h"
#include "ui/gfx/geometry/size.h"
+#define IPC_MESSAGE_IMPL
+#include "components/printing/common/print_messages.h"
+
+// Generate constructors.
+#include "ipc/struct_constructor_macros.h"
+#include "components/printing/common/print_messages.h"
+
+// Generate destructors.
+#include "ipc/struct_destructor_macros.h"
+#include "components/printing/common/print_messages.h"
+
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#include "components/printing/common/print_messages.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
+namespace IPC {
+#include "components/printing/common/print_messages.h"
+} // namespace IPC
+
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#include "components/printing/common/print_messages.h"
+} // namespace IPC
+
PrintMsg_Print_Params::PrintMsg_Print_Params()
: page_size(),
content_size(),
diff --git a/components/printing/common/print_messages.h b/components/printing/common/print_messages.h
index effc2f24..bece6b6 100644
--- a/components/printing/common/print_messages.h
+++ b/components/printing/common/print_messages.h
@@ -10,6 +10,7 @@
#include "base/memory/shared_memory.h"
#include "base/values.h"
+#include "components/printing/common/printing_param_traits_macros.h"
#include "ipc/ipc_message_macros.h"
#include "printing/page_range.h"
#include "printing/page_size_margins.h"
@@ -19,6 +20,9 @@
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/native_widget_types.h"
+// Force multiple inclusion of the param traits file to generate all methods.
+#undef COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_MACROS_H_
+
#ifndef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#define COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
@@ -86,13 +90,8 @@ struct PrintHostMsg_SetOptionsFromDocument_Params {
#define IPC_MESSAGE_START PrintMsgStart
-IPC_ENUM_TRAITS_MAX_VALUE(printing::MarginType,
- printing::MARGIN_TYPE_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebPrintScalingOption,
blink::WebPrintScalingOptionLast)
-IPC_ENUM_TRAITS_MIN_MAX_VALUE(printing::DuplexMode,
- printing::UNKNOWN_DUPLEX_MODE,
- printing::SHORT_EDGE)
// Parameters for a render request.
IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params)
diff --git a/components/printing/common/printing_param_traits_macros.h b/components/printing/common/printing_param_traits_macros.h
new file mode 100644
index 0000000..3ce6d9c
--- /dev/null
+++ b/components/printing/common/printing_param_traits_macros.h
@@ -0,0 +1,23 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Singly or multiply-included shared traits file depending on circumstances.
+// This allows the use of printing IPC serialization macros in more than one IPC
+// message file.
+#ifndef COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_MACROS_H_
+#define COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_MACROS_H_
+
+#include "ipc/ipc_message_macros.h"
+#include "printing/print_job_constants.h"
+
+// TODO(dgn) move all those macros back to
+// components/printing/common/print_messages.h when they can be handled by a
+// single generator. (main tracking bug: crbug.com/450822)
+IPC_ENUM_TRAITS_MAX_VALUE(printing::MarginType,
+ printing::MARGIN_TYPE_LAST)
+IPC_ENUM_TRAITS_MIN_MAX_VALUE(printing::DuplexMode,
+ printing::UNKNOWN_DUPLEX_MODE,
+ printing::SHORT_EDGE)
+
+#endif // COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_MACROS_H_