| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser/utility_process_host.h" | 5 #include "chrome/browser/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/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 bool UtilityProcessHost::StartWebResourceUnpacker(const std::string& data) { | 46 bool UtilityProcessHost::StartWebResourceUnpacker(const std::string& data) { |
| 47 if (!StartProcess(FilePath())) | 47 if (!StartProcess(FilePath())) |
| 48 return false; | 48 return false; |
| 49 | 49 |
| 50 Send(new UtilityMsg_UnpackWebResource(data)); | 50 Send(new UtilityMsg_UnpackWebResource(data)); |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 std::wstring UtilityProcessHost::GetUtilityProcessCmd() { | 54 std::wstring UtilityProcessHost::GetUtilityProcessCmd() { |
| 55 return GetChildPath(); | 55 std::wstring exe_path = CommandLine::ForCurrentProcess()->GetSwitchValue( |
| 56 switches::kBrowserSubprocessPath); |
| 57 if (exe_path.empty()) { |
| 58 PathService::Get(base::FILE_EXE, &exe_path); |
| 59 } |
| 60 return exe_path; |
| 56 } | 61 } |
| 57 | 62 |
| 58 bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { | 63 bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { |
| 59 // Name must be set or metrics_service will crash in any test which | 64 // Name must be set or metrics_service will crash in any test which |
| 60 // launches a UtilityProcessHost. | 65 // launches a UtilityProcessHost. |
| 61 set_name(L"utility process"); | 66 set_name(L"utility process"); |
| 62 | 67 |
| 63 if (!CreateChannel()) | 68 if (!CreateChannel()) |
| 64 return false; | 69 return false; |
| 65 | 70 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Succeeded, | 141 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Succeeded, |
| 137 Client::OnUnpackExtensionSucceeded) | 142 Client::OnUnpackExtensionSucceeded) |
| 138 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Failed, | 143 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Failed, |
| 139 Client::OnUnpackExtensionFailed) | 144 Client::OnUnpackExtensionFailed) |
| 140 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Succeeded, | 145 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Succeeded, |
| 141 Client::OnUnpackWebResourceSucceeded) | 146 Client::OnUnpackWebResourceSucceeded) |
| 142 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Failed, | 147 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Failed, |
| 143 Client::OnUnpackWebResourceFailed) | 148 Client::OnUnpackWebResourceFailed) |
| 144 IPC_END_MESSAGE_MAP_EX() | 149 IPC_END_MESSAGE_MAP_EX() |
| 145 } | 150 } |
| OLD | NEW |