OLD | NEW |
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/files/scoped_temp_dir.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 start_time_ = base::Time::Now(); | 97 start_time_ = base::Time::Now(); |
98 #if !defined(OS_WIN) | 98 #if !defined(OS_WIN) |
99 // This is only implemented on Windows (because currently it is only needed | 99 // This is only implemented on Windows (because currently it is only needed |
100 // on Windows). Will add implementations on other platforms when needed. | 100 // on Windows). Will add implementations on other platforms when needed. |
101 NOTIMPLEMENTED(); | 101 NOTIMPLEMENTED(); |
102 return false; | 102 return false; |
103 #else // !defined(OS_WIN) | 103 #else // !defined(OS_WIN) |
104 scratch_metafile_dir_.reset(new base::ScopedTempDir); | 104 scratch_metafile_dir_.reset(new base::ScopedTempDir); |
105 if (!scratch_metafile_dir_->CreateUniqueTempDir()) | 105 if (!scratch_metafile_dir_->CreateUniqueTempDir()) |
106 return false; | 106 return false; |
107 if (!file_util::CreateTemporaryFileInDir(scratch_metafile_dir_->path(), | 107 if (!base::CreateTemporaryFileInDir(scratch_metafile_dir_->path(), |
108 &metafile_path_)) { | 108 &metafile_path_)) { |
109 return false; | 109 return false; |
110 } | 110 } |
111 | 111 |
112 if (!StartProcess(false, scratch_metafile_dir_->path())) | 112 if (!StartProcess(false, scratch_metafile_dir_->path())) |
113 return false; | 113 return false; |
114 | 114 |
115 base::win::ScopedHandle pdf_file( | 115 base::win::ScopedHandle pdf_file( |
116 ::CreateFile(pdf_path.value().c_str(), | 116 ::CreateFile(pdf_path.value().c_str(), |
117 GENERIC_READ, | 117 GENERIC_READ, |
118 FILE_SHARE_READ | FILE_SHARE_WRITE, | 118 FILE_SHARE_READ | FILE_SHARE_WRITE, |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 if (!metafile.InitFromFile(metafile_path)) { | 323 if (!metafile.InitFromFile(metafile_path)) { |
324 OnRenderPDFPagesToMetafileFailed(); | 324 OnRenderPDFPagesToMetafileFailed(); |
325 } else { | 325 } else { |
326 OnRenderPDFPagesToMetafileSucceeded(metafile, | 326 OnRenderPDFPagesToMetafileSucceeded(metafile, |
327 highest_rendered_page_number, | 327 highest_rendered_page_number, |
328 scale_factor); | 328 scale_factor); |
329 } | 329 } |
330 #endif // defined(OS_WIN) | 330 #endif // defined(OS_WIN) |
331 } | 331 } |
332 | 332 |
OLD | NEW |