1a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// found in the LICENSE file.
4a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
5a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// IPC messages for printing.
6a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Multiply-included message file, hence no include guard.
7a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
8a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// TODO(sgurun) copied from chrome/common. Remove after crbug.com/322276
9a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
10a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include <string>
11a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include <vector>
12a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
13a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "base/memory/shared_memory.h"
14a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "base/values.h"
15a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "ipc/ipc_message_macros.h"
16a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "printing/page_size_margins.h"
17a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "printing/print_job_constants.h"
18a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "third_party/WebKit/public/web/WebPrintScalingOption.h"
19116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "ui/gfx/ipc/gfx_param_traits.h"
20a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "ui/gfx/native_widget_types.h"
21a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "ui/gfx/rect.h"
22a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
23a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#ifndef AW_COMMON_PRINT_MESSAGES_H_
24a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#define AW_COMMON_PRINT_MESSAGES_H_
25a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
26a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)struct PrintMsg_Print_Params {
27a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  PrintMsg_Print_Params();
28a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  ~PrintMsg_Print_Params();
29a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
30a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Resets the members of the struct to 0.
31a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void Reset();
32a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
33a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  gfx::Size page_size;
34a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  gfx::Size content_size;
35a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  gfx::Rect printable_area;
36a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  int margin_top;
37a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  int margin_left;
38a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  double dpi;
39a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  double min_shrink;
40a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  double max_shrink;
41a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  int desired_dpi;
42a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  int document_cookie;
43a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool selection_only;
44a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool supports_alpha_blend;
45a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  int32 preview_ui_id;
46a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  int preview_request_id;
47a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool is_first_request;
48a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  blink::WebPrintScalingOption print_scaling_option;
49a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool print_to_pdf;
50a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool display_header_footer;
515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  base::string16 title;
525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  base::string16 url;
53a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool should_print_backgrounds;
54a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)};
55a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
56a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)struct PrintMsg_PrintPages_Params {
57a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  PrintMsg_PrintPages_Params();
58a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  ~PrintMsg_PrintPages_Params();
59a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
60a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Resets the members of the struct to 0.
61a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void Reset();
62a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
63a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  PrintMsg_Print_Params params;
64a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  std::vector<int> pages;
65a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)};
66a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
67a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)struct PrintHostMsg_RequestPrintPreview_Params {
68a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  PrintHostMsg_RequestPrintPreview_Params();
69a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  ~PrintHostMsg_RequestPrintPreview_Params();
70a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool is_modifiable;
71a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool webnode_only;
72a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool has_selection;
73a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  bool selection_only;
74a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)};
75a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
76a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif  // AW_COMMON_PRINT_MESSAGES_H_
77a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
78a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#define IPC_MESSAGE_START PrintMsgStart
79a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
80a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_ENUM_TRAITS(printing::MarginType)
81a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_ENUM_TRAITS(blink::WebPrintScalingOption)
82a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
83a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Parameters for a render request.
84a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params)
85a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Physical size of the page, including non-printable margins,
86a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // in pixels according to dpi.
87a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(page_size)
88a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
89a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // In pixels according to dpi_x and dpi_y.
90a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(content_size)
91a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
92a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Physical printable area of the page in pixels according to dpi.
93a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(printable_area)
94a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
95a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The y-offset of the printable area, in pixels according to dpi.
96a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(margin_top)
97a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
98a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The x-offset of the printable area, in pixels according to dpi.
99a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(margin_left)
100a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
101a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Specifies dots per inch.
102a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(dpi)
103a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
104a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Minimum shrink factor. See PrintSettings::min_shrink for more information.
105a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(min_shrink)
106a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
107a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Maximum shrink factor. See PrintSettings::max_shrink for more information.
108a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(max_shrink)
109a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
110a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Desired apparent dpi on paper.
111a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(desired_dpi)
112a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
113a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Cookie for the document to ensure correctness.
114a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(document_cookie)
115a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
116a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Should only print currently selected text.
117a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(selection_only)
118a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
119a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Does the printer support alpha blending?
120a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(supports_alpha_blend)
121a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
122a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // *** Parameters below are used only for print preview. ***
123a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
124a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The print preview ui associated with this request.
125a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(preview_ui_id)
126a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
127a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The id of the preview request.
128a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(preview_request_id)
129a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
130a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // True if this is the first preview request.
131a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(is_first_request)
132a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
133a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Specifies the page scaling option for preview printing.
134a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(print_scaling_option)
135a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
136a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // True if print to pdf is requested.
137a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(print_to_pdf)
138a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
139a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Specifies if the header and footer should be rendered.
140a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(display_header_footer)
141a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
142a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Title string to be printed as header if requested by the user.
143a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(title)
144a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
145a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // URL string to be printed as footer if requested by the user.
146a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(url)
147a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
148a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // True if print backgrounds is requested by the user.
149a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(should_print_backgrounds)
150a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_TRAITS_END()
151a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
152a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_BEGIN(PrintMsg_PrintPage_Params)
153a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Parameters to render the page as a printed page. It must always be the same
154a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // value for all the document.
155a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(PrintMsg_Print_Params, params)
156a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
157a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The page number is the indicator of the square that should be rendered
158a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // according to the layout specified in PrintMsg_Print_Params.
159a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, page_number)
160a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_END()
161a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
162a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_RequestPrintPreview_Params)
163a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(is_modifiable)
164a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(webnode_only)
165a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(has_selection)
166a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(selection_only)
167a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_TRAITS_END()
168a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
169a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_TRAITS_BEGIN(printing::PageSizeMargins)
170a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(content_width)
171a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(content_height)
172a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(margin_left)
173a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(margin_right)
174a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(margin_top)
175a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(margin_bottom)
176a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_TRAITS_END()
177a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
178a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params)
179a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Parameters to render the page as a printed page. It must always be the same
180a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // value for all the document.
181a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(params)
182a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
183a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // If empty, this means a request to render all the printed pages.
184a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_TRAITS_MEMBER(pages)
185a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_TRAITS_END()
186a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
187a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Parameters to describe a rendered document.
188a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params)
189a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // True when we can reuse existing preview data. |metafile_data_handle| and
190a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // |data_size| should not be used when this is true.
191a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(bool, reuse_existing_data)
192a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
193a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // A shared memory handle to metafile data.
194a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle)
195a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
196a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Size of metafile data.
197a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(uint32, data_size)
198a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
199a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Cookie for the document to ensure correctness.
200a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, document_cookie)
201a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
202a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Store the expected pages count.
203a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, expected_pages_count)
204a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
205a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Whether the preview can be modified.
206a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(bool, modifiable)
207a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
208a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The id of the preview request.
209a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, preview_request_id)
210a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_END()
211a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
212a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Parameters to describe a rendered preview page.
213a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewPage_Params)
214a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // A shared memory handle to metafile data for a draft document of the page.
215a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle)
216a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
217a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Size of metafile data.
218a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(uint32, data_size)
219a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
220a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // |page_number| is zero-based and can be |printing::INVALID_PAGE_INDEX| if it
221a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // is just a check.
222a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, page_number)
223a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
224a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The id of the preview request.
225a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, preview_request_id)
226a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_END()
227a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
228a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Parameters sent along with the page count.
229a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params)
230a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Cookie for the document to ensure correctness.
231a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, document_cookie)
232a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
233a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Total page count.
234a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, page_count)
235a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
236a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Indicates whether the previewed document is modifiable.
237a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(bool, is_modifiable)
238a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
239a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The id of the preview request.
240a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, preview_request_id)
241a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
242a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Indicates whether the existing preview data needs to be cleared or not.
243a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(bool, clear_preview_data)
244a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_END()
245a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
246a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Parameters to describe a rendered page.
247a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintPage_Params)
248a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // A shared memory handle to the EMF data. This data can be quite large so a
249a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // memory map needs to be used.
250a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(base::SharedMemoryHandle, metafile_data_handle)
251a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
252a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Size of the metafile data.
253a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(uint32, data_size)
254a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
255a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Cookie for the document to ensure correctness.
256a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, document_cookie)
257a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
258a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Page number.
259a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, page_number)
260a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
261a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Shrink factor used to render this page.
262a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(double, actual_shrink)
263a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
264a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The size of the page the page author specified.
265a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(gfx::Size, page_size)
266a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
267a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The printable area the page author specified.
268a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(gfx::Rect, content_area)
269a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_END()
270a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
271a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Parameters for the IPC message ViewHostMsg_ScriptedPrint
272a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_BEGIN(PrintHostMsg_ScriptedPrint_Params)
273a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, cookie)
274a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(int, expected_pages_count)
275a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(bool, has_selection)
276a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  IPC_STRUCT_MEMBER(printing::MarginType, margin_type)
277a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_STRUCT_END()
278a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
279a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
280a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Messages sent from the browser to the renderer.
281a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
282a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tells the render view to initiate print preview for the entire document.
283a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintMsg_InitiatePrintPreview, bool /* selection_only */)
284a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
285a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Tells the render frame to initiate printing or print preview for a particular
286a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// node, depending on which mode the render frame is in.
287a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu)
288a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
289a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tells the renderer to print the print preview tab's PDF plugin without
290a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// showing the print dialog. (This is the final step in the print preview
291a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// workflow.)
292a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintMsg_PrintForPrintPreview,
293a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    base::DictionaryValue /* settings */)
294a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
295a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tells the render view to switch the CSS to print media type, renders every
296a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// requested pages and switch back the CSS to display media type.
297a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED0(PrintMsg_PrintPages)
298a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
299a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tells the render view that printing is done so it can clean up.
300a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone,
301a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    bool /* success */)
302a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
303a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tells the render view whether scripted printing is blocked or not.
304a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintMsg_SetScriptedPrintingBlocked,
305a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    bool /* blocked */)
306a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
307a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tells the render view to switch the CSS to print media type, renders every
308a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// requested pages for print preview using the given |settings|. This gets
309a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// called multiple times as the user updates settings.
310a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintMsg_PrintPreview,
311a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    base::DictionaryValue /* settings */)
312a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
313a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Like PrintMsg_PrintPages, but using the print preview document's frame/node.
314a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog)
315a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
316a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tells a renderer to stop blocking script initiated printing.
317a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED0(PrintMsg_ResetScriptedPrintCount)
318a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
319a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Messages sent from the renderer to the browser.
320a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
321a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#if defined(OS_WIN)
322a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Duplicates a shared memory handle from the renderer to the browser. Then
323a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// the renderer can flush the handle.
324a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_DuplicateSection,
325a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           base::SharedMemoryHandle /* renderer handle */,
326a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           base::SharedMemoryHandle /* browser handle */)
327a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif
328a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
329a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Check if printing is enabled.
330a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_SYNC_MESSAGE_ROUTED0_1(PrintHostMsg_IsPrintingEnabled,
331a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           bool /* is_enabled */)
332a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
333a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tells the browser that the renderer is done calculating the number of
334a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// rendered pages according to the specified settings.
335a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED2(PrintHostMsg_DidGetPrintedPagesCount,
336a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    int /* rendered document cookie */,
337a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    int /* number of rendered pages */)
338a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
339a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Sends the document cookie of the current printer query to the browser.
340a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_DidGetDocumentCookie,
341a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    int /* rendered document cookie */)
342a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
343a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tells the browser that the print dialog has been shown.
344a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED0(PrintHostMsg_DidShowPrintDialog)
345a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
346a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Sends back to the browser the rendered "printed page" that was requested by
347a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// a ViewMsg_PrintPage message or from scripted printing. The memory handle in
348a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// this message is already valid in the browser process.
349a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_DidPrintPage,
350a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    PrintHostMsg_DidPrintPage_Params /* page content */)
351a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
352a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// The renderer wants to know the default print settings.
353a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_SYNC_MESSAGE_ROUTED0_1(PrintHostMsg_GetDefaultPrintSettings,
354a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           PrintMsg_Print_Params /* default_settings */)
355a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
356a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// The renderer wants to update the current print settings with new
357a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// |job_settings|.
358a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_UpdatePrintSettings,
359a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           int /* document_cookie */,
360a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           base::DictionaryValue /* job_settings */,
361a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           PrintMsg_PrintPages_Params /* current_settings */)
362a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
363a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// It's the renderer that controls the printing process when it is generated
364a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// by javascript. This step is about showing UI to the user to select the
365a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// final print settings. The output parameter is the same as
366a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// ViewMsg_PrintPages which is executed implicitly.
367a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_ScriptedPrint,
368a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           PrintHostMsg_ScriptedPrint_Params,
369a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           PrintMsg_PrintPages_Params
370a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                               /* settings chosen by the user*/)
371a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
372a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#if defined(OS_ANDROID)
373a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Asks the browser to create a temporary file for the renderer to fill
3741320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// in resulting PdfMetafileSkia in printing.
375a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_SYNC_MESSAGE_ROUTED0_2(PrintHostMsg_AllocateTempFileForPrinting,
376a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           base::FileDescriptor /* temp file fd */,
377a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           int /* fd in browser*/)
378a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_TempFileForPrintingWritten,
379a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    int /* fd in browser */)
380a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif
381a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Asks the browser to do print preview.
382a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_RequestPrintPreview,
383a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    PrintHostMsg_RequestPrintPreview_Params /* params */)
384a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
385a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Notify the browser the number of pages in the print preview document.
386a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_DidGetPreviewPageCount,
387a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    PrintHostMsg_DidGetPreviewPageCount_Params /* params */)
388a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
389a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Notify the browser of the default page layout according to the currently
390a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// selected printer and page size.
391a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// |printable_area_in_points| Specifies the printable area in points.
392a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// |has_custom_page_size_style| is true when the printing frame has a custom
393a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// page size css otherwise false.
394a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED3(PrintHostMsg_DidGetDefaultPageLayout,
395a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    printing::PageSizeMargins /* page layout in points */,
396a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    gfx::Rect /* printable area in points */,
397a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    bool /* has custom page size style */)
398a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
399a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Notify the browser a print preview page has been rendered.
400a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_DidPreviewPage,
401a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    PrintHostMsg_DidPreviewPage_Params /* params */)
402a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
403a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Asks the browser whether the print preview has been cancelled.
404a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel,
405a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           int32 /* PrintPreviewUI ID */,
406a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           int /* request id */,
407a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                           bool /* print preview cancelled */)
408a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
409a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Sends back to the browser the complete rendered document (non-draft mode,
410a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// used for printing) that was requested by a PrintMsg_PrintPreview message.
411a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// The memory handle in this message is already valid in the browser process.
412a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_MetafileReadyForPrinting,
413a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    PrintHostMsg_DidPreviewDocument_Params /* params */)
414a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
415a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tell the browser printing failed.
416a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed,
417a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    int /* document cookie */)
418a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
419a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tell the browser print preview failed.
420a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed,
421a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    int /* document cookie */)
422a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
423a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tell the browser print preview was cancelled.
424a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewCancelled,
425a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    int /* document cookie */)
426a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
427a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tell the browser print preview found the selected printer has invalid
428a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// settings (which typically caused by disconnected network printer or printer
429a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// driver is bogus).
430a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewInvalidPrinterSettings,
431a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    int /* document cookie */)
432a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
433a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Run a nested message loop in the renderer until print preview for
434a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// window.print() finishes.
435a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_SYNC_MESSAGE_ROUTED0_0(PrintHostMsg_SetupScriptedPrintPreview)
436a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
437a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Tell the browser to show the print preview, when the document is sufficiently
438a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// loaded such that the renderer can determine whether it is modifiable or not.
439a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview,
440a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    bool /* is_modifiable */)
441a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
442a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Notify the browser that the PDF in the initiator renderer has disabled print
443a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// scaling option.
444a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)IPC_MESSAGE_ROUTED0(PrintHostMsg_PrintPreviewScalingDisabled)
445