| OLD | NEW |
| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| 11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
| 12 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/common/chrome_utility_messages.h" | 14 #include "chrome/common/chrome_utility_messages.h" |
| 14 #include "ipc/ipc_switches.h" | 15 #include "ipc/ipc_switches.h" |
| 15 #include "printing/page_range.h" | 16 #include "printing/page_range.h" |
| 16 #include "ui/base/ui_base_switches.h" | 17 #include "ui/base/ui_base_switches.h" |
| 17 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
| 18 | 19 |
| 19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 20 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/win/scoped_handle.h" | 22 #include "base/win/scoped_handle.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 if (!StartProcess(true, exposed_path)) | 88 if (!StartProcess(true, exposed_path)) |
| 88 return false; | 89 return false; |
| 89 waiting_for_reply_ = true; | 90 waiting_for_reply_ = true; |
| 90 return Send(new UtilityMsg_GetPrinterCapsAndDefaults(printer_name)); | 91 return Send(new UtilityMsg_GetPrinterCapsAndDefaults(printer_name)); |
| 91 } | 92 } |
| 92 | 93 |
| 93 bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox, | 94 bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox, |
| 94 const FilePath& exposed_dir) { | 95 const FilePath& exposed_dir) { |
| 95 // Name must be set or metrics_service will crash in any test which | 96 // Name must be set or metrics_service will crash in any test which |
| 96 // launches a UtilityProcessHost. | 97 // launches a UtilityProcessHost. |
| 97 set_name(L"utility process"); | 98 set_name(ASCIIToUTF16("utility process")); |
| 98 | 99 |
| 99 if (!CreateChannel()) | 100 if (!CreateChannel()) |
| 100 return false; | 101 return false; |
| 101 | 102 |
| 102 FilePath exe_path = GetUtilityProcessCmd(); | 103 FilePath exe_path = GetUtilityProcessCmd(); |
| 103 if (exe_path.empty()) { | 104 if (exe_path.empty()) { |
| 104 NOTREACHED() << "Unable to get utility process binary name."; | 105 NOTREACHED() << "Unable to get utility process binary name."; |
| 105 return false; | 106 return false; |
| 106 } | 107 } |
| 107 | 108 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 printing::Emf metafile; | 210 printing::Emf metafile; |
| 210 if (!metafile.InitFromFile(metafile_path)) { | 211 if (!metafile.InitFromFile(metafile_path)) { |
| 211 OnRenderPDFPagesToMetafileFailed(); | 212 OnRenderPDFPagesToMetafileFailed(); |
| 212 } else { | 213 } else { |
| 213 OnRenderPDFPagesToMetafileSucceeded(metafile, | 214 OnRenderPDFPagesToMetafileSucceeded(metafile, |
| 214 highest_rendered_page_number); | 215 highest_rendered_page_number); |
| 215 } | 216 } |
| 216 #endif // defined(OS_WIN) | 217 #endif // defined(OS_WIN) |
| 217 } | 218 } |
| 218 | 219 |
| OLD | NEW |