| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef PRINTING_BACKEND_WIN_HELPER_H_ | 5 #ifndef PRINTING_BACKEND_WIN_HELPER_H_ |
| 6 #define PRINTING_BACKEND_WIN_HELPER_H_ | 6 #define PRINTING_BACKEND_WIN_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <objidl.h> | 9 #include <objidl.h> |
| 10 #include <winspool.h> | 10 #include <winspool.h> |
| 11 #include <prntvpt.h> | 11 #include <prntvpt.h> |
| 12 #include <xpsprint.h> |
| 12 | 13 |
| 13 #include "base/string16.h" | 14 #include "base/string16.h" |
| 14 | 15 |
| 15 // These are helper functions for dealing with Windows Printing. | 16 // These are helper functions for dealing with Windows Printing. |
| 16 namespace printing { | 17 namespace printing { |
| 17 | 18 |
| 18 // Wrapper class to wrap the XPS APIs (PTxxx APIs). This is needed because these | 19 // Wrapper class to wrap the XPS APIs (PTxxx APIs). This is needed because these |
| 19 // APIs are not available by default on XP. We could delayload prntvpt.dll but | 20 // APIs are not available by default on XP. We could delayload prntvpt.dll but |
| 20 // this would mean having to add that to every binary that links with | 21 // this would mean having to add that to every binary that links with |
| 21 // printing.lib (which is a LOT of binaries). So choosing the GetProcAddress | 22 // printing.lib (which is a LOT of binaries). So choosing the GetProcAddress |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 public: | 64 public: |
| 64 ScopedXPSInitializer(); | 65 ScopedXPSInitializer(); |
| 65 ~ScopedXPSInitializer(); | 66 ~ScopedXPSInitializer(); |
| 66 | 67 |
| 67 bool initialized() const { return initialized_; } | 68 bool initialized() const { return initialized_; } |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 bool initialized_; | 71 bool initialized_; |
| 71 }; | 72 }; |
| 72 | 73 |
| 74 // Wrapper class to wrap the XPS Print APIs (these are different from the PTxxx |
| 75 // which deal with the XML Print Schema). This is needed because these |
| 76 // APIs are only available on Windows 7 and higher. |
| 77 class XPSPrintModule { |
| 78 public: |
| 79 // All the other methods can ONLY be called after a successful call to Init. |
| 80 // Init can be called many times and by multiple threads. |
| 81 static bool Init(); |
| 82 static HRESULT StartXpsPrintJob( |
| 83 const LPCWSTR printer_name, |
| 84 const LPCWSTR job_name, |
| 85 const LPCWSTR output_file_name, |
| 86 HANDLE progress_event, |
| 87 HANDLE completion_event, |
| 88 UINT8 *printable_pages_on, |
| 89 UINT32 printable_pages_on_count, |
| 90 IXpsPrintJob **xps_print_job, |
| 91 IXpsPrintJobStream **document_stream, |
| 92 IXpsPrintJobStream **print_ticket_stream); |
| 93 private: |
| 94 XPSPrintModule() { } |
| 95 static bool InitImpl(); |
| 96 }; |
| 97 |
| 73 } // namespace printing | 98 } // namespace printing |
| 74 | 99 |
| 75 #endif // PRINTING_BACKEND_WIN_HELPER_H_ | 100 #endif // PRINTING_BACKEND_WIN_HELPER_H_ |
| OLD | NEW |