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" |
16 #include "printing/native_metafile.h" | 17 #include "printing/metafile_factory.h" |
vandebo (ex-Chrome)
2011/02/22 22:18:16
Still used.
dpapad
2011/02/23 00:44:39
Done.
| |
17 #include "printing/page_range.h" | 18 #include "printing/page_range.h" |
18 #include "ui/base/ui_base_switches.h" | 19 #include "ui/base/ui_base_switches.h" |
19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
20 | 21 |
21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
22 #include "base/win/scoped_handle.h" | 23 #include "base/win/scoped_handle.h" |
23 #endif | 24 #endif |
24 | 25 |
25 ServiceUtilityProcessHost::ServiceUtilityProcessHost( | 26 ServiceUtilityProcessHost::ServiceUtilityProcessHost( |
26 Client* client, base::MessageLoopProxy* client_message_loop_proxy) | 27 Client* client, base::MessageLoopProxy* client_message_loop_proxy) |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 | 196 |
196 void ServiceUtilityProcessHost::Client::MetafileAvailable( | 197 void ServiceUtilityProcessHost::Client::MetafileAvailable( |
197 const FilePath& metafile_path, | 198 const FilePath& metafile_path, |
198 int highest_rendered_page_number) { | 199 int highest_rendered_page_number) { |
199 // The metafile was created in a temp folder which needs to get deleted after | 200 // The metafile was created in a temp folder which needs to get deleted after |
200 // we have processed it. | 201 // we have processed it. |
201 ScopedTempDir scratch_metafile_dir; | 202 ScopedTempDir scratch_metafile_dir; |
202 if (!scratch_metafile_dir.Set(metafile_path.DirName())) | 203 if (!scratch_metafile_dir.Set(metafile_path.DirName())) |
203 LOG(WARNING) << "Unable to set scratch metafile directory"; | 204 LOG(WARNING) << "Unable to set scratch metafile directory"; |
204 #if defined(OS_WIN) | 205 #if defined(OS_WIN) |
205 printing::NativeMetafile metafile; | 206 scoped_ptr<printing::NativeMetafile> metafile( |
206 if (!metafile.CreateFromFile(metafile_path)) { | 207 printing::MetafileFactory::GetMetafile()); |
208 if (!metafile->CreateFromFile(metafile_path)) { | |
207 OnRenderPDFPagesToMetafileFailed(); | 209 OnRenderPDFPagesToMetafileFailed(); |
208 } else { | 210 } else { |
209 OnRenderPDFPagesToMetafileSucceeded(metafile, highest_rendered_page_number); | 211 OnRenderPDFPagesToMetafileSucceeded(*metafile.get(), |
212 highest_rendered_page_number); | |
210 // Close it so that ScopedTempDir can delete the folder. | 213 // Close it so that ScopedTempDir can delete the folder. |
211 metafile.CloseEmf(); | 214 metafile->CloseEmf(); |
212 } | 215 } |
213 #endif // defined(OS_WIN) | 216 #endif // defined(OS_WIN) |
214 } | 217 } |
215 | 218 |
OLD | NEW |