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 #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 | 7 |
8 #include <objidl.h> | 8 #include <objidl.h> |
9 #include <prntvpt.h> | 9 #include <prntvpt.h> |
10 #include <winspool.h> | 10 #include <winspool.h> |
(...skipping 26 matching lines...) Expand all Loading... |
37 static HANDLE NullHandle() { | 37 static HANDLE NullHandle() { |
38 return NULL; | 38 return NULL; |
39 } | 39 } |
40 | 40 |
41 private: | 41 private: |
42 DISALLOW_IMPLICIT_CONSTRUCTORS(PrinterHandleTraits); | 42 DISALLOW_IMPLICIT_CONSTRUCTORS(PrinterHandleTraits); |
43 }; | 43 }; |
44 | 44 |
45 class ScopedPrinterHandle | 45 class ScopedPrinterHandle |
46 : public base::win::GenericScopedHandle<PrinterHandleTraits, | 46 : public base::win::GenericScopedHandle<PrinterHandleTraits, |
47 base::win::VerifierTraits> { | 47 base::win::DummyVerifierTraits> { |
48 public: | 48 public: |
49 bool OpenPrinter(const wchar_t* printer) { | 49 bool OpenPrinter(const wchar_t* printer) { |
50 HANDLE temp_handle; | 50 HANDLE temp_handle; |
51 // ::OpenPrinter may return error but assign some value into handle. | 51 // ::OpenPrinter may return error but assign some value into handle. |
52 if (::OpenPrinter(const_cast<LPTSTR>(printer), &temp_handle, NULL)) { | 52 if (::OpenPrinter(const_cast<LPTSTR>(printer), &temp_handle, NULL)) { |
53 Set(temp_handle); | 53 Set(temp_handle); |
54 } | 54 } |
55 return IsValid(); | 55 return IsValid(); |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 typedef base::win::GenericScopedHandle<PrinterHandleTraits, | 59 typedef base::win::GenericScopedHandle<PrinterHandleTraits, |
60 base::win::VerifierTraits> Base; | 60 base::win::DummyVerifierTraits> Base; |
61 }; | 61 }; |
62 | 62 |
63 class PrinterChangeHandleTraits { | 63 class PrinterChangeHandleTraits { |
64 public: | 64 public: |
65 typedef HANDLE Handle; | 65 typedef HANDLE Handle; |
66 | 66 |
67 static bool CloseHandle(HANDLE handle) { | 67 static bool CloseHandle(HANDLE handle) { |
68 ::FindClosePrinterChangeNotification(handle); | 68 ::FindClosePrinterChangeNotification(handle); |
69 return true; | 69 return true; |
70 } | 70 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 PRINTING_EXPORT scoped_ptr<DEVMODE, base::FreeDeleter> PromptDevMode( | 190 PRINTING_EXPORT scoped_ptr<DEVMODE, base::FreeDeleter> PromptDevMode( |
191 HANDLE printer, | 191 HANDLE printer, |
192 const base::string16& printer_name, | 192 const base::string16& printer_name, |
193 DEVMODE* in, | 193 DEVMODE* in, |
194 HWND window, | 194 HWND window, |
195 bool* canceled); | 195 bool* canceled); |
196 | 196 |
197 } // namespace printing | 197 } // namespace printing |
198 | 198 |
199 #endif // PRINTING_BACKEND_WIN_HELPER_H_ | 199 #endif // PRINTING_BACKEND_WIN_HELPER_H_ |
OLD | NEW |