Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/service/service_utility_process_host.cc

Issue 6544028: Create a Factory for NativeMetafile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ARM compile failure fix Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/webplugin_delegate_proxy.cc ('k') | chrome/utility/utility_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/utility_messages.h" 14 #include "chrome/common/utility_messages.h"
15 #include "ipc/ipc_switches.h" 15 #include "ipc/ipc_switches.h"
16 #include "printing/native_metafile.h"
17 #include "printing/page_range.h" 16 #include "printing/page_range.h"
18 #include "ui/base/ui_base_switches.h" 17 #include "ui/base/ui_base_switches.h"
19 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
20 19
21 #if defined(OS_WIN) 20 #if defined(OS_WIN)
21 #include "base/scoped_ptr.h"
22 #include "base/win/scoped_handle.h" 22 #include "base/win/scoped_handle.h"
23 #include "printing/native_metafile_factory.h"
24 #include "printing/native_metafile.h"
23 #endif 25 #endif
24 26
25 ServiceUtilityProcessHost::ServiceUtilityProcessHost( 27 ServiceUtilityProcessHost::ServiceUtilityProcessHost(
26 Client* client, base::MessageLoopProxy* client_message_loop_proxy) 28 Client* client, base::MessageLoopProxy* client_message_loop_proxy)
27 : ServiceChildProcessHost(ChildProcessInfo::UTILITY_PROCESS), 29 : ServiceChildProcessHost(ChildProcessInfo::UTILITY_PROCESS),
28 client_(client), 30 client_(client),
29 client_message_loop_proxy_(client_message_loop_proxy), 31 client_message_loop_proxy_(client_message_loop_proxy),
30 waiting_for_reply_(false) { 32 waiting_for_reply_(false) {
31 } 33 }
32 34
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « chrome/renderer/webplugin_delegate_proxy.cc ('k') | chrome/utility/utility_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698