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

Side by Side Diff: printing/backend/win_helper.h

Issue 1121233003: Replacing VerifierTraits with DummyVerifierTraits for non-kernel handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698