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

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

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/service/service_utility_process_host.h ('k') | chrome/test/automation/proxy_launcher.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.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/files/scoped_temp_dir.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/message_loop.h" 12 #include "base/message_loop.h"
12 #include "base/message_loop_proxy.h" 13 #include "base/message_loop_proxy.h"
13 #include "base/process_util.h" 14 #include "base/process_util.h"
14 #include "base/scoped_temp_dir.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/chrome_utility_messages.h" 17 #include "chrome/common/chrome_utility_messages.h"
18 #include "content/public/common/child_process_host.h" 18 #include "content/public/common/child_process_host.h"
19 #include "content/public/common/result_codes.h" 19 #include "content/public/common/result_codes.h"
20 #include "content/public/common/sandbox_init.h" 20 #include "content/public/common/sandbox_init.h"
21 #include "ipc/ipc_switches.h" 21 #include "ipc/ipc_switches.h"
22 #include "printing/page_range.h" 22 #include "printing/page_range.h"
23 #include "ui/base/ui_base_switches.h" 23 #include "ui/base/ui_base_switches.h"
24 #include "ui/gfx/rect.h" 24 #include "ui/gfx/rect.h"
(...skipping 24 matching lines...) Expand all
49 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile( 49 bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile(
50 const FilePath& pdf_path, 50 const FilePath& pdf_path,
51 const printing::PdfRenderSettings& render_settings, 51 const printing::PdfRenderSettings& render_settings,
52 const std::vector<printing::PageRange>& page_ranges) { 52 const std::vector<printing::PageRange>& page_ranges) {
53 #if !defined(OS_WIN) 53 #if !defined(OS_WIN)
54 // This is only implemented on Windows (because currently it is only needed 54 // This is only implemented on Windows (because currently it is only needed
55 // on Windows). Will add implementations on other platforms when needed. 55 // on Windows). Will add implementations on other platforms when needed.
56 NOTIMPLEMENTED(); 56 NOTIMPLEMENTED();
57 return false; 57 return false;
58 #else // !defined(OS_WIN) 58 #else // !defined(OS_WIN)
59 scratch_metafile_dir_.reset(new ScopedTempDir); 59 scratch_metafile_dir_.reset(new base::ScopedTempDir);
60 if (!scratch_metafile_dir_->CreateUniqueTempDir()) 60 if (!scratch_metafile_dir_->CreateUniqueTempDir())
61 return false; 61 return false;
62 if (!file_util::CreateTemporaryFileInDir(scratch_metafile_dir_->path(), 62 if (!file_util::CreateTemporaryFileInDir(scratch_metafile_dir_->path(),
63 &metafile_path_)) { 63 &metafile_path_)) {
64 return false; 64 return false;
65 } 65 }
66 66
67 if (!StartProcess(false, scratch_metafile_dir_->path())) 67 if (!StartProcess(false, scratch_metafile_dir_->path()))
68 return false; 68 return false;
69 69
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 base::Bind(&Client::OnGetPrinterCapsAndDefaultsFailed, client_.get(), 223 base::Bind(&Client::OnGetPrinterCapsAndDefaultsFailed, client_.get(),
224 printer_name)); 224 printer_name));
225 } 225 }
226 226
227 void ServiceUtilityProcessHost::Client::MetafileAvailable( 227 void ServiceUtilityProcessHost::Client::MetafileAvailable(
228 const FilePath& metafile_path, 228 const FilePath& metafile_path,
229 int highest_rendered_page_number, 229 int highest_rendered_page_number,
230 double scale_factor) { 230 double scale_factor) {
231 // The metafile was created in a temp folder which needs to get deleted after 231 // The metafile was created in a temp folder which needs to get deleted after
232 // we have processed it. 232 // we have processed it.
233 ScopedTempDir scratch_metafile_dir; 233 base::ScopedTempDir scratch_metafile_dir;
234 if (!scratch_metafile_dir.Set(metafile_path.DirName())) 234 if (!scratch_metafile_dir.Set(metafile_path.DirName()))
235 LOG(WARNING) << "Unable to set scratch metafile directory"; 235 LOG(WARNING) << "Unable to set scratch metafile directory";
236 #if defined(OS_WIN) 236 #if defined(OS_WIN)
237 // It's important that metafile is declared after scratch_metafile_dir so 237 // It's important that metafile is declared after scratch_metafile_dir so
238 // that the metafile destructor closes the file before the ScopedTempDir 238 // that the metafile destructor closes the file before the base::ScopedTempDir
239 // destructor tries to remove the directory. 239 // destructor tries to remove the directory.
240 printing::Emf metafile; 240 printing::Emf metafile;
241 if (!metafile.InitFromFile(metafile_path)) { 241 if (!metafile.InitFromFile(metafile_path)) {
242 OnRenderPDFPagesToMetafileFailed(); 242 OnRenderPDFPagesToMetafileFailed();
243 } else { 243 } else {
244 OnRenderPDFPagesToMetafileSucceeded(metafile, 244 OnRenderPDFPagesToMetafileSucceeded(metafile,
245 highest_rendered_page_number, 245 highest_rendered_page_number,
246 scale_factor); 246 scale_factor);
247 } 247 }
248 #endif // defined(OS_WIN) 248 #endif // defined(OS_WIN)
249 } 249 }
250 250
OLDNEW
« no previous file with comments | « chrome/service/service_utility_process_host.h ('k') | chrome/test/automation/proxy_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698