| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 void set_page_count(int page_count) { page_count_ = page_count; } | 138 void set_page_count(int page_count) { page_count_ = page_count; } |
| 139 bool has_page_count() { return page_count_ > 0; } | 139 bool has_page_count() { return page_count_ > 0; } |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 void Stop() { | 142 void Stop() { |
| 143 host_->Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop()); | 143 host_->Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop()); |
| 144 } | 144 } |
| 145 | 145 |
| 146 base::File CreateTempFile() { | 146 base::File CreateTempFile() { |
| 147 base::FilePath path; | 147 base::FilePath path; |
| 148 if (!base::CreateTemporaryFileInDir(temp_dir_.path(), &path)) | 148 if (!base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &path)) |
| 149 return base::File(); | 149 return base::File(); |
| 150 return base::File(path, | 150 return base::File(path, |
| 151 base::File::FLAG_CREATE_ALWAYS | | 151 base::File::FLAG_CREATE_ALWAYS | |
| 152 base::File::FLAG_WRITE | | 152 base::File::FLAG_WRITE | |
| 153 base::File::FLAG_READ | | 153 base::File::FLAG_READ | |
| 154 base::File::FLAG_DELETE_ON_CLOSE | | 154 base::File::FLAG_DELETE_ON_CLOSE | |
| 155 base::File::FLAG_TEMPORARY); | 155 base::File::FLAG_TEMPORARY); |
| 156 } | 156 } |
| 157 | 157 |
| 158 base::ScopedTempDir temp_dir_; | 158 base::ScopedTempDir temp_dir_; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 return false; | 457 return false; |
| 458 } | 458 } |
| 459 printing::Emf emf; | 459 printing::Emf emf; |
| 460 if (!emf.InitFromData(data.data(), data.size())) { | 460 if (!emf.InitFromData(data.data(), data.size())) { |
| 461 OnRenderPDFPagesToMetafileDone(false); | 461 OnRenderPDFPagesToMetafileDone(false); |
| 462 return false; | 462 return false; |
| 463 } | 463 } |
| 464 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); | 464 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); |
| 465 return true; | 465 return true; |
| 466 } | 466 } |
| OLD | NEW |