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") {
"//components/json_schema",
"//components/metrics",
"//components/policy:policy_component_common",
"//components/printing/common:printing_common",
"//components/translate/core/common",
"//components/variations",
"//content/public/common",
......@@ -144,13 +143,11 @@ static_library("common") {
}
# Printing.
if (!enable_basic_printing && !enable_print_preview) {
sources -= [
"print_messages.cc",
"print_messages.h",
if (enable_basic_printing || enable_print_preview) {
deps += [
"//components/printing/common:printing_common",
"//printing",
]
} else {
deps += [ "//printing" ]
if (enable_print_preview) {
# Full printing support.
sources += rebase_path(gypi_values.chrome_common_service_process_sources,
......
......@@ -15,6 +15,12 @@
#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)
#include "components/nacl/common/nacl_messages.h"
#endif
......@@ -7,6 +7,7 @@
#include <string>
#include <vector>
#include "components/printing/common/printing_param_traits_macros.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
#include "printing/backend/print_backend.h"
......
......@@ -28,7 +28,6 @@
#if defined(ENABLE_PRINTING)
#include "chrome/common/chrome_utility_printing_messages.h"
#include "components/printing/common/print_messages.h"
#endif
#if defined(ENABLE_SPELLCHECK)
......
......@@ -16,6 +16,7 @@
'<(DEPTH)/ui/gfx/gfx.gyp:gfx',
],
'sources': [
"printing/common/printing_param_traits_macros.h",
"printing/common/print_messages.cc",
"printing/common/print_messages.h",
],
......
......@@ -6,6 +6,7 @@ static_library("printing_common") {
sources = [
"print_messages.cc",
"print_messages.h",
"printing_param_traits_macros.h",
]
deps = [
......
......@@ -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
......@@ -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(),
......
......@@ -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)
......
// 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