OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "printing/print_settings.h" | 5 #include "printing/print_settings.h" |
6 | 6 |
7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "printing/print_job_constants.h" |
8 #include "printing/units.h" | 9 #include "printing/units.h" |
9 | 10 |
10 namespace printing { | 11 namespace printing { |
11 | 12 |
12 // Global SequenceNumber used for generating unique cookie values. | 13 // Global SequenceNumber used for generating unique cookie values. |
13 static base::AtomicSequenceNumber cookie_seq(base::LINKER_INITIALIZED); | 14 static base::AtomicSequenceNumber cookie_seq(base::LINKER_INITIALIZED); |
14 | 15 |
15 PrintSettings::PrintSettings() | 16 PrintSettings::PrintSettings() |
16 : min_shrink(1.25), | 17 : min_shrink(1.25), |
17 max_shrink(2.0), | 18 max_shrink(2.0), |
(...skipping 29 matching lines...) Expand all Loading... |
47 | 48 |
48 void PrintSettings::SetPrinterPrintableArea( | 49 void PrintSettings::SetPrinterPrintableArea( |
49 gfx::Size const& physical_size_device_units, | 50 gfx::Size const& physical_size_device_units, |
50 gfx::Rect const& printable_area_device_units, | 51 gfx::Rect const& printable_area_device_units, |
51 int units_per_inch) { | 52 int units_per_inch) { |
52 | 53 |
53 int header_footer_text_height = 0; | 54 int header_footer_text_height = 0; |
54 int margin_printer_units = 0; | 55 int margin_printer_units = 0; |
55 if (use_overlays) { | 56 if (use_overlays) { |
56 // Hard-code text_height = 0.5cm = ~1/5 of inch. | 57 // Hard-code text_height = 0.5cm = ~1/5 of inch. |
57 header_footer_text_height = ConvertUnit(500, kHundrethsMMPerInch, | 58 header_footer_text_height = ConvertUnit(kSettingHeaderFooterInterstice, |
58 units_per_inch); | 59 kPointsPerInch, units_per_inch); |
59 // Default margins 1.0cm = ~2/5 of an inch. | 60 // Default margins 1.0cm = ~2/5 of an inch. |
60 margin_printer_units = ConvertUnit(1000, kHundrethsMMPerInch, | 61 margin_printer_units = ConvertUnit(1000, kHundrethsMMPerInch, |
61 units_per_inch); | 62 units_per_inch); |
62 } | 63 } |
63 // Start by setting the user configuration | 64 // Start by setting the user configuration |
64 page_setup_device_units_.Init(physical_size_device_units, | 65 page_setup_device_units_.Init(physical_size_device_units, |
65 printable_area_device_units, | 66 printable_area_device_units, |
66 header_footer_text_height); | 67 header_footer_text_height); |
67 | 68 |
68 | 69 |
(...skipping 30 matching lines...) Expand all Loading... |
99 } | 100 } |
100 | 101 |
101 void PrintSettings::SetOrientation(bool landscape) { | 102 void PrintSettings::SetOrientation(bool landscape) { |
102 if (landscape_ != landscape) { | 103 if (landscape_ != landscape) { |
103 landscape_ = landscape; | 104 landscape_ = landscape; |
104 page_setup_device_units_.FlipOrientation(); | 105 page_setup_device_units_.FlipOrientation(); |
105 } | 106 } |
106 } | 107 } |
107 | 108 |
108 } // namespace printing | 109 } // namespace printing |
OLD | NEW |