diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-04 23:37:47 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-04 23:37:47 +0000 |
commit | 19f09a635b8972b4831ba92d228c45e6438d6553 (patch) | |
tree | bd823fd8ec0d55d727d2a0bf4ae8c25ad20a69df /printing/printing_context_win.cc | |
parent | 92c01741c76c821f2fc9434827dfd9455a971a30 (diff) | |
download | chromium_src-19f09a635b8972b4831ba92d228c45e6438d6553.zip chromium_src-19f09a635b8972b4831ba92d228c45e6438d6553.tar.gz chromium_src-19f09a635b8972b4831ba92d228c45e6438d6553.tar.bz2 |
Cleanup: Make the PrintingContext::UpdatePrintSettings code more consistent across platfroms.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6932021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/printing_context_win.cc')
-rw-r--r-- | printing/printing_context_win.cc | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc index 7a64df6..eb7cc32 100644 --- a/printing/printing_context_win.cc +++ b/printing/printing_context_win.cc @@ -6,6 +6,8 @@ #include <winspool.h> +#include <algorithm> + #include "base/i18n/file_util_icu.h" #include "base/i18n/time_formatting.h" #include "base/message_loop.h" @@ -305,22 +307,27 @@ PrintingContext::Result PrintingContextWin::UpdatePrintSettings( const PageRanges& ranges) { DCHECK(!in_print_job_); - bool is_landscape, is_collate, is_color, is_printToPDF; + bool collate; + bool color; + bool landscape; + bool print_to_pdf; + int copies; + int duplex_mode; string16 printer_name; - int copies, duplex_mode; - if (!job_settings.GetBoolean(kSettingLandscape, &is_landscape) || - !job_settings.GetString(kSettingPrinterName, &printer_name) || - !job_settings.GetInteger(kSettingCopies, &copies) || - !job_settings.GetBoolean(kSettingCollate, &is_collate) || + + 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.GetBoolean(kSettingColor, &is_color) || - !job_settings.GetBoolean(kSettingPrintToPDF, &is_printToPDF)) { + !job_settings.GetInteger(kSettingCopies, &copies) || + !job_settings.GetString(kSettingPrinterName, &printer_name)) { return OnError(); } - if (is_printToPDF) { + if (print_to_pdf) { // Pseudo printer: handle orientation and ranges only. - settings_.SetOrientation(is_landscape); + settings_.SetOrientation(landscape); settings_.ranges = ranges; return OK; } @@ -356,10 +363,10 @@ PrintingContext::Result PrintingContextWin::UpdatePrintSettings( return OnError(); } - dev_mode->dmColor = is_color ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME; + dev_mode->dmColor = color ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME; dev_mode->dmCopies = std::max(copies, 1); if (dev_mode->dmCopies > 1) // do not change collate unless multiple copies - dev_mode->dmCollate = is_collate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE; + dev_mode->dmCollate = collate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE; switch (duplex_mode) { case LONG_EDGE: dev_mode->dmDuplex = DMDUP_VERTICAL; @@ -371,8 +378,7 @@ PrintingContext::Result PrintingContextWin::UpdatePrintSettings( dev_mode->dmDuplex = DMDUP_SIMPLEX; break; } - dev_mode->dmOrientation = is_landscape ? DMORIENT_LANDSCAPE : - DMORIENT_PORTRAIT; + dev_mode->dmOrientation = landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT; // Update data using DocumentProperties. if (DocumentProperties(NULL, printer, printer_name_wide, dev_mode, dev_mode, |