OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 |
11 #include "base/i18n/file_util_icu.h" | 11 #include "base/i18n/file_util_icu.h" |
12 #include "base/i18n/time_formatting.h" | 12 #include "base/i18n/time_formatting.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "base/win/metro.h" | 18 #include "base/win/metro.h" |
| 19 #include "printing/backend/print_backend.h" |
19 #include "printing/backend/win_helper.h" | 20 #include "printing/backend/win_helper.h" |
20 #include "printing/print_job_constants.h" | 21 #include "printing/print_job_constants.h" |
21 #include "printing/print_settings_initializer_win.h" | 22 #include "printing/print_settings_initializer_win.h" |
22 #include "printing/printed_document.h" | 23 #include "printing/printed_document.h" |
23 #include "printing/units.h" | 24 #include "printing/units.h" |
24 #include "skia/ext/platform_device.h" | 25 #include "skia/ext/platform_device.h" |
25 | 26 |
26 using base::Time; | 27 using base::Time; |
27 | 28 |
28 namespace { | 29 namespace { |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 498 |
498 // Set the flag used by the AbortPrintJob dialog procedure. | 499 // Set the flag used by the AbortPrintJob dialog procedure. |
499 abort_printing_ = false; | 500 abort_printing_ = false; |
500 | 501 |
501 in_print_job_ = true; | 502 in_print_job_ = true; |
502 | 503 |
503 // Register the application's AbortProc function with GDI. | 504 // Register the application's AbortProc function with GDI. |
504 if (SP_ERROR == SetAbortProc(context_, &AbortProc)) | 505 if (SP_ERROR == SetAbortProc(context_, &AbortProc)) |
505 return OnError(); | 506 return OnError(); |
506 | 507 |
| 508 DCHECK(PrintBackend::SimplifyDocumentTitle(document_name) == document_name); |
507 DOCINFO di = { sizeof(DOCINFO) }; | 509 DOCINFO di = { sizeof(DOCINFO) }; |
508 const std::wstring& document_name_wide = UTF16ToWide(document_name); | 510 const std::wstring& document_name_wide = UTF16ToWide(document_name); |
509 di.lpszDocName = document_name_wide.c_str(); | 511 di.lpszDocName = document_name_wide.c_str(); |
510 | 512 |
511 // Is there a debug dump directory specified? If so, force to print to a file. | 513 // Is there a debug dump directory specified? If so, force to print to a file. |
512 FilePath debug_dump_path = PrintedDocument::debug_dump_path(); | 514 FilePath debug_dump_path = PrintedDocument::debug_dump_path(); |
513 if (!debug_dump_path.empty()) { | 515 if (!debug_dump_path.empty()) { |
514 // Create a filename. | 516 // Create a filename. |
515 std::wstring filename; | 517 std::wstring filename; |
516 Time now(Time::Now()); | 518 Time now(Time::Now()); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 if (buf_size) { | 820 if (buf_size) { |
819 buffer->reset(new uint8[buf_size]); | 821 buffer->reset(new uint8[buf_size]); |
820 memset(buffer->get(), 0, buf_size); | 822 memset(buffer->get(), 0, buf_size); |
821 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 823 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
822 buffer->reset(); | 824 buffer->reset(); |
823 } | 825 } |
824 } | 826 } |
825 } | 827 } |
826 | 828 |
827 } // namespace printing | 829 } // namespace printing |
OLD | NEW |