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

Side by Side Diff: printing/backend/print_backend_win.cc

Issue 380553002: Add a unit test that filenames aren't unintentionally converted to URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « base/win/scoped_hglobal.h ('k') | remoting/host/clipboard_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 #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
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
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
OLDNEW
« no previous file with comments | « base/win/scoped_hglobal.h ('k') | remoting/host/clipboard_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698