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 "app/app_switches.h" | 7 #include "app/app_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
| 12 #include "base/scoped_ptr.h" |
12 #include "base/scoped_temp_dir.h" | 13 #include "base/scoped_temp_dir.h" |
13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/utility_messages.h" | 15 #include "chrome/common/utility_messages.h" |
15 #include "ipc/ipc_switches.h" | 16 #include "ipc/ipc_switches.h" |
| 17 #include "printing/native_metafile_factory.h" |
16 #include "printing/native_metafile.h" | 18 #include "printing/native_metafile.h" |
17 #include "printing/page_range.h" | 19 #include "printing/page_range.h" |
18 #include "ui/base/ui_base_switches.h" | 20 #include "ui/base/ui_base_switches.h" |
19 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
20 | 22 |
21 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
22 #include "base/win/scoped_handle.h" | 24 #include "base/win/scoped_handle.h" |
23 #endif | 25 #endif |
24 | 26 |
25 ServiceUtilityProcessHost::ServiceUtilityProcessHost( | 27 ServiceUtilityProcessHost::ServiceUtilityProcessHost( |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 197 |
196 void ServiceUtilityProcessHost::Client::MetafileAvailable( | 198 void ServiceUtilityProcessHost::Client::MetafileAvailable( |
197 const FilePath& metafile_path, | 199 const FilePath& metafile_path, |
198 int highest_rendered_page_number) { | 200 int highest_rendered_page_number) { |
199 // The metafile was created in a temp folder which needs to get deleted after | 201 // The metafile was created in a temp folder which needs to get deleted after |
200 // we have processed it. | 202 // we have processed it. |
201 ScopedTempDir scratch_metafile_dir; | 203 ScopedTempDir scratch_metafile_dir; |
202 if (!scratch_metafile_dir.Set(metafile_path.DirName())) | 204 if (!scratch_metafile_dir.Set(metafile_path.DirName())) |
203 LOG(WARNING) << "Unable to set scratch metafile directory"; | 205 LOG(WARNING) << "Unable to set scratch metafile directory"; |
204 #if defined(OS_WIN) | 206 #if defined(OS_WIN) |
205 printing::NativeMetafile metafile; | 207 scoped_ptr<printing::NativeMetafile> metafile( |
206 if (!metafile.CreateFromFile(metafile_path)) { | 208 printing::NativeMetafileFactory::CreateMetafile()); |
| 209 if (!metafile->CreateFromFile(metafile_path)) { |
207 OnRenderPDFPagesToMetafileFailed(); | 210 OnRenderPDFPagesToMetafileFailed(); |
208 } else { | 211 } else { |
209 OnRenderPDFPagesToMetafileSucceeded(metafile, highest_rendered_page_number); | 212 OnRenderPDFPagesToMetafileSucceeded(*metafile, |
| 213 highest_rendered_page_number); |
210 // Close it so that ScopedTempDir can delete the folder. | 214 // Close it so that ScopedTempDir can delete the folder. |
211 metafile.CloseEmf(); | 215 metafile->CloseEmf(); |
212 } | 216 } |
213 #endif // defined(OS_WIN) | 217 #endif // defined(OS_WIN) |
214 } | 218 } |
215 | 219 |
OLD | NEW |