1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/printing/browser/print_manager_utils.h"
6 #include "components/printing/common/print_messages.h"
7 #include "printing/print_settings.h"
11 void RenderParamsFromPrintSettings(const PrintSettings
& settings
,
12 PrintMsg_Print_Params
* params
) {
13 params
->page_size
= settings
.page_setup_device_units().physical_size();
14 params
->content_size
.SetSize(
15 settings
.page_setup_device_units().content_area().width(),
16 settings
.page_setup_device_units().content_area().height());
17 params
->printable_area
.SetRect(
18 settings
.page_setup_device_units().printable_area().x(),
19 settings
.page_setup_device_units().printable_area().y(),
20 settings
.page_setup_device_units().printable_area().width(),
21 settings
.page_setup_device_units().printable_area().height());
22 params
->margin_top
= settings
.page_setup_device_units().content_area().y();
23 params
->margin_left
= settings
.page_setup_device_units().content_area().x();
24 params
->dpi
= settings
.dpi();
25 // Currently hardcoded at 1.25. See PrintSettings' constructor.
26 params
->min_shrink
= settings
.min_shrink();
27 // Currently hardcoded at 2.0. See PrintSettings' constructor.
28 params
->max_shrink
= settings
.max_shrink();
29 // Currently hardcoded at 72dpi. See PrintSettings' constructor.
30 params
->desired_dpi
= settings
.desired_dpi();
31 // Always use an invalid cookie.
32 params
->document_cookie
= 0;
33 params
->selection_only
= settings
.selection_only();
34 params
->supports_alpha_blend
= settings
.supports_alpha_blend();
35 params
->should_print_backgrounds
= settings
.should_print_backgrounds();
36 params
->display_header_footer
= settings
.display_header_footer();
37 params
->title
= settings
.title();
38 params
->url
= settings
.url();
41 } // namespace printing