summaryrefslogtreecommitdiff
path: root/chromium/components/printing/common/print_messages.cc
blob: 2b03a80f4531bbd84cd6d001d41be32f3997f017 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Copyright (c) 2012 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.

#include "base/strings/string16.h"
#include "printing/buildflags/buildflags.h"
#include "ui/gfx/geometry/size.h"

// Generating implementations for all aspects of the IPC message
// handling by setting appropriate IPC macros and including the
// message file, over and over again until all versions have been
// generated.

#define IPC_MESSAGE_IMPL
#undef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#undef COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_MACROS_H_
#include "components/printing/common/print_messages.h"
#ifndef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#error "Failed to include header components/printing/common/print_messages.h"
#endif

// Generate constructors.
#include "ipc/struct_constructor_macros.h"
#undef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#undef COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_MACROS_H_
#include "components/printing/common/print_messages.h"
#ifndef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#error "Failed to include header components/printing/common/print_messages.h"
#endif

// Generate param traits write methods.
#include "ipc/param_traits_write_macros.h"
namespace IPC {
#undef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#undef COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_MACROS_H_
#include "components/printing/common/print_messages.h"
#ifndef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#error "Failed to include header components/printing/common/print_messages.h"
#endif
}  // namespace IPC

// Generate param traits read methods.
#include "ipc/param_traits_read_macros.h"
namespace IPC {
#undef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#undef COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_MACROS_H_
#include "components/printing/common/print_messages.h"
#ifndef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#error "Failed to include header components/printing/common/print_messages.h"
#endif
}  // namespace IPC

// Generate param traits log methods.
#include "ipc/param_traits_log_macros.h"
namespace IPC {
#undef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
// Force multiple inclusion of the param traits file to generate all methods.
#undef COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_MACROS_H_

#include "components/printing/common/print_messages.h"
#ifndef COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#error "Failed to include header components/printing/common/print_messages.h"
#endif
}  // namespace IPC

PrintMsg_Print_Params::PrintMsg_Print_Params()
    : margin_top(0),
      margin_left(0),
      scale_factor(1.0f),
      rasterize_pdf(false),
      document_cookie(0),
      selection_only(false),
      supports_alpha_blend(false),
      preview_ui_id(-1),
      preview_request_id(0),
      is_first_request(false),
      print_scaling_option(blink::kWebPrintScalingOptionSourceSize),
      print_to_pdf(false),
      display_header_footer(false),
      should_print_backgrounds(false),
      printed_doc_type(printing::SkiaDocumentType::PDF),
      prefer_css_page_size(false),
      pages_per_sheet(1) {}

PrintMsg_Print_Params::PrintMsg_Print_Params(
    const PrintMsg_Print_Params& other) = default;

PrintMsg_Print_Params::~PrintMsg_Print_Params() {}

void PrintMsg_Print_Params::Reset() {
  page_size = gfx::Size();
  content_size = gfx::Size();
  printable_area = gfx::Rect();
  margin_top = 0;
  margin_left = 0;
  dpi = gfx::Size();
  scale_factor = 1.0f;
  rasterize_pdf = false;
  document_cookie = 0;
  selection_only = false;
  supports_alpha_blend = false;
  preview_ui_id = -1;
  preview_request_id = 0;
  is_first_request = false;
  print_scaling_option = blink::kWebPrintScalingOptionSourceSize;
  print_to_pdf = false;
  display_header_footer = false;
  title = base::string16();
  url = base::string16();
  header_template = base::string16();
  footer_template = base::string16();
  should_print_backgrounds = false;
  printed_doc_type = printing::SkiaDocumentType::PDF;
  prefer_css_page_size = false;
  pages_per_sheet = 1;
}

PrintMsg_PrintPages_Params::PrintMsg_PrintPages_Params() {}

PrintMsg_PrintPages_Params::PrintMsg_PrintPages_Params(
    const PrintMsg_PrintPages_Params& other) = default;

PrintMsg_PrintPages_Params::~PrintMsg_PrintPages_Params() {}

void PrintMsg_PrintPages_Params::Reset() {
  params.Reset();
  pages = std::vector<int>();
}

#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
PrintHostMsg_RequestPrintPreview_Params::
    PrintHostMsg_RequestPrintPreview_Params()
    : is_from_arc(false),
      is_modifiable(false),
      is_pdf(false),
      webnode_only(false),
      has_selection(false),
      selection_only(false) {}

PrintHostMsg_RequestPrintPreview_Params::
    ~PrintHostMsg_RequestPrintPreview_Params() {}

PrintHostMsg_PreviewIds::PrintHostMsg_PreviewIds()
    : request_id(-1), ui_id(-1) {}

PrintHostMsg_PreviewIds::PrintHostMsg_PreviewIds(int request_id, int ui_id)
    : request_id(request_id), ui_id(ui_id) {}

PrintHostMsg_PreviewIds::~PrintHostMsg_PreviewIds() {}

PrintHostMsg_SetOptionsFromDocument_Params::
    PrintHostMsg_SetOptionsFromDocument_Params()
    : is_scaling_disabled(false),
      copies(0),
      duplex(printing::UNKNOWN_DUPLEX_MODE) {
}

PrintHostMsg_SetOptionsFromDocument_Params::
    ~PrintHostMsg_SetOptionsFromDocument_Params() {
}
#endif  // BUILDFLAG(ENABLE_PRINT_PREVIEW)