| 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 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 abort_printing_ = false; | 427 abort_printing_ = false; |
| 428 | 428 |
| 429 in_print_job_ = true; | 429 in_print_job_ = true; |
| 430 | 430 |
| 431 // Register the application's AbortProc function with GDI. | 431 // Register the application's AbortProc function with GDI. |
| 432 if (SP_ERROR == SetAbortProc(context_, &AbortProc)) | 432 if (SP_ERROR == SetAbortProc(context_, &AbortProc)) |
| 433 return OnError(); | 433 return OnError(); |
| 434 | 434 |
| 435 DCHECK(SimplifyDocumentTitle(document_name) == document_name); | 435 DCHECK(SimplifyDocumentTitle(document_name) == document_name); |
| 436 DOCINFO di = { sizeof(DOCINFO) }; | 436 DOCINFO di = { sizeof(DOCINFO) }; |
| 437 const std::wstring& document_name_wide = UTF16ToWide(document_name); | 437 const std::wstring& document_name_wide = base::UTF16ToWide(document_name); |
| 438 di.lpszDocName = document_name_wide.c_str(); | 438 di.lpszDocName = document_name_wide.c_str(); |
| 439 | 439 |
| 440 // Is there a debug dump directory specified? If so, force to print to a file. | 440 // Is there a debug dump directory specified? If so, force to print to a file. |
| 441 base::FilePath debug_dump_path = PrintedDocument::debug_dump_path(); | 441 base::FilePath debug_dump_path = PrintedDocument::debug_dump_path(); |
| 442 if (!debug_dump_path.empty()) { | 442 if (!debug_dump_path.empty()) { |
| 443 // Create a filename. | 443 // Create a filename. |
| 444 std::wstring filename; | 444 std::wstring filename; |
| 445 Time now(Time::Now()); | 445 Time now(Time::Now()); |
| 446 filename = base::TimeFormatShortDateNumeric(now); | 446 filename = base::TimeFormatShortDateNumeric(now); |
| 447 filename += L"_"; | 447 filename += L"_"; |
| 448 filename += base::TimeFormatTimeOfDay(now); | 448 filename += base::TimeFormatTimeOfDay(now); |
| 449 filename += L"_"; | 449 filename += L"_"; |
| 450 filename += UTF16ToWide(document_name); | 450 filename += base::UTF16ToWide(document_name); |
| 451 filename += L"_"; | 451 filename += L"_"; |
| 452 filename += L"buffer.prn"; | 452 filename += L"buffer.prn"; |
| 453 file_util::ReplaceIllegalCharactersInPath(&filename, '_'); | 453 file_util::ReplaceIllegalCharactersInPath(&filename, '_'); |
| 454 debug_dump_path.Append(filename); | 454 debug_dump_path.Append(filename); |
| 455 di.lpszOutput = debug_dump_path.value().c_str(); | 455 di.lpszOutput = debug_dump_path.value().c_str(); |
| 456 } | 456 } |
| 457 | 457 |
| 458 // No message loop running in unit tests. | 458 // No message loop running in unit tests. |
| 459 DCHECK(!base::MessageLoop::current() || | 459 DCHECK(!base::MessageLoop::current() || |
| 460 !base::MessageLoop::current()->NestableTasksAllowed()); | 460 !base::MessageLoop::current()->NestableTasksAllowed()); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 742 |
| 743 if (dialog_options.hDevMode != NULL) | 743 if (dialog_options.hDevMode != NULL) |
| 744 GlobalFree(dialog_options.hDevMode); | 744 GlobalFree(dialog_options.hDevMode); |
| 745 if (dialog_options.hDevNames != NULL) | 745 if (dialog_options.hDevNames != NULL) |
| 746 GlobalFree(dialog_options.hDevNames); | 746 GlobalFree(dialog_options.hDevNames); |
| 747 | 747 |
| 748 return context_ ? OK : FAILED; | 748 return context_ ? OK : FAILED; |
| 749 } | 749 } |
| 750 | 750 |
| 751 } // namespace printing | 751 } // namespace printing |
| OLD | NEW |