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

Unified Diff: cloud_print/virtual_driver/win/port_monitor/port_monitor.h

Issue 6778001: Initial CL for a simple port monitor for Windows to be used by the Cloud Print Virtual Print driver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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: cloud_print/virtual_driver/win/port_monitor/port_monitor.h
===================================================================
--- cloud_print/virtual_driver/win/port_monitor/port_monitor.h (revision 0)
+++ cloud_print/virtual_driver/win/port_monitor/port_monitor.h (revision 0)
@@ -0,0 +1,113 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CLOUD_PRINT_VIRTUAL_DRIVER_WIN_PORT_MONITOR_PORT_MONITOR_H_
+#define CLOUD_PRINT_VIRTUAL_DRIVER_WIN_PORT_MONITOR_PORT_MONITOR_H_
+#pragma once
+
+#include <windows.h>
+#include <string>
+#include "base/file_util.h"
+
+namespace cloud_print {
+
+// Fills chrome_path with the path to be used for launching Chrome.
+BOOL GetChromeExePath(std::wstring* chrome_path);
sanjeevr 2011/04/04 17:19:17 Helpers like these do not need to be in the header
Albert Bodenhamer 2011/04/04 23:12:24 GetChromeExePath is referenced from the unit tests
+
+// Attempts to retrieve the title of the specified print job.
+// On success returns TRUE and the first title_chars characters of the job title
+// are copied into title.
+// On failure returns FALSE and title is unmodified.
+BOOL GetJobTitle(HANDLE printer,
+ DWORD job_id,
+ wchar_t* title,
+ size_t title_chars);
+
+// Handler for the UI functions exported by the port monitor.
+// Verifies that a valid parent Window exists and then just displays an
+// error message to let the user know that there is no interactive
+// configuration.
+void HandlePortUi(HWND hwnd, const wchar_t* caption);
+
+// Launches the Cloud Print dialog in Chrome.
+// xps_path references a file to print.
+// job_title is the title to be used for the resulting print job.
+// process_handle is set to the handle of the resulting process.
+BOOL LaunchPrintDialog(const wchar_t* xps_path,
+ const wchar_t* job_title,
+ HANDLE* process_handle);
+
+// Returns false if the print job is being run in a context
+// that shouldn't be launching Chrome.
+bool ValidateCurrentUser();
+
+// Implementations for the function pointers in the MONITOR2 structure
+// returned by InitializePrintMonitor2. The prototypes and behaviors
+// are as described in the MONITOR2 documentation from Microsoft.
+
+BOOL WINAPI Monitor2EnumPorts(HANDLE,
+ wchar_t*,
+ DWORD level,
+ BYTE* ports,
+ DWORD ports_size,
+ DWORD* needed_bytes,
+ DWORD* returned);
+
+BOOL WINAPI Monitor2OpenPort(HANDLE monitor_data, wchar_t*, HANDLE* handle);
+
+BOOL WINAPI Monitor2StartDocPort(HANDLE port_handle,
+ wchar_t* printer_name,
+ DWORD job_id,
+ DWORD,
+ BYTE*);
+
+BOOL WINAPI Monitor2WritePort(HANDLE port,
+ BYTE* buffer,
+ DWORD buffer_size,
+ DWORD* bytes_written);
+
+BOOL WINAPI Monitor2ReadPort(HANDLE, BYTE*, DWORD, DWORD* bytes_read);
+
+BOOL WINAPI Monitor2EndDocPort(HANDLE port_handle);
+
+BOOL WINAPI Monitor2ClosePort(HANDLE port_handle);
+
+VOID WINAPI Monitor2Shutdown(HANDLE monitor_handle);
+
+BOOL WINAPI Monitor2XcvOpenPort(HANDLE monitor,
+ const wchar_t*,
+ ACCESS_MASK granted_access,
+ HANDLE* handle);
+
+DWORD WINAPI Monitor2XcvDataPort(HANDLE xcv_handle,
+ const wchar_t* data_name,
+ BYTE*,
+ DWORD,
+ BYTE* output_data,
+ DWORD output_data_bytes,
+ DWORD* output_data_bytes_needed);
+
+BOOL WINAPI Monitor2XcvClosePort(HANDLE handle);
+
+// Implementations for the function pointers in the MONITORUI structure
+// returned by InitializePrintMonitorUI. The prototypes and behaviors
+// are as described in the MONITORUI documentation from Microsoft.
+
+BOOL WINAPI MonitorUiAddPortUi(const wchar_t*,
+ HWND hwnd,
+ const wchar_t* monitor_name,
+ wchar_t**);
+
+BOOL WINAPI MonitorUiConfigureOrDeletePortUI(const wchar_t*,
+ HWND hwnd,
+ const wchar_t* port_name);
+
+extern const wchar_t kChromeExePath[];
+extern const wchar_t kChromePathRegKey[];
+extern const wchar_t kChromePathRegValue[];
+
+} // namespace cloud_print
+
+#endif // CLOUD_PRINT_VIRTUAL_DRIVER_WIN_PORT_MONITOR_PORT_MONITOR_H_
+
Property changes on: cloud_print\virtual_driver\win\port_monitor\port_monitor.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698