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

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

Issue 1544623002: Switch to standard integer types in printing/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « printing/backend/print_backend_win.cc ('k') | printing/backend/printing_info_win.cc » ('j') | 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_PRINTING_INFO_WIN_H_ 5 #ifndef PRINTING_BACKEND_PRINTING_INFO_WIN_H_
6 #define PRINTING_BACKEND_PRINTING_INFO_WIN_H_ 6 #define PRINTING_BACKEND_PRINTING_INFO_WIN_H_
7 7
8 #include <objidl.h> 8 #include <objidl.h>
9 #include <stdint.h>
9 #include <winspool.h> 10 #include <winspool.h>
10 11
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "printing/printing_export.h" 13 #include "printing/printing_export.h"
13 14
14 namespace printing { 15 namespace printing {
15 16
16 namespace internal { 17 namespace internal {
17 18
18 PRINTING_EXPORT uint8* GetDriverInfo(HANDLE printer, int level); 19 PRINTING_EXPORT uint8_t* GetDriverInfo(HANDLE printer, int level);
19 PRINTING_EXPORT uint8* GetPrinterInfo(HANDLE printer, int level); 20 PRINTING_EXPORT uint8_t* GetPrinterInfo(HANDLE printer, int level);
20 21
21 // This class is designed to work with PRINTER_INFO_X structures 22 // This class is designed to work with PRINTER_INFO_X structures
22 // and calls GetPrinter internally with correctly allocated buffer. 23 // and calls GetPrinter internally with correctly allocated buffer.
23 template <typename PrinterInfoType, int level> 24 template <typename PrinterInfoType, int level>
24 class PrinterInfo { 25 class PrinterInfo {
25 public: 26 public:
26 bool Init(HANDLE printer) { 27 bool Init(HANDLE printer) {
27 buffer_.reset(GetPrinterInfo(printer, level)); 28 buffer_.reset(GetPrinterInfo(printer, level));
28 return buffer_; 29 return buffer_;
29 } 30 }
30 31
31 const PrinterInfoType* get() const { 32 const PrinterInfoType* get() const {
32 return reinterpret_cast<const PrinterInfoType*>(buffer_.get()); 33 return reinterpret_cast<const PrinterInfoType*>(buffer_.get());
33 } 34 }
34 35
35 private: 36 private:
36 scoped_ptr<uint8[]> buffer_; 37 scoped_ptr<uint8_t[]> buffer_;
37 }; 38 };
38 39
39 // This class is designed to work with DRIVER_INFO_X structures 40 // This class is designed to work with DRIVER_INFO_X structures
40 // and calls GetDriverInfo internally with correctly allocated buffer. 41 // and calls GetDriverInfo internally with correctly allocated buffer.
41 template <typename DriverInfoType, int level> 42 template <typename DriverInfoType, int level>
42 class DriverInfo { 43 class DriverInfo {
43 public: 44 public:
44 bool Init(HANDLE printer) { 45 bool Init(HANDLE printer) {
45 buffer_.reset(GetDriverInfo(printer, level)); 46 buffer_.reset(GetDriverInfo(printer, level));
46 return buffer_; 47 return buffer_;
47 } 48 }
48 49
49 const DriverInfoType* get() const { 50 const DriverInfoType* get() const {
50 return reinterpret_cast<const DriverInfoType*>(buffer_.get()); 51 return reinterpret_cast<const DriverInfoType*>(buffer_.get());
51 } 52 }
52 53
53 private: 54 private:
54 scoped_ptr<uint8[]> buffer_; 55 scoped_ptr<uint8_t[]> buffer_;
55 }; 56 };
56 57
57 } // namespace internal 58 } // namespace internal
58 59
59 typedef internal::PrinterInfo<PRINTER_INFO_2, 2> PrinterInfo2; 60 typedef internal::PrinterInfo<PRINTER_INFO_2, 2> PrinterInfo2;
60 typedef internal::PrinterInfo<PRINTER_INFO_5, 5> PrinterInfo5; 61 typedef internal::PrinterInfo<PRINTER_INFO_5, 5> PrinterInfo5;
61 62
62 typedef internal::DriverInfo<DRIVER_INFO_6, 6> DriverInfo6; 63 typedef internal::DriverInfo<DRIVER_INFO_6, 6> DriverInfo6;
63 64
64 } // namespace printing 65 } // namespace printing
65 66
66 #endif // PRINTING_BACKEND_PRINTING_INFO_WIN_H_ 67 #endif // PRINTING_BACKEND_PRINTING_INFO_WIN_H_
OLDNEW
« no previous file with comments | « printing/backend/print_backend_win.cc ('k') | printing/backend/printing_info_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698