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/browser/renderer_host/chrome_render_message_filter.h" | 5 #include "chrome/browser/renderer_host/chrome_render_message_filter.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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 weak_ptr_factory_(this) { | 170 weak_ptr_factory_(this) { |
171 } | 171 } |
172 | 172 |
173 ChromeRenderMessageFilter::~ChromeRenderMessageFilter() { | 173 ChromeRenderMessageFilter::~ChromeRenderMessageFilter() { |
174 } | 174 } |
175 | 175 |
176 bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message, | 176 bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message, |
177 bool* message_was_ok) { | 177 bool* message_was_ok) { |
178 bool handled = true; | 178 bool handled = true; |
179 IPC_BEGIN_MESSAGE_MAP_EX(ChromeRenderMessageFilter, message, *message_was_ok) | 179 IPC_BEGIN_MESSAGE_MAP_EX(ChromeRenderMessageFilter, message, *message_was_ok) |
180 #if !defined(DISABLE_NACL) | |
181 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_LaunchNaCl, OnLaunchNaCl) | |
182 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_GetReadonlyPnaclFD, | |
183 OnGetReadonlyPnaclFd) | |
184 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_NaClCreateTemporaryFile, | |
185 OnNaClCreateTemporaryFile) | |
186 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_NaClErrorStatus, OnNaClErrorStatus) | |
187 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_OpenNaClExecutable, | |
188 OnOpenNaClExecutable) | |
189 #endif | |
190 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DnsPrefetch, OnDnsPrefetch) | 180 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DnsPrefetch, OnDnsPrefetch) |
191 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_Preconnect, OnPreconnect) | 181 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_Preconnect, OnPreconnect) |
192 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ResourceTypeStats, | 182 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ResourceTypeStats, |
193 OnResourceTypeStats) | 183 OnResourceTypeStats) |
194 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdatedCacheStats, | 184 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdatedCacheStats, |
195 OnUpdatedCacheStats) | 185 OnUpdatedCacheStats) |
196 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FPS, OnFPS) | 186 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FPS, OnFPS) |
197 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_V8HeapStats, OnV8HeapStats) | 187 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_V8HeapStats, OnV8HeapStats) |
198 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension, | 188 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension, |
199 OnOpenChannelToExtension) | 189 OnOpenChannelToExtension) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 break; | 269 break; |
280 default: | 270 default: |
281 break; | 271 break; |
282 } | 272 } |
283 } | 273 } |
284 | 274 |
285 net::HostResolver* ChromeRenderMessageFilter::GetHostResolver() { | 275 net::HostResolver* ChromeRenderMessageFilter::GetHostResolver() { |
286 return request_context_->GetURLRequestContext()->host_resolver(); | 276 return request_context_->GetURLRequestContext()->host_resolver(); |
287 } | 277 } |
288 | 278 |
289 #if !defined(DISABLE_NACL) | |
290 void ChromeRenderMessageFilter::OnLaunchNaCl( | |
291 const nacl::NaClLaunchParams& launch_params, | |
292 IPC::Message* reply_msg) { | |
293 NaClProcessHost* host = new NaClProcessHost( | |
294 GURL(launch_params.manifest_url), | |
295 launch_params.render_view_id, | |
296 launch_params.permission_bits, | |
297 launch_params.uses_irt, | |
298 launch_params.enable_dyncode_syscalls, | |
299 launch_params.enable_exception_handling, | |
300 off_the_record_, | |
301 profile_->GetPath()); | |
302 host->Launch(this, reply_msg, extension_info_map_); | |
303 } | |
304 | |
305 void ChromeRenderMessageFilter::OnGetReadonlyPnaclFd( | |
306 const std::string& filename, IPC::Message* reply_msg) { | |
307 // This posts a task to another thread, but the renderer will | |
308 // block until the reply is sent. | |
309 nacl_file_host::GetReadonlyPnaclFd(this, filename, reply_msg); | |
310 } | |
311 | |
312 void ChromeRenderMessageFilter::OnNaClCreateTemporaryFile( | |
313 IPC::Message* reply_msg) { | |
314 nacl_file_host::CreateTemporaryFile(this, reply_msg); | |
315 } | |
316 | |
317 void ChromeRenderMessageFilter::OnNaClErrorStatus(int render_view_id, | |
318 int error_id) { | |
319 // Currently there is only one kind of error status, for which | |
320 // we want to show the user an infobar. | |
321 ShowNaClInfobar(render_process_id_, render_view_id, error_id); | |
322 } | |
323 | |
324 void ChromeRenderMessageFilter::OnOpenNaClExecutable(int render_view_id, | |
325 const GURL& file_url, | |
326 IPC::Message* reply_msg) { | |
327 nacl_file_host::OpenNaClExecutable(this, extension_info_map_, | |
328 render_view_id, file_url, reply_msg); | |
329 } | |
330 #endif | |
331 | |
332 void ChromeRenderMessageFilter::OnDnsPrefetch( | 279 void ChromeRenderMessageFilter::OnDnsPrefetch( |
333 const std::vector<std::string>& hostnames) { | 280 const std::vector<std::string>& hostnames) { |
334 if (profile_->GetNetworkPredictor()) | 281 if (profile_->GetNetworkPredictor()) |
335 profile_->GetNetworkPredictor()->DnsPrefetchList(hostnames); | 282 profile_->GetNetworkPredictor()->DnsPrefetchList(hostnames); |
336 } | 283 } |
337 | 284 |
338 void ChromeRenderMessageFilter::OnPreconnect(const GURL& url) { | 285 void ChromeRenderMessageFilter::OnPreconnect(const GURL& url) { |
339 if (profile_->GetNetworkPredictor()) | 286 if (profile_->GetNetworkPredictor()) |
340 profile_->GetNetworkPredictor()->PreconnectUrlAndSubresources(url, GURL()); | 287 profile_->GetNetworkPredictor()->PreconnectUrlAndSubresources(url, GURL()); |
341 } | 288 } |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 | 729 |
783 void ChromeRenderMessageFilter::OnSetCookie(const IPC::Message& message, | 730 void ChromeRenderMessageFilter::OnSetCookie(const IPC::Message& message, |
784 const GURL& url, | 731 const GURL& url, |
785 const GURL& first_party_for_cookies, | 732 const GURL& first_party_for_cookies, |
786 const std::string& cookie) { | 733 const std::string& cookie) { |
787 #if defined(ENABLE_AUTOMATION) | 734 #if defined(ENABLE_AUTOMATION) |
788 AutomationResourceMessageFilter::SetCookiesForUrl( | 735 AutomationResourceMessageFilter::SetCookiesForUrl( |
789 render_process_id_, message.routing_id(), url, cookie); | 736 render_process_id_, message.routing_id(), url, cookie); |
790 #endif | 737 #endif |
791 } | 738 } |
OLD | NEW |