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

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: Minor style fix Created 9 years, 9 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) 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_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/pdf_ps_metafile_cairo.h"
13 #include "printing/print_settings.h" 13 #include "printing/print_settings.h"
14 #include "printing/units.h" 14 #include "printing/units.h"
15 15
16 namespace printing { 16 namespace printing {
17 17
18 // static 18 // static
19 void PrintSettingsInitializerGtk::InitPrintSettings( 19 void PrintSettingsInitializerGtk::InitPrintSettings(
20 GtkPrintSettings* settings, 20 GtkPrintSettings* settings,
21 GtkPageSetup* page_setup, 21 GtkPageSetup* page_setup,
22 const PageRanges& new_ranges, 22 const PageRanges& new_ranges,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Use dummy values if we cannot get valid values. 54 // Use dummy values if we cannot get valid values.
55 // TODO(jhawkins) Remove this hack when the Linux printing refactoring 55 // TODO(jhawkins) Remove this hack when the Linux printing refactoring
56 // finishes. 56 // finishes.
57 dpi = kPixelsPerInch; 57 dpi = kPixelsPerInch;
58 double page_width_in_pixel = 8.5 * dpi; 58 double page_width_in_pixel = 8.5 * dpi;
59 double page_height_in_pixel = 11.0 * dpi; 59 double page_height_in_pixel = 11.0 * dpi;
60 physical_size_device_units.SetSize( 60 physical_size_device_units.SetSize(
61 static_cast<int>(page_width_in_pixel), 61 static_cast<int>(page_width_in_pixel),
62 static_cast<int>(page_height_in_pixel)); 62 static_cast<int>(page_height_in_pixel));
63 printable_area_device_units.SetRect( 63 printable_area_device_units.SetRect(
64 static_cast<int>( 64 static_cast<int>(
kmadhusu 2011/03/01 19:42:38 Argument indentation is not correct. Lines 64, 66
dpapad 2011/03/01 22:41:24 Done.
65 NativeMetafile::kLeftMarginInInch * dpi), 65 PdfPsMetafile::kLeftMarginInInch * dpi),
66 static_cast<int>( 66 static_cast<int>(
67 NativeMetafile::kTopMarginInInch * dpi), 67 PdfPsMetafile::kTopMarginInInch * dpi),
68 page_width_in_pixel - 68 page_width_in_pixel -
69 (NativeMetafile::kLeftMarginInInch + 69 (PdfPsMetafile::kLeftMarginInInch +
70 NativeMetafile::kRightMarginInInch) * dpi, 70 PdfPsMetafile::kRightMarginInInch) * dpi,
71 page_height_in_pixel - 71 page_height_in_pixel -
72 (NativeMetafile::kTopMarginInInch + 72 (PdfPsMetafile::kTopMarginInInch +
73 NativeMetafile::kBottomMarginInInch) * dpi); 73 PdfPsMetafile::kBottomMarginInInch) * dpi);
74 } 74 }
75 75
76 print_settings->set_dpi(dpi); 76 print_settings->set_dpi(dpi);
77 print_settings->SetPrinterPrintableArea(physical_size_device_units, 77 print_settings->SetPrinterPrintableArea(physical_size_device_units,
78 printable_area_device_units, 78 printable_area_device_units,
79 dpi); 79 dpi);
80 } 80 }
81 81
82 } // namespace printing 82 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698