Commit 7cf87368 authored by dgn's avatar dgn Committed by Commit bot

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}
parent 155761f5
...@@ -59,7 +59,6 @@ static_library("common") { ...@@ -59,7 +59,6 @@ static_library("common") {
"//components/json_schema", "//components/json_schema",
"//components/metrics", "//components/metrics",
"//components/policy:policy_component_common", "//components/policy:policy_component_common",
"//components/printing/common:printing_common",
"//components/translate/core/common", "//components/translate/core/common",
"//components/variations", "//components/variations",
"//content/public/common", "//content/public/common",
...@@ -144,13 +143,11 @@ static_library("common") { ...@@ -144,13 +143,11 @@ static_library("common") {
} }
# Printing. # Printing.
if (!enable_basic_printing && !enable_print_preview) { if (enable_basic_printing || enable_print_preview) {
sources -= [ deps += [
"print_messages.cc", "//components/printing/common:printing_common",
"print_messages.h", "//printing",
] ]
} else {
deps += [ "//printing" ]
if (enable_print_preview) { if (enable_print_preview) {
# Full printing support. # Full printing support.
sources += rebase_path(gypi_values.chrome_common_service_process_sources, sources += rebase_path(gypi_values.chrome_common_service_process_sources,
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
#include "chrome/common/common_message_generator.h" #include "chrome/common/common_message_generator.h"
#if defined(ENABLE_PRINTING)
// TODO(dgn) remove from here when all the code using these messages is removed
// from /chrome. (crbug.com/311308, crbug.com/450822)
#include "components/printing/common/print_messages.h"
#endif
#if !defined(DISABLE_NACL) #if !defined(DISABLE_NACL)
#include "components/nacl/common/nacl_messages.h" #include "components/nacl/common/nacl_messages.h"
#endif #endif
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "components/printing/common/printing_param_traits_macros.h"
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h" #include "ipc/ipc_platform_file.h"
#include "printing/backend/print_backend.h" #include "printing/backend/print_backend.h"
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#if defined(ENABLE_PRINTING) #if defined(ENABLE_PRINTING)
#include "chrome/common/chrome_utility_printing_messages.h" #include "chrome/common/chrome_utility_printing_messages.h"
#include "components/printing/common/print_messages.h"
#endif #endif
#if defined(ENABLE_SPELLCHECK) #if defined(ENABLE_SPELLCHECK)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
'<(DEPTH)/ui/gfx/gfx.gyp:gfx', '<(DEPTH)/ui/gfx/gfx.gyp:gfx',
], ],
'sources': [ 'sources': [
"printing/common/printing_param_traits_macros.h",
"printing/common/print_messages.cc", "printing/common/print_messages.cc",
"printing/common/print_messages.h", "printing/common/print_messages.h",
], ],
......
...@@ -6,6 +6,7 @@ static_library("printing_common") { ...@@ -6,6 +6,7 @@ static_library("printing_common") {
sources = [ sources = [
"print_messages.cc", "print_messages.cc",
"print_messages.h", "print_messages.h",
"printing_param_traits_macros.h",
] ]
deps = [ deps = [
......
...@@ -12,3 +12,16 @@ per-file *messages*.h=nasko@chromium.org ...@@ -12,3 +12,16 @@ per-file *messages*.h=nasko@chromium.org
per-file *messages*.h=palmer@chromium.org per-file *messages*.h=palmer@chromium.org
per-file *messages*.h=tsepez@chromium.org per-file *messages*.h=tsepez@chromium.org
per-file *messages*.h=wfh@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
...@@ -2,12 +2,39 @@ ...@@ -2,12 +2,39 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/printing/common/print_messages.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "ui/gfx/geometry/size.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() PrintMsg_Print_Params::PrintMsg_Print_Params()
: page_size(), : page_size(),
content_size(), content_size(),
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/memory/shared_memory.h" #include "base/memory/shared_memory.h"
#include "base/values.h" #include "base/values.h"
#include "components/printing/common/printing_param_traits_macros.h"
#include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_macros.h"
#include "printing/page_range.h" #include "printing/page_range.h"
#include "printing/page_size_margins.h" #include "printing/page_size_margins.h"
...@@ -19,6 +20,9 @@ ...@@ -19,6 +20,9 @@
#include "ui/gfx/ipc/gfx_param_traits.h" #include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/native_widget_types.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_ #ifndef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#define COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_ #define COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
...@@ -86,13 +90,8 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { ...@@ -86,13 +90,8 @@ struct PrintHostMsg_SetOptionsFromDocument_Params {
#define IPC_MESSAGE_START PrintMsgStart #define IPC_MESSAGE_START PrintMsgStart
IPC_ENUM_TRAITS_MAX_VALUE(printing::MarginType,
printing::MARGIN_TYPE_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebPrintScalingOption, IPC_ENUM_TRAITS_MAX_VALUE(blink::WebPrintScalingOption,
blink::WebPrintScalingOptionLast) blink::WebPrintScalingOptionLast)
IPC_ENUM_TRAITS_MIN_MAX_VALUE(printing::DuplexMode,
printing::UNKNOWN_DUPLEX_MODE,
printing::SHORT_EDGE)
// Parameters for a render request. // Parameters for a render request.
IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params) IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params)
......
// 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_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment