OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/libgtk2ui/printing_gtk2_util.h" | 5 #include "chrome/browser/ui/libgtk2ui/printing_gtk2_util.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <gtk/gtkunixprint.h> | 8 #include <gtk/gtkunixprint.h> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "printing/print_settings.h" | 12 #include "printing/print_settings.h" |
13 #include "printing/printing_context_linux.h" | 13 #include "printing/printing_context_linux.h" |
14 #include "printing/units.h" | 14 #include "printing/units.h" |
| 15 #include "ui/gfx/geometry/size.h" |
| 16 #include "ui/gfx/geometry/size_f.h" |
15 | 17 |
16 namespace { | 18 namespace { |
17 | 19 |
18 const double kTopMarginInInch = 0.25; | 20 const double kTopMarginInInch = 0.25; |
19 const double kBottomMarginInInch = 0.56; | 21 const double kBottomMarginInInch = 0.56; |
20 const double kLeftMarginInInch = 0.25; | 22 const double kLeftMarginInInch = 0.25; |
21 const double kRightMarginInInch = 0.25; | 23 const double kRightMarginInInch = 0.25; |
22 | 24 |
23 } // namespace | 25 } // namespace |
24 | 26 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Thus this is only useful in print preview mode, where we manually set the | 90 // Thus this is only useful in print preview mode, where we manually set the |
89 // orientation and change the paper size ourselves. | 91 // orientation and change the paper size ourselves. |
90 GtkPageOrientation orientation = gtk_print_settings_get_orientation(settings); | 92 GtkPageOrientation orientation = gtk_print_settings_get_orientation(settings); |
91 // Set before SetPrinterPrintableArea to make it flip area if necessary. | 93 // Set before SetPrinterPrintableArea to make it flip area if necessary. |
92 print_settings->SetOrientation(orientation == GTK_PAGE_ORIENTATION_LANDSCAPE); | 94 print_settings->SetOrientation(orientation == GTK_PAGE_ORIENTATION_LANDSCAPE); |
93 DCHECK_EQ(print_settings->device_units_per_inch(), dpi); | 95 DCHECK_EQ(print_settings->device_units_per_inch(), dpi); |
94 print_settings->SetPrinterPrintableArea(physical_size_device_units, | 96 print_settings->SetPrinterPrintableArea(physical_size_device_units, |
95 printable_area_device_units, | 97 printable_area_device_units, |
96 true); | 98 true); |
97 } | 99 } |
OLD | NEW |