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