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 std::wstring exe_path = CommandLine::ForCurrentProcess()->GetSwitchValue( | 55 return GetChildPath(); |
56 switches::kBrowserSubprocessPath); | |
57 if (exe_path.empty()) { | |
58 PathService::Get(base::FILE_EXE, &exe_path); | |
59 } | |
60 return exe_path; | |
61 } | 56 } |
62 | 57 |
63 bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { | 58 bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { |
64 // Name must be set or metrics_service will crash in any test which | 59 // Name must be set or metrics_service will crash in any test which |
65 // launches a UtilityProcessHost. | 60 // launches a UtilityProcessHost. |
66 set_name(L"utility process"); | 61 set_name(L"utility process"); |
67 | 62 |
68 if (!CreateChannel()) | 63 if (!CreateChannel()) |
69 return false; | 64 return false; |
70 | 65 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Succeeded, | 136 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Succeeded, |
142 Client::OnUnpackExtensionSucceeded) | 137 Client::OnUnpackExtensionSucceeded) |
143 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Failed, | 138 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Failed, |
144 Client::OnUnpackExtensionFailed) | 139 Client::OnUnpackExtensionFailed) |
145 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Succeeded, | 140 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Succeeded, |
146 Client::OnUnpackWebResourceSucceeded) | 141 Client::OnUnpackWebResourceSucceeded) |
147 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Failed, | 142 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Failed, |
148 Client::OnUnpackWebResourceFailed) | 143 Client::OnUnpackWebResourceFailed) |
149 IPC_END_MESSAGE_MAP_EX() | 144 IPC_END_MESSAGE_MAP_EX() |
150 } | 145 } |
OLD | NEW |