OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/logging.h" | 8 #include "base/logging.h" |
9 #include "printing/print_job_constants.h" | 9 #include "printing/print_job_constants.h" |
10 #include "printing/units.h" | 10 #include "printing/units.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 landscape_ = false; | 133 landscape_ = false; |
134 supports_alpha_blend_ = true; | 134 supports_alpha_blend_ = true; |
135 should_print_backgrounds_ = false; | 135 should_print_backgrounds_ = false; |
136 collate_ = false; | 136 collate_ = false; |
137 color_ = UNKNOWN_COLOR_MODEL; | 137 color_ = UNKNOWN_COLOR_MODEL; |
138 copies_ = 0; | 138 copies_ = 0; |
139 duplex_mode_ = UNKNOWN_DUPLEX_MODE; | 139 duplex_mode_ = UNKNOWN_DUPLEX_MODE; |
140 } | 140 } |
141 | 141 |
142 void PrintSettings::SetPrinterPrintableArea( | 142 void PrintSettings::SetPrinterPrintableArea( |
143 gfx::Size const& physical_size_device_units, | 143 const gfx::Size& physical_size_device_units, |
144 gfx::Rect const& printable_area_device_units, | 144 const gfx::Rect& printable_area_device_units, |
145 int units_per_inch, | |
146 bool landscape_needs_flip) { | 145 bool landscape_needs_flip) { |
| 146 int units_per_inch = device_units_per_inch(); |
147 int header_footer_text_height = 0; | 147 int header_footer_text_height = 0; |
148 if (display_header_footer_) { | 148 if (display_header_footer_) { |
149 // Hard-code text_height = 0.5cm = ~1/5 of inch. | 149 // Hard-code text_height = 0.5cm = ~1/5 of inch. |
150 header_footer_text_height = ConvertUnit(kSettingHeaderFooterInterstice, | 150 header_footer_text_height = ConvertUnit(kSettingHeaderFooterInterstice, |
151 kPointsPerInch, units_per_inch); | 151 kPointsPerInch, units_per_inch); |
152 } | 152 } |
153 | 153 |
154 PageMargins margins; | 154 PageMargins margins; |
155 switch (margin_type_) { | 155 switch (margin_type_) { |
156 case DEFAULT_MARGINS: { | 156 case DEFAULT_MARGINS: { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 225 } |
226 | 226 |
227 void PrintSettings::SetOrientation(bool landscape) { | 227 void PrintSettings::SetOrientation(bool landscape) { |
228 if (landscape_ != landscape) { | 228 if (landscape_ != landscape) { |
229 landscape_ = landscape; | 229 landscape_ = landscape; |
230 page_setup_device_units_.FlipOrientation(); | 230 page_setup_device_units_.FlipOrientation(); |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 } // namespace printing | 234 } // namespace printing |
OLD | NEW |