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