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

Side by Side Diff: printing/print_settings_initializer_gtk.cc

Issue 7348010: Added Header and Footer support using Skia (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Moved elide text to print_settings_initializer Created 9 years, 4 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) 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_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/header_footer_initializer.h"
12 #include "printing/print_settings.h" 13 #include "printing/print_settings.h"
13 #include "printing/units.h" 14 #include "printing/units.h"
14 15
15 namespace printing { 16 namespace printing {
16 17
17 // static 18 // static
18 void PrintSettingsInitializerGtk::InitPrintSettings( 19 void PrintSettingsInitializerGtk::InitPrintSettings(
19 GtkPrintSettings* settings, 20 GtkPrintSettings* settings,
20 GtkPageSetup* page_setup, 21 GtkPageSetup* page_setup,
21 const PageRanges& new_ranges, 22 const PageRanges& new_ranges,
22 bool print_selection_only, 23 bool print_selection_only,
24 const DictionaryValue& header_footer_info,
23 PrintSettings* print_settings) { 25 PrintSettings* print_settings) {
24 DCHECK(settings); 26 DCHECK(settings);
25 DCHECK(page_setup); 27 DCHECK(page_setup);
26 DCHECK(print_settings); 28 DCHECK(print_settings);
27 29
28 // TODO(jhawkins): |printer_name_| and |device_name_| should be string16. 30 // TODO(jhawkins): |printer_name_| and |device_name_| should be string16.
29 base::StringPiece name( 31 base::StringPiece name(
30 reinterpret_cast<const char*>(gtk_print_settings_get_printer(settings))); 32 reinterpret_cast<const char*>(gtk_print_settings_get_printer(settings)));
31 print_settings->set_printer_name(UTF8ToWide(name)); 33 print_settings->set_printer_name(UTF8ToWide(name));
32 print_settings->set_device_name(print_settings->printer_name()); 34 print_settings->set_device_name(print_settings->printer_name());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 70
69 // Note: With the normal GTK print dialog, when the user selects the landscape 71 // Note: With the normal GTK print dialog, when the user selects the landscape
70 // orientation, all that does is change the paper size. Which seems to be 72 // orientation, all that does is change the paper size. Which seems to be
71 // enough to render the right output and send it to the printer. 73 // enough to render the right output and send it to the printer.
72 // The orientation value stays as portrait and does not actually affect 74 // The orientation value stays as portrait and does not actually affect
73 // printing. 75 // printing.
74 // Thus this is only useful in print preview mode, where we manually set the 76 // Thus this is only useful in print preview mode, where we manually set the
75 // orientation and change the paper size ourselves. 77 // orientation and change the paper size ourselves.
76 GtkPageOrientation orientation = gtk_print_settings_get_orientation(settings); 78 GtkPageOrientation orientation = gtk_print_settings_get_orientation(settings);
77 print_settings->SetOrientation(orientation == GTK_PAGE_ORIENTATION_LANDSCAPE); 79 print_settings->SetOrientation(orientation == GTK_PAGE_ORIENTATION_LANDSCAPE);
80 printing::HeaderFooterInitializer::InitHeaderFooterStrings(
81 header_footer_info, print_settings);
78 } 82 }
79 83
80 const double PrintSettingsInitializerGtk::kTopMarginInInch = 0.25; 84 const double PrintSettingsInitializerGtk::kTopMarginInInch = 0.25;
81 const double PrintSettingsInitializerGtk::kBottomMarginInInch = 0.56; 85 const double PrintSettingsInitializerGtk::kBottomMarginInInch = 0.56;
82 const double PrintSettingsInitializerGtk::kLeftMarginInInch = 0.25; 86 const double PrintSettingsInitializerGtk::kLeftMarginInInch = 0.25;
83 const double PrintSettingsInitializerGtk::kRightMarginInInch = 0.25; 87 const double PrintSettingsInitializerGtk::kRightMarginInInch = 0.25;
84 88
85 } // namespace printing 89 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698