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 "chrome/service/cloud_print/print_system.h" | 5 #include "chrome/service/cloud_print/print_system.h" |
6 | 6 |
7 #include <objidl.h> | 7 #include <objidl.h> |
8 #include <winspool.h> | 8 #include <winspool.h> |
9 #include <xpsprint.h> | 9 #include <xpsprint.h> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/common/crash_keys.h" | 21 #include "chrome/common/crash_keys.h" |
22 #include "chrome/service/service_process.h" | 22 #include "chrome/service/service_process.h" |
23 #include "chrome/service/service_utility_process_host.h" | 23 #include "chrome/service/service_utility_process_host.h" |
24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
25 #include "printing/backend/print_backend.h" | 25 #include "printing/backend/print_backend.h" |
26 #include "printing/backend/print_backend_consts.h" | 26 #include "printing/backend/print_backend_consts.h" |
27 #include "printing/backend/win_helper.h" | 27 #include "printing/backend/win_helper.h" |
28 #include "printing/emf_win.h" | 28 #include "printing/emf_win.h" |
29 #include "printing/page_range.h" | 29 #include "printing/page_range.h" |
30 #include "printing/pdf_render_settings.h" | 30 #include "printing/pdf_render_settings.h" |
| 31 #include "printing/printing_utils.h" |
31 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
32 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
33 | 34 |
34 #pragma comment(lib, "rpcrt4.lib") // for UuidToString & Co. | 35 #pragma comment(lib, "rpcrt4.lib") // for UuidToString & Co. |
35 | 36 |
36 namespace { | 37 namespace { |
37 | 38 |
38 class PrinterChangeHandleTraits { | 39 class PrinterChangeHandleTraits { |
39 public: | 40 public: |
40 typedef HANDLE Handle; | 41 typedef HANDLE Handle; |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 HDC dc = CreateDC(L"WINSPOOL", UTF8ToWide(printer_name).c_str(), | 425 HDC dc = CreateDC(L"WINSPOOL", UTF8ToWide(printer_name).c_str(), |
425 NULL, pt_dev_mode.dm_); | 426 NULL, pt_dev_mode.dm_); |
426 if (!dc) { | 427 if (!dc) { |
427 NOTREACHED(); | 428 NOTREACHED(); |
428 return false; | 429 return false; |
429 } | 430 } |
430 hr = E_FAIL; | 431 hr = E_FAIL; |
431 DOCINFO di = {0}; | 432 DOCINFO di = {0}; |
432 di.cbSize = sizeof(DOCINFO); | 433 di.cbSize = sizeof(DOCINFO); |
433 string16 doc_name = UTF8ToUTF16(job_title); | 434 string16 doc_name = UTF8ToUTF16(job_title); |
434 DCHECK(printing::PrintBackend::SimplifyDocumentTitle(doc_name) == | 435 DCHECK(printing::SimplifyDocumentTitle(doc_name) == doc_name); |
435 doc_name); | |
436 di.lpszDocName = doc_name.c_str(); | 436 di.lpszDocName = doc_name.c_str(); |
437 job_id_ = StartDoc(dc, &di); | 437 job_id_ = StartDoc(dc, &di); |
438 if (job_id_ <= 0) | 438 if (job_id_ <= 0) |
439 return false; | 439 return false; |
440 | 440 |
441 printer_dc_.Set(dc); | 441 printer_dc_.Set(dc); |
442 saved_dc_ = SaveDC(printer_dc_.Get()); | 442 saved_dc_ = SaveDC(printer_dc_.Get()); |
443 print_data_file_path_ = print_data_file_path; | 443 print_data_file_path_ = print_data_file_path; |
444 delegate_ = delegate; | 444 delegate_ = delegate; |
445 RenderNextPDFPages(); | 445 RenderNextPDFPages(); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 return "application/pdf"; | 897 return "application/pdf"; |
898 } | 898 } |
899 | 899 |
900 | 900 |
901 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( | 901 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( |
902 const base::DictionaryValue* print_system_settings) { | 902 const base::DictionaryValue* print_system_settings) { |
903 return new PrintSystemWin; | 903 return new PrintSystemWin; |
904 } | 904 } |
905 | 905 |
906 } // namespace cloud_print | 906 } // namespace cloud_print |
OLD | NEW |