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

Unified Diff: cloud_print/virtual_driver/win/virtual_driver_helpers.cc

Issue 2541123003: Resurrect the cloud printer driver. (Closed)
Patch Set: Remove cross-compiling option for the portmon dll. Created 4 years 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
« no previous file with comments | « cloud_print/virtual_driver/win/virtual_driver_helpers.h ('k') | tools/gritsettings/resource_ids » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cloud_print/virtual_driver/win/virtual_driver_helpers.cc
diff --git a/cloud_print/virtual_driver/win/virtual_driver_helpers.cc b/cloud_print/virtual_driver/win/virtual_driver_helpers.cc
new file mode 100644
index 0000000000000000000000000000000000000000..603447cf11285a636d3ae521c61602d14564337b
--- /dev/null
+++ b/cloud_print/virtual_driver/win/virtual_driver_helpers.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2012 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.
+
+#include "cloud_print/virtual_driver/win/virtual_driver_helpers.h"
+
+#include <windows.h>
+#include <winspool.h>
+
+#include "base/files/file_util.h"
+#include "base/logging.h"
+#include "base/strings/string16.h"
+#include "base/win/windows_version.h"
+#include "cloud_print/common/win/cloud_print_utils.h"
+
+namespace cloud_print {
+
+void DisplayWindowsMessage(HWND hwnd,
+ HRESULT hr,
+ const base::string16& caption) {
+ ::MessageBox(hwnd, GetErrorMessage(hr).c_str(), caption.c_str(), MB_OK);
+}
+
+HRESULT GetPrinterDriverDir(base::FilePath* path) {
+ BYTE driver_dir_buffer[MAX_PATH * sizeof(wchar_t)];
+ DWORD needed = 0;
+ if (!GetPrinterDriverDirectory(NULL, NULL, 1, driver_dir_buffer,
+ MAX_PATH * sizeof(wchar_t), &needed)) {
+ // We could try to allocate a larger buffer if needed > MAX_PATH
+ // but that really shouldn't happen.
+ return cloud_print::GetLastHResult();
+ }
+ *path = base::FilePath(reinterpret_cast<wchar_t*>(driver_dir_buffer));
+
+ // The XPS driver is a "Level 3" driver
+ *path = path->Append(L"3");
+ return S_OK;
+}
+}
« no previous file with comments | « cloud_print/virtual_driver/win/virtual_driver_helpers.h ('k') | tools/gritsettings/resource_ids » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698