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

Side by Side Diff: printing/printing_context_win.cc

Issue 7826040: PrintPreview: Fixed RICOH MP C3501 color print job issues. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' 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
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/printing_context_win.h" 5 #include "printing/printing_context_win.h"
6 6
7 #include <winspool.h> 7 #include <winspool.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 ResetSettings(); 301 ResetSettings();
302 return FAILED; 302 return FAILED;
303 } 303 }
304 304
305 PrintingContext::Result PrintingContextWin::UpdatePrinterSettings( 305 PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
306 const DictionaryValue& job_settings, 306 const DictionaryValue& job_settings,
307 const PageRanges& ranges) { 307 const PageRanges& ranges) {
308 DCHECK(!in_print_job_); 308 DCHECK(!in_print_job_);
309 309
310 bool collate; 310 bool collate;
311 bool color; 311 int color;
312 bool landscape; 312 bool landscape;
313 bool print_to_pdf; 313 bool print_to_pdf;
314 int copies; 314 int copies;
315 int duplex_mode; 315 int duplex_mode;
316 string16 device_name; 316 string16 device_name;
317 317
318 if (!job_settings.GetBoolean(kSettingLandscape, &landscape) || 318 if (!job_settings.GetBoolean(kSettingLandscape, &landscape) ||
319 !job_settings.GetBoolean(kSettingCollate, &collate) || 319 !job_settings.GetBoolean(kSettingCollate, &collate) ||
320 !job_settings.GetBoolean(kSettingColor, &color) || 320 !job_settings.GetInteger(kSettingColor, &color) ||
321 !job_settings.GetBoolean(kSettingPrintToPDF, &print_to_pdf) || 321 !job_settings.GetBoolean(kSettingPrintToPDF, &print_to_pdf) ||
322 !job_settings.GetInteger(kSettingDuplexMode, &duplex_mode) || 322 !job_settings.GetInteger(kSettingDuplexMode, &duplex_mode) ||
323 !job_settings.GetInteger(kSettingCopies, &copies) || 323 !job_settings.GetInteger(kSettingCopies, &copies) ||
324 !job_settings.GetString(kSettingDeviceName, &device_name)) { 324 !job_settings.GetString(kSettingDeviceName, &device_name)) {
325 return OnError(); 325 return OnError();
326 } 326 }
327 327
328 bool print_to_cloud = job_settings.HasKey(printing::kSettingCloudPrintId); 328 bool print_to_cloud = job_settings.HasKey(printing::kSettingCloudPrintId);
329 329
330 if (print_to_pdf || print_to_cloud) { 330 if (print_to_pdf || print_to_cloud) {
(...skipping 27 matching lines...) Expand all
358 DM_OUT_BUFFER) == IDOK) { 358 DM_OUT_BUFFER) == IDOK) {
359 dev_mode = reinterpret_cast<PDEVMODE>(buffer.get()); 359 dev_mode = reinterpret_cast<PDEVMODE>(buffer.get());
360 } 360 }
361 } 361 }
362 if (dev_mode == NULL) { 362 if (dev_mode == NULL) {
363 buffer.reset(); 363 buffer.reset();
364 ClosePrinter(printer); 364 ClosePrinter(printer);
365 return OnError(); 365 return OnError();
366 } 366 }
367 367
368 dev_mode->dmColor = color ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME; 368 if (color == printing::GRAY)
369 dev_mode->dmColor = DMCOLOR_MONOCHROME;
370 else
371 dev_mode->dmColor = DMCOLOR_COLOR;
372
369 dev_mode->dmCopies = std::max(copies, 1); 373 dev_mode->dmCopies = std::max(copies, 1);
370 if (dev_mode->dmCopies > 1) // do not change collate unless multiple copies 374 if (dev_mode->dmCopies > 1) // do not change collate unless multiple copies
371 dev_mode->dmCollate = collate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE; 375 dev_mode->dmCollate = collate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE;
372 switch (duplex_mode) { 376 switch (duplex_mode) {
373 case LONG_EDGE: 377 case LONG_EDGE:
374 dev_mode->dmDuplex = DMDUP_VERTICAL; 378 dev_mode->dmDuplex = DMDUP_VERTICAL;
375 break; 379 break;
376 case SHORT_EDGE: 380 case SHORT_EDGE:
377 dev_mode->dmDuplex = DMDUP_HORIZONTAL; 381 dev_mode->dmDuplex = DMDUP_HORIZONTAL;
378 break; 382 break;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 if (buf_size) { 760 if (buf_size) {
757 buffer->reset(new uint8[buf_size]); 761 buffer->reset(new uint8[buf_size]);
758 memset(buffer->get(), 0, buf_size); 762 memset(buffer->get(), 0, buf_size);
759 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { 763 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) {
760 buffer->reset(); 764 buffer->reset();
761 } 765 }
762 } 766 }
763 } 767 }
764 768
765 } // namespace printing 769 } // namespace printing
OLDNEW
« printing/printing_context_mac.mm ('K') | « printing/printing_context_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698