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

Side by Side Diff: chrome/browser/printing/print_dialog_gtk.cc

Issue 7859007: Reland 100233 PrintPreview: Added code to identify the printer default duplex value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize cups_duplex_mode in print_dialog_gtk.cc Created 9 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/copies_settings.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/printing/print_dialog_gtk.h" 5 #include "chrome/browser/printing/print_dialog_gtk.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <gtk/gtkpagesetupunixdialog.h> 8 #include <gtk/gtkpagesetupunixdialog.h>
9 #include <gtk/gtkprintjob.h> 9 #include <gtk/gtkprintjob.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 break; 193 break;
194 case printing::CMYK: 194 case printing::CMYK:
195 color_mode = kCMYK; 195 color_mode = kCMYK;
196 break; 196 break;
197 default: 197 default:
198 color_mode = kGrayscale; 198 color_mode = kGrayscale;
199 break; 199 break;
200 } 200 }
201 gtk_print_settings_set(gtk_settings_, kCUPSColorModel, color_mode); 201 gtk_print_settings_set(gtk_settings_, kCUPSColorModel, color_mode);
202 202
203 const char* cups_duplex_mode; 203 if (duplex_mode != printing::UNKNOWN_DUPLEX_MODE) {
204 switch (duplex_mode) { 204 const char* cups_duplex_mode = NULL;
205 case printing::LONG_EDGE: 205 switch (duplex_mode) {
206 cups_duplex_mode = kDuplexNoTumble; 206 case printing::LONG_EDGE:
207 break; 207 cups_duplex_mode = kDuplexNoTumble;
208 case printing::SHORT_EDGE: 208 break;
209 cups_duplex_mode = kDuplexTumble; 209 case printing::SHORT_EDGE:
210 break; 210 cups_duplex_mode = kDuplexTumble;
211 default: 211 break;
212 cups_duplex_mode = kDuplexNone; 212 case printing::SIMPLEX:
213 break; 213 cups_duplex_mode = kDuplexNone;
214 break;
215 default: // UNKNOWN_DUPLEX_MODE
216 NOTREACHED();
217 break;
218 }
219 gtk_print_settings_set(gtk_settings_, kCUPSDuplex, cups_duplex_mode);
214 } 220 }
215 gtk_print_settings_set(gtk_settings_, kCUPSDuplex, cups_duplex_mode);
216 } 221 }
217 222
218 gtk_print_settings_set_orientation( 223 gtk_print_settings_set_orientation(
219 gtk_settings_, 224 gtk_settings_,
220 landscape ? GTK_PAGE_ORIENTATION_LANDSCAPE : 225 landscape ? GTK_PAGE_ORIENTATION_LANDSCAPE :
221 GTK_PAGE_ORIENTATION_PORTRAIT); 226 GTK_PAGE_ORIENTATION_PORTRAIT);
222 227
223 InitPrintSettings(ranges); 228 InitPrintSettings(ranges);
224 return true; 229 return true;
225 } 230 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // Printing finished. Matches AddRef() in PrintDocument(); 399 // Printing finished. Matches AddRef() in PrintDocument();
395 Release(); 400 Release();
396 } 401 }
397 402
398 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges) { 403 void PrintDialogGtk::InitPrintSettings(const PageRanges& page_ranges) {
399 PrintSettings settings; 404 PrintSettings settings;
400 printing::PrintSettingsInitializerGtk::InitPrintSettings( 405 printing::PrintSettingsInitializerGtk::InitPrintSettings(
401 gtk_settings_, page_setup_, page_ranges, false, &settings); 406 gtk_settings_, page_setup_, page_ranges, false, &settings);
402 context_->InitWithSettings(settings); 407 context_->InitWithSettings(settings);
403 } 408 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/copies_settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698