Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: printing/print_settings_initializer_gtk.cc

Issue 6544028: Create a Factory for NativeMetafile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed styling issues (naming, 80cols) Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_initializer_gtk.h" 5 #include "printing/print_settings_initializer_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gtk/gtkprinter.h> 8 #include <gtk/gtkprinter.h>
9 9
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "printing/native_metafile.h" 12 #include "printing/native_metafile.h"
vandebo (ex-Chrome) 2011/02/22 22:18:16 No longer needed.
dpapad 2011/02/23 00:44:39 Done.
13 #include "printing/pdf_ps_metafile_cairo.h"
13 #include "printing/print_settings.h" 14 #include "printing/print_settings.h"
14 #include "printing/units.h" 15 #include "printing/units.h"
15 16
16 namespace printing { 17 namespace printing {
17 18
18 // static 19 // static
19 void PrintSettingsInitializerGtk::InitPrintSettings( 20 void PrintSettingsInitializerGtk::InitPrintSettings(
20 GtkPrintSettings* settings, 21 GtkPrintSettings* settings,
21 GtkPageSetup* page_setup, 22 GtkPageSetup* page_setup,
22 const PageRanges& new_ranges, 23 const PageRanges& new_ranges,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // TODO(jhawkins) Remove this hack when the Linux printing refactoring 56 // TODO(jhawkins) Remove this hack when the Linux printing refactoring
56 // finishes. 57 // finishes.
57 dpi = kPixelsPerInch; 58 dpi = kPixelsPerInch;
58 double page_width_in_pixel = 8.5 * dpi; 59 double page_width_in_pixel = 8.5 * dpi;
59 double page_height_in_pixel = 11.0 * dpi; 60 double page_height_in_pixel = 11.0 * dpi;
60 physical_size_device_units.SetSize( 61 physical_size_device_units.SetSize(
61 static_cast<int>(page_width_in_pixel), 62 static_cast<int>(page_width_in_pixel),
62 static_cast<int>(page_height_in_pixel)); 63 static_cast<int>(page_height_in_pixel));
63 printable_area_device_units.SetRect( 64 printable_area_device_units.SetRect(
64 static_cast<int>( 65 static_cast<int>(
65 NativeMetafile::kLeftMarginInInch * dpi), 66 PdfPsMetafile::kLeftMarginInInch * dpi),
66 static_cast<int>( 67 static_cast<int>(
67 NativeMetafile::kTopMarginInInch * dpi), 68 PdfPsMetafile::kTopMarginInInch * dpi),
68 page_width_in_pixel - 69 page_width_in_pixel -
69 (NativeMetafile::kLeftMarginInInch + 70 (PdfPsMetafile::kLeftMarginInInch +
70 NativeMetafile::kRightMarginInInch) * dpi, 71 PdfPsMetafile::kRightMarginInInch) * dpi,
71 page_height_in_pixel - 72 page_height_in_pixel -
72 (NativeMetafile::kTopMarginInInch + 73 (PdfPsMetafile::kTopMarginInInch +
73 NativeMetafile::kBottomMarginInInch) * dpi); 74 PdfPsMetafile::kBottomMarginInInch) * dpi);
74 } 75 }
75 76
76 print_settings->set_dpi(dpi); 77 print_settings->set_dpi(dpi);
77 print_settings->SetPrinterPrintableArea(physical_size_device_units, 78 print_settings->SetPrinterPrintableArea(physical_size_device_units,
78 printable_area_device_units, 79 printable_area_device_units,
79 dpi); 80 dpi);
80 } 81 }
81 82
82 } // namespace printing 83 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698