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/service_utility_process_host.h" | 5 #include "chrome/service/service_utility_process_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 client_message_loop_proxy_(client_message_loop_proxy), | 31 client_message_loop_proxy_(client_message_loop_proxy), |
32 waiting_for_reply_(false) { | 32 waiting_for_reply_(false) { |
33 process_id_ = ChildProcessInfo::GenerateChildProcessUniqueId(); | 33 process_id_ = ChildProcessInfo::GenerateChildProcessUniqueId(); |
34 } | 34 } |
35 | 35 |
36 ServiceUtilityProcessHost::~ServiceUtilityProcessHost() { | 36 ServiceUtilityProcessHost::~ServiceUtilityProcessHost() { |
37 } | 37 } |
38 | 38 |
39 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile( | 39 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile( |
40 const FilePath& pdf_path, | 40 const FilePath& pdf_path, |
41 const gfx::Rect& render_area, | 41 const printing::PdfRenderSettings& render_settings, |
42 int render_dpi, | |
43 const std::vector<printing::PageRange>& page_ranges) { | 42 const std::vector<printing::PageRange>& page_ranges) { |
44 #if !defined(OS_WIN) | 43 #if !defined(OS_WIN) |
45 // This is only implemented on Windows (because currently it is only needed | 44 // This is only implemented on Windows (because currently it is only needed |
46 // on Windows). Will add implementations on other platforms when needed. | 45 // on Windows). Will add implementations on other platforms when needed. |
47 NOTIMPLEMENTED(); | 46 NOTIMPLEMENTED(); |
48 return false; | 47 return false; |
49 #else // !defined(OS_WIN) | 48 #else // !defined(OS_WIN) |
50 scratch_metafile_dir_.reset(new ScopedTempDir); | 49 scratch_metafile_dir_.reset(new ScopedTempDir); |
51 if (!scratch_metafile_dir_->CreateUniqueTempDir()) | 50 if (!scratch_metafile_dir_->CreateUniqueTempDir()) |
52 return false; | 51 return false; |
(...skipping 19 matching lines...) Expand all Loading... |
72 ::DuplicateHandle(::GetCurrentProcess(), pdf_file, handle(), | 71 ::DuplicateHandle(::GetCurrentProcess(), pdf_file, handle(), |
73 &pdf_file_in_utility_process, 0, false, | 72 &pdf_file_in_utility_process, 0, false, |
74 DUPLICATE_SAME_ACCESS); | 73 DUPLICATE_SAME_ACCESS); |
75 if (!pdf_file_in_utility_process) | 74 if (!pdf_file_in_utility_process) |
76 return false; | 75 return false; |
77 waiting_for_reply_ = true; | 76 waiting_for_reply_ = true; |
78 return Send( | 77 return Send( |
79 new ChromeUtilityMsg_RenderPDFPagesToMetafile( | 78 new ChromeUtilityMsg_RenderPDFPagesToMetafile( |
80 pdf_file_in_utility_process, | 79 pdf_file_in_utility_process, |
81 metafile_path_, | 80 metafile_path_, |
82 render_area, | 81 render_settings, |
83 render_dpi, | |
84 page_ranges)); | 82 page_ranges)); |
85 #endif // !defined(OS_WIN) | 83 #endif // !defined(OS_WIN) |
86 } | 84 } |
87 | 85 |
88 bool ServiceUtilityProcessHost::StartGetPrinterCapsAndDefaults( | 86 bool ServiceUtilityProcessHost::StartGetPrinterCapsAndDefaults( |
89 const std::string& printer_name) { | 87 const std::string& printer_name) { |
90 FilePath exposed_path; | 88 FilePath exposed_path; |
91 if (!StartProcess(true, exposed_path)) | 89 if (!StartProcess(true, exposed_path)) |
92 return false; | 90 return false; |
93 waiting_for_reply_ = true; | 91 waiting_for_reply_ = true; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 printing::Emf metafile; | 224 printing::Emf metafile; |
227 if (!metafile.InitFromFile(metafile_path)) { | 225 if (!metafile.InitFromFile(metafile_path)) { |
228 OnRenderPDFPagesToMetafileFailed(); | 226 OnRenderPDFPagesToMetafileFailed(); |
229 } else { | 227 } else { |
230 OnRenderPDFPagesToMetafileSucceeded(metafile, | 228 OnRenderPDFPagesToMetafileSucceeded(metafile, |
231 highest_rendered_page_number); | 229 highest_rendered_page_number); |
232 } | 230 } |
233 #endif // defined(OS_WIN) | 231 #endif // defined(OS_WIN) |
234 } | 232 } |
235 | 233 |
OLD | NEW |