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 "app/app_switches.h" | 7 #include "app/app_switches.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/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 exposed_dir, | 146 exposed_dir, |
147 #elif defined(OS_POSIX) | 147 #elif defined(OS_POSIX) |
148 false, | 148 false, |
149 base::environment_vector(), | 149 base::environment_vector(), |
150 #endif | 150 #endif |
151 cmd_line); | 151 cmd_line); |
152 | 152 |
153 return true; | 153 return true; |
154 } | 154 } |
155 | 155 |
156 void UtilityProcessHost::OnMessageReceived(const IPC::Message& message) { | 156 bool UtilityProcessHost::OnMessageReceived(const IPC::Message& message) { |
157 BrowserThread::PostTask( | 157 BrowserThread::PostTask( |
158 client_thread_id_, FROM_HERE, | 158 client_thread_id_, FROM_HERE, |
159 NewRunnableMethod(client_.get(), &Client::OnMessageReceived, message)); | 159 NewRunnableMethod(client_.get(), &Client::OnMessageReceived, message)); |
| 160 return true; |
160 } | 161 } |
161 | 162 |
162 void UtilityProcessHost::OnProcessCrashed(int exit_code) { | 163 void UtilityProcessHost::OnProcessCrashed(int exit_code) { |
163 BrowserThread::PostTask( | 164 BrowserThread::PostTask( |
164 client_thread_id_, FROM_HERE, | 165 client_thread_id_, FROM_HERE, |
165 NewRunnableMethod(client_.get(), &Client::OnProcessCrashed, exit_code)); | 166 NewRunnableMethod(client_.get(), &Client::OnProcessCrashed, exit_code)); |
166 } | 167 } |
167 | 168 |
168 bool UtilityProcessHost::CanShutdown() { | 169 bool UtilityProcessHost::CanShutdown() { |
169 return true; | 170 return true; |
170 } | 171 } |
171 | 172 |
172 void UtilityProcessHost::Client::OnMessageReceived( | 173 bool UtilityProcessHost::Client::OnMessageReceived( |
173 const IPC::Message& message) { | 174 const IPC::Message& message) { |
| 175 bool handled = true; |
174 IPC_BEGIN_MESSAGE_MAP(UtilityProcessHost, message) | 176 IPC_BEGIN_MESSAGE_MAP(UtilityProcessHost, message) |
175 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Succeeded, | 177 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Succeeded, |
176 Client::OnUnpackExtensionSucceeded) | 178 Client::OnUnpackExtensionSucceeded) |
177 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Failed, | 179 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Failed, |
178 Client::OnUnpackExtensionFailed) | 180 Client::OnUnpackExtensionFailed) |
179 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Succeeded, | 181 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Succeeded, |
180 Client::OnUnpackWebResourceSucceeded) | 182 Client::OnUnpackWebResourceSucceeded) |
181 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Failed, | 183 IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackWebResource_Failed, |
182 Client::OnUnpackWebResourceFailed) | 184 Client::OnUnpackWebResourceFailed) |
183 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded, | 185 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded, |
184 Client::OnParseUpdateManifestSucceeded) | 186 Client::OnParseUpdateManifestSucceeded) |
185 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed, | 187 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed, |
186 Client::OnParseUpdateManifestFailed) | 188 Client::OnParseUpdateManifestFailed) |
187 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Succeeded, | 189 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Succeeded, |
188 Client::OnDecodeImageSucceeded) | 190 Client::OnDecodeImageSucceeded) |
189 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Failed, | 191 IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Failed, |
190 Client::OnDecodeImageFailed) | 192 Client::OnDecodeImageFailed) |
191 IPC_MESSAGE_HANDLER(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded, | 193 IPC_MESSAGE_HANDLER(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded, |
192 Client::OnIDBKeysFromValuesAndKeyPathSucceeded) | 194 Client::OnIDBKeysFromValuesAndKeyPathSucceeded) |
193 IPC_MESSAGE_HANDLER(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed, | 195 IPC_MESSAGE_HANDLER(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed, |
194 Client::OnIDBKeysFromValuesAndKeyPathFailed) | 196 Client::OnIDBKeysFromValuesAndKeyPathFailed) |
| 197 IPC_MESSAGE_UNHANDLED(handled = false) |
195 IPC_END_MESSAGE_MAP_EX() | 198 IPC_END_MESSAGE_MAP_EX() |
| 199 return handled; |
196 } | 200 } |
OLD | NEW |