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 #include "printing/backend/print_backend.h" | 5 #include "printing/backend/print_backend.h" |
6 | 6 |
7 #include <objidl.h> | 7 #include <objidl.h> |
8 #include <winspool.h> | 8 #include <winspool.h> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 } // namespace | 153 } // namespace |
154 | 154 |
155 class PrintBackendWin : public PrintBackend { | 155 class PrintBackendWin : public PrintBackend { |
156 public: | 156 public: |
157 PrintBackendWin() {} | 157 PrintBackendWin() {} |
158 | 158 |
159 // PrintBackend implementation. | 159 // PrintBackend implementation. |
160 virtual bool EnumeratePrinters(PrinterList* printer_list) override; | 160 bool EnumeratePrinters(PrinterList* printer_list) override; |
161 virtual std::string GetDefaultPrinterName() override; | 161 std::string GetDefaultPrinterName() override; |
162 virtual bool GetPrinterSemanticCapsAndDefaults( | 162 bool GetPrinterSemanticCapsAndDefaults( |
163 const std::string& printer_name, | 163 const std::string& printer_name, |
164 PrinterSemanticCapsAndDefaults* printer_info) override; | 164 PrinterSemanticCapsAndDefaults* printer_info) override; |
165 virtual bool GetPrinterCapsAndDefaults( | 165 bool GetPrinterCapsAndDefaults( |
166 const std::string& printer_name, | 166 const std::string& printer_name, |
167 PrinterCapsAndDefaults* printer_info) override; | 167 PrinterCapsAndDefaults* printer_info) override; |
168 virtual std::string GetPrinterDriverInfo( | 168 std::string GetPrinterDriverInfo( |
169 const std::string& printer_name) override; | 169 const std::string& printer_name) override; |
170 virtual bool IsValidPrinter(const std::string& printer_name) override; | 170 bool IsValidPrinter(const std::string& printer_name) override; |
171 | 171 |
172 protected: | 172 protected: |
173 virtual ~PrintBackendWin() {} | 173 ~PrintBackendWin() override {} |
174 }; | 174 }; |
175 | 175 |
176 bool PrintBackendWin::EnumeratePrinters(PrinterList* printer_list) { | 176 bool PrintBackendWin::EnumeratePrinters(PrinterList* printer_list) { |
177 DCHECK(printer_list); | 177 DCHECK(printer_list); |
178 DWORD bytes_needed = 0; | 178 DWORD bytes_needed = 0; |
179 DWORD count_returned = 0; | 179 DWORD count_returned = 0; |
180 const DWORD kLevel = 4; | 180 const DWORD kLevel = 4; |
181 BOOL ret = EnumPrinters(PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS, NULL, | 181 BOOL ret = EnumPrinters(PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS, NULL, |
182 kLevel, NULL, 0, &bytes_needed, &count_returned); | 182 kLevel, NULL, 0, &bytes_needed, &count_returned); |
183 if (!bytes_needed) | 183 if (!bytes_needed) |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 ScopedPrinterHandle printer_handle; | 360 ScopedPrinterHandle printer_handle; |
361 return printer_handle.OpenPrinter(base::UTF8ToWide(printer_name).c_str()); | 361 return printer_handle.OpenPrinter(base::UTF8ToWide(printer_name).c_str()); |
362 } | 362 } |
363 | 363 |
364 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( | 364 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( |
365 const base::DictionaryValue* print_backend_settings) { | 365 const base::DictionaryValue* print_backend_settings) { |
366 return new PrintBackendWin; | 366 return new PrintBackendWin; |
367 } | 367 } |
368 | 368 |
369 } // namespace printing | 369 } // namespace printing |
OLD | NEW |