OLD | NEW |
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 dev_mode->dmCopies = std::max(copies, 1); | 376 dev_mode->dmCopies = std::max(copies, 1); |
377 if (dev_mode->dmCopies > 1) // do not change collate unless multiple copies | 377 if (dev_mode->dmCopies > 1) // do not change collate unless multiple copies |
378 dev_mode->dmCollate = collate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE; | 378 dev_mode->dmCollate = collate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE; |
379 switch (duplex_mode) { | 379 switch (duplex_mode) { |
380 case LONG_EDGE: | 380 case LONG_EDGE: |
381 dev_mode->dmDuplex = DMDUP_VERTICAL; | 381 dev_mode->dmDuplex = DMDUP_VERTICAL; |
382 break; | 382 break; |
383 case SHORT_EDGE: | 383 case SHORT_EDGE: |
384 dev_mode->dmDuplex = DMDUP_HORIZONTAL; | 384 dev_mode->dmDuplex = DMDUP_HORIZONTAL; |
385 break; | 385 break; |
386 case SIMPLEX: | 386 default: // simplex |
387 dev_mode->dmDuplex = DMDUP_SIMPLEX; | 387 dev_mode->dmDuplex = DMDUP_SIMPLEX; |
388 break; | 388 break; |
389 default: // UNKNOWN_DUPLEX_MODE | |
390 break; | |
391 } | 389 } |
392 dev_mode->dmOrientation = landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT; | 390 dev_mode->dmOrientation = landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT; |
393 | 391 |
394 // Update data using DocumentProperties. | 392 // Update data using DocumentProperties. |
395 if (DocumentProperties(NULL, printer, device_name_wide, dev_mode, dev_mode, | 393 if (DocumentProperties(NULL, printer, device_name_wide, dev_mode, dev_mode, |
396 DM_IN_BUFFER | DM_OUT_BUFFER) != IDOK) { | 394 DM_IN_BUFFER | DM_OUT_BUFFER) != IDOK) { |
397 ClosePrinter(printer); | 395 ClosePrinter(printer); |
398 return OnError(); | 396 return OnError(); |
399 } | 397 } |
400 | 398 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 if (buf_size) { | 763 if (buf_size) { |
766 buffer->reset(new uint8[buf_size]); | 764 buffer->reset(new uint8[buf_size]); |
767 memset(buffer->get(), 0, buf_size); | 765 memset(buffer->get(), 0, buf_size); |
768 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 766 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
769 buffer->reset(); | 767 buffer->reset(); |
770 } | 768 } |
771 } | 769 } |
772 } | 770 } |
773 | 771 |
774 } // namespace printing | 772 } // namespace printing |
OLD | NEW |