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/win_helper.h" | 5 #include "printing/backend/win_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 DCHECK(stream); | 84 DCHECK(stream); |
85 HRESULT hr = CreateStreamOnHGlobal(NULL, TRUE, stream); | 85 HRESULT hr = CreateStreamOnHGlobal(NULL, TRUE, stream); |
86 if (FAILED(hr)) { | 86 if (FAILED(hr)) { |
87 return hr; | 87 return hr; |
88 } | 88 } |
89 ULONG bytes_written = 0; | 89 ULONG bytes_written = 0; |
90 (*stream)->Write(print_ticket.c_str(), | 90 (*stream)->Write(print_ticket.c_str(), |
91 base::checked_cast<ULONG>(print_ticket.length()), | 91 base::checked_cast<ULONG>(print_ticket.length()), |
92 &bytes_written); | 92 &bytes_written); |
93 DCHECK(bytes_written == print_ticket.length()); | 93 DCHECK(bytes_written == print_ticket.length()); |
94 LARGE_INTEGER pos = {0}; | 94 LARGE_INTEGER pos = {}; |
95 ULARGE_INTEGER new_pos = {0}; | 95 ULARGE_INTEGER new_pos = {}; |
96 (*stream)->Seek(pos, STREAM_SEEK_SET, &new_pos); | 96 (*stream)->Seek(pos, STREAM_SEEK_SET, &new_pos); |
97 return S_OK; | 97 return S_OK; |
98 } | 98 } |
99 | 99 |
100 const char kXpsTicketTemplate[] = | 100 const char kXpsTicketTemplate[] = |
101 "<?xml version='1.0' encoding='UTF-8'?>" | 101 "<?xml version='1.0' encoding='UTF-8'?>" |
102 "<psf:PrintTicket " | 102 "<psf:PrintTicket " |
103 "xmlns:psf='" | 103 "xmlns:psf='" |
104 "http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework' " | 104 "http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework' " |
105 "xmlns:psk=" | 105 "xmlns:psk=" |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 *canceled = (result == IDCANCEL); | 524 *canceled = (result == IDCANCEL); |
525 if (result != IDOK) | 525 if (result != IDOK) |
526 return scoped_ptr<DEVMODE, base::FreeDeleter>(); | 526 return scoped_ptr<DEVMODE, base::FreeDeleter>(); |
527 int size = out->dmSize; | 527 int size = out->dmSize; |
528 int extra_size = out->dmDriverExtra; | 528 int extra_size = out->dmDriverExtra; |
529 CHECK_GE(buffer_size, size + extra_size); | 529 CHECK_GE(buffer_size, size + extra_size); |
530 return out.Pass(); | 530 return out.Pass(); |
531 } | 531 } |
532 | 532 |
533 } // namespace printing | 533 } // namespace printing |
OLD | NEW |