| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual void PreSandbox(bool* disable_default_policy, | 45 virtual void PreSandbox(bool* disable_default_policy, |
| 46 base::FilePath* exposed_dir) OVERRIDE { | 46 base::FilePath* exposed_dir) OVERRIDE { |
| 47 *exposed_dir = exposed_dir_; | 47 *exposed_dir = exposed_dir_; |
| 48 } | 48 } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 base::FilePath exposed_dir_; | 51 base::FilePath exposed_dir_; |
| 52 }; | 52 }; |
| 53 } | 53 } // namespace |
| 54 | 54 |
| 55 #endif // OS_WIN | 55 #endif // OS_WIN |
| 56 | 56 |
| 57 using content::ChildProcessHost; | 57 using content::ChildProcessHost; |
| 58 | 58 |
| 59 ServiceUtilityProcessHost::ServiceUtilityProcessHost( | 59 ServiceUtilityProcessHost::ServiceUtilityProcessHost( |
| 60 Client* client, base::MessageLoopProxy* client_message_loop_proxy) | 60 Client* client, base::MessageLoopProxy* client_message_loop_proxy) |
| 61 : handle_(base::kNullProcessHandle), | 61 : handle_(base::kNullProcessHandle), |
| 62 client_(client), | 62 client_(client), |
| 63 client_message_loop_proxy_(client_message_loop_proxy), | 63 client_message_loop_proxy_(client_message_loop_proxy), |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 IPC_MESSAGE_HANDLER( | 199 IPC_MESSAGE_HANDLER( |
| 200 ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded, | 200 ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded, |
| 201 OnGetPrinterCapsAndDefaultsSucceeded) | 201 OnGetPrinterCapsAndDefaultsSucceeded) |
| 202 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed, | 202 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed, |
| 203 OnGetPrinterCapsAndDefaultsFailed) | 203 OnGetPrinterCapsAndDefaultsFailed) |
| 204 IPC_MESSAGE_UNHANDLED(handled = false) | 204 IPC_MESSAGE_UNHANDLED(handled = false) |
| 205 IPC_END_MESSAGE_MAP() | 205 IPC_END_MESSAGE_MAP() |
| 206 return handled; | 206 return handled; |
| 207 } | 207 } |
| 208 | 208 |
| 209 base::ProcessHandle ServiceUtilityProcessHost::GetHandle() const { |
| 210 return handle_; |
| 211 } |
| 212 |
| 209 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileSucceeded( | 213 void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileSucceeded( |
| 210 int highest_rendered_page_number, | 214 int highest_rendered_page_number, |
| 211 double scale_factor) { | 215 double scale_factor) { |
| 212 DCHECK(waiting_for_reply_); | 216 DCHECK(waiting_for_reply_); |
| 213 waiting_for_reply_ = false; | 217 waiting_for_reply_ = false; |
| 214 // If the metafile was successfully created, we need to take our hands off the | 218 // If the metafile was successfully created, we need to take our hands off the |
| 215 // scratch metafile directory. The client will delete it when it is done with | 219 // scratch metafile directory. The client will delete it when it is done with |
| 216 // metafile. | 220 // metafile. |
| 217 scratch_metafile_dir_->Take(); | 221 scratch_metafile_dir_->Take(); |
| 218 client_message_loop_proxy_->PostTask( | 222 client_message_loop_proxy_->PostTask( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 if (!metafile.InitFromFile(metafile_path)) { | 271 if (!metafile.InitFromFile(metafile_path)) { |
| 268 OnRenderPDFPagesToMetafileFailed(); | 272 OnRenderPDFPagesToMetafileFailed(); |
| 269 } else { | 273 } else { |
| 270 OnRenderPDFPagesToMetafileSucceeded(metafile, | 274 OnRenderPDFPagesToMetafileSucceeded(metafile, |
| 271 highest_rendered_page_number, | 275 highest_rendered_page_number, |
| 272 scale_factor); | 276 scale_factor); |
| 273 } | 277 } |
| 274 #endif // defined(OS_WIN) | 278 #endif // defined(OS_WIN) |
| 275 } | 279 } |
| 276 | 280 |
| OLD | NEW |