Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: printing/backend/win_helper.cc

Issue 6523040: Added support to the Windows cloud print proxy to print XPS documents directl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixed cleanup code Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: printing/backend/win_helper.cc
===================================================================
--- printing/backend/win_helper.cc (revision 74874)
+++ printing/backend/win_helper.cc (working copy)
@@ -37,6 +37,17 @@
BSTR* error_message);
typedef HRESULT (WINAPI *PTReleaseMemoryProc)(PVOID buffer);
typedef HRESULT (WINAPI *PTCloseProviderProc)(HPTPROVIDER provider);
+typedef HRESULT (WINAPI *StartXpsPrintJobProc)(
+ const LPCWSTR printer_name,
+ const LPCWSTR job_name,
+ const LPCWSTR output_file_name,
+ HANDLE progress_event,
+ HANDLE completion_event,
+ UINT8 *printable_pages_on,
+ UINT32 printable_pages_on_count,
+ IXpsPrintJob **xps_print_job,
+ IXpsPrintJobStream **document_stream,
+ IXpsPrintJobStream **print_ticket_stream);
PTOpenProviderProc g_open_provider_proc = NULL;
PTGetPrintCapabilitiesProc g_get_print_capabilities_proc = NULL;
@@ -45,6 +56,7 @@
PTMergeAndValidatePrintTicketProc g_merge_and_validate_print_ticket_proc = NULL;
PTReleaseMemoryProc g_release_memory_proc = NULL;
PTCloseProviderProc g_close_provider_proc = NULL;
+StartXpsPrintJobProc g_start_xps_print_job_proc = NULL;
}
namespace printing {
@@ -207,4 +219,45 @@
initialized_ = false;
}
+bool XPSPrintModule::Init() {
+ static bool initialized = InitImpl();
Scott Byer 2011/02/17 00:31:02 This isn't thread safe, really. Use LazyInstance i
sanjeevr 2011/02/17 00:53:52 Yes, I know this isn't thread-safe. But it does no
+ return initialized;
+}
+
+bool XPSPrintModule::InitImpl() {
+ HMODULE xpsprint_module = LoadLibrary(L"xpsprint.dll");
+ if (xpsprint_module == NULL)
+ return false;
+ g_start_xps_print_job_proc = reinterpret_cast<StartXpsPrintJobProc>(
+ GetProcAddress(xpsprint_module, "StartXpsPrintJob"));
+ if (!g_start_xps_print_job_proc) {
+ NOTREACHED();
+ return false;
+ }
+ return true;
+}
+
+HRESULT XPSPrintModule::StartXpsPrintJob(
+ const LPCWSTR printer_name,
+ const LPCWSTR job_name,
+ const LPCWSTR output_file_name,
+ HANDLE progress_event,
+ HANDLE completion_event,
+ UINT8 *printable_pages_on,
+ UINT32 printable_pages_on_count,
+ IXpsPrintJob **xps_print_job,
+ IXpsPrintJobStream **document_stream,
+ IXpsPrintJobStream **print_ticket_stream) {
+ return g_start_xps_print_job_proc(printer_name,
+ job_name,
+ output_file_name,
+ progress_event,
+ completion_event,
+ printable_pages_on,
+ printable_pages_on_count,
+ xps_print_job,
+ document_stream,
+ print_ticket_stream);
+}
+
} // namespace printing
« chrome/service/cloud_print/print_system_win.cc ('K') | « printing/backend/win_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698