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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 HRESULT StreamOnHGlobalToString(IStream* stream, std::string* out) { | 26 HRESULT StreamOnHGlobalToString(IStream* stream, std::string* out) { |
27 DCHECK(stream); | 27 DCHECK(stream); |
28 DCHECK(out); | 28 DCHECK(out); |
29 HGLOBAL hdata = NULL; | 29 HGLOBAL hdata = NULL; |
30 HRESULT hr = GetHGlobalFromStream(stream, &hdata); | 30 HRESULT hr = GetHGlobalFromStream(stream, &hdata); |
31 if (SUCCEEDED(hr)) { | 31 if (SUCCEEDED(hr)) { |
32 DCHECK(hdata); | 32 DCHECK(hdata); |
33 base::win::ScopedHGlobal<char> locked_data(hdata); | 33 base::win::ScopedHGlobal<char*> locked_data(hdata); |
34 out->assign(locked_data.release(), locked_data.Size()); | 34 out->assign(locked_data.release(), locked_data.Size()); |
35 } | 35 } |
36 return hr; | 36 return hr; |
37 } | 37 } |
38 | 38 |
39 template <class T> | 39 template <class T> |
40 void GetDeviceCapabilityArray(const wchar_t* printer, | 40 void GetDeviceCapabilityArray(const wchar_t* printer, |
41 const wchar_t* port, | 41 const wchar_t* port, |
42 WORD id, | 42 WORD id, |
43 std::vector<T>* result) { | 43 std::vector<T>* result) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 ScopedPrinterHandle printer_handle; | 361 ScopedPrinterHandle printer_handle; |
362 return printer_handle.OpenPrinter(base::UTF8ToWide(printer_name).c_str()); | 362 return printer_handle.OpenPrinter(base::UTF8ToWide(printer_name).c_str()); |
363 } | 363 } |
364 | 364 |
365 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( | 365 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( |
366 const base::DictionaryValue* print_backend_settings) { | 366 const base::DictionaryValue* print_backend_settings) { |
367 return new PrintBackendWin; | 367 return new PrintBackendWin; |
368 } | 368 } |
369 | 369 |
370 } // namespace printing | 370 } // namespace printing |
OLD | NEW |