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

Unified Diff: printing/printing_context_win.cc

Issue 7817013: PrintPreview: Added code to identify the printer default duplex value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test failures 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 side-by-side diff with in-line comments
Download patch
Index: printing/printing_context_win.cc
diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc
index ef45060ae402db2c39f7549c62cc026efd35b637..13febf4527386570636b16b69eabca1ce996ebd6 100644
--- a/printing/printing_context_win.cc
+++ b/printing/printing_context_win.cc
@@ -312,14 +312,20 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
bool landscape;
bool print_to_pdf;
int copies;
- int duplex_mode;
+ DictionaryValue* duplex_info;
+ int printer_default_duplex_value;
+ int user_selected_duplex_value;
string16 device_name;
if (!job_settings.GetBoolean(kSettingLandscape, &landscape) ||
!job_settings.GetBoolean(kSettingCollate, &collate) ||
!job_settings.GetBoolean(kSettingColor, &color) ||
!job_settings.GetBoolean(kSettingPrintToPDF, &print_to_pdf) ||
- !job_settings.GetInteger(kSettingDuplexMode, &duplex_mode) ||
+ !job_settings.GetDictionary(kSettingDuplexModeInfo, &duplex_info) ||
+ !duplex_info->GetInteger(kPrinterDefaultDuplexValue,
+ &printer_default_duplex_value) ||
+ !duplex_info->GetInteger(kUserSelectedDuplexValue,
+ &user_selected_duplex_value) ||
!job_settings.GetInteger(kSettingCopies, &copies) ||
!job_settings.GetString(kSettingDeviceName, &device_name)) {
return OnError();
@@ -369,16 +375,21 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
dev_mode->dmCopies = std::max(copies, 1);
if (dev_mode->dmCopies > 1) // do not change collate unless multiple copies
dev_mode->dmCollate = collate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE;
- switch (duplex_mode) {
- case LONG_EDGE:
- dev_mode->dmDuplex = DMDUP_VERTICAL;
- break;
- case SHORT_EDGE:
- dev_mode->dmDuplex = DMDUP_HORIZONTAL;
- break;
- default: // simplex
- dev_mode->dmDuplex = DMDUP_SIMPLEX;
- break;
+ if (printer_default_duplex_value == printing::UNKNOWN) {
+ dev_mode->dmDuplex = user_selected_duplex_value ? DMDUP_HORIZONTAL :
vandebo (ex-Chrome) 2011/09/02 18:12:50 This assumes that SIMPLEX is "false." Instead, yo
kmadhusu 2011/09/03 00:34:00 As we discussed, I reverted the printing context c
+ DMDUP_SIMPLEX;
+ } else {
+ switch (user_selected_duplex_value) {
+ case LONG_EDGE:
+ dev_mode->dmDuplex = DMDUP_VERTICAL;
+ break;
+ case SHORT_EDGE:
+ dev_mode->dmDuplex = DMDUP_HORIZONTAL;
+ break;
+ default: // simplex
+ dev_mode->dmDuplex = DMDUP_SIMPLEX;
+ break;
+ }
}
dev_mode->dmOrientation = landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT;
« chrome/renderer/print_web_view_helper_browsertest.cc ('K') | « printing/printing_context_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698