| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/service/cloud_print/print_system.h" | 5 #include "chrome/service/cloud_print/print_system.h" |
| 6 | 6 |
| 7 #include <objidl.h> | 7 #include <objidl.h> |
| 8 #include <winspool.h> | 8 #include <winspool.h> |
| 9 #if defined(_WIN32_WINNT) | 9 #if defined(_WIN32_WINNT) |
| 10 #undef _WIN32_WINNT | 10 #undef _WIN32_WINNT |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 NULL); | 801 NULL); |
| 802 DCHECK(printer_handle); | 802 DCHECK(printer_handle); |
| 803 bool ret = false; | 803 bool ret = false; |
| 804 if (printer_handle) { | 804 if (printer_handle) { |
| 805 DWORD bytes_needed = 0; | 805 DWORD bytes_needed = 0; |
| 806 GetJob(printer_handle, job_id, 1, NULL, 0, &bytes_needed); | 806 GetJob(printer_handle, job_id, 1, NULL, 0, &bytes_needed); |
| 807 DWORD last_error = GetLastError(); | 807 DWORD last_error = GetLastError(); |
| 808 if (ERROR_INVALID_PARAMETER != last_error) { | 808 if (ERROR_INVALID_PARAMETER != last_error) { |
| 809 // ERROR_INVALID_PARAMETER normally means that the job id is not valid. | 809 // ERROR_INVALID_PARAMETER normally means that the job id is not valid. |
| 810 DCHECK(last_error == ERROR_INSUFFICIENT_BUFFER); | 810 DCHECK(last_error == ERROR_INSUFFICIENT_BUFFER); |
| 811 scoped_ptr<BYTE> job_info_buffer(new BYTE[bytes_needed]); | 811 scoped_array<BYTE> job_info_buffer(new BYTE[bytes_needed]); |
| 812 if (GetJob(printer_handle, job_id, 1, job_info_buffer.get(), bytes_needed, | 812 if (GetJob(printer_handle, job_id, 1, job_info_buffer.get(), bytes_needed, |
| 813 &bytes_needed)) { | 813 &bytes_needed)) { |
| 814 JOB_INFO_1 *job_info = | 814 JOB_INFO_1 *job_info = |
| 815 reinterpret_cast<JOB_INFO_1 *>(job_info_buffer.get()); | 815 reinterpret_cast<JOB_INFO_1 *>(job_info_buffer.get()); |
| 816 if (job_info->pStatus) { | 816 if (job_info->pStatus) { |
| 817 WideToUTF8(job_info->pStatus, wcslen(job_info->pStatus), | 817 WideToUTF8(job_info->pStatus, wcslen(job_info->pStatus), |
| 818 &job_details->status_message); | 818 &job_details->status_message); |
| 819 } | 819 } |
| 820 job_details->platform_status_flags = job_info->Status; | 820 job_details->platform_status_flags = job_info->Status; |
| 821 if ((job_info->Status & JOB_STATUS_COMPLETE) || | 821 if ((job_info->Status & JOB_STATUS_COMPLETE) || |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); | 871 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); |
| 872 return ret; | 872 return ret; |
| 873 } | 873 } |
| 874 | 874 |
| 875 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( | 875 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( |
| 876 const base::DictionaryValue* print_system_settings) { | 876 const base::DictionaryValue* print_system_settings) { |
| 877 return new PrintSystemWin; | 877 return new PrintSystemWin; |
| 878 } | 878 } |
| 879 | 879 |
| 880 } // namespace cloud_print | 880 } // namespace cloud_print |
| OLD | NEW |