Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/renderer_host/chrome_render_message_filter.cc

Issue 15906013: Separate NaCl messages from the rest of chrome messages and create a new message filter. This is pa… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 off_the_record_,
300 profile_->GetPath());
301 host->Launch(this, reply_msg, extension_info_map_);
302 }
303
304 void ChromeRenderMessageFilter::OnGetReadonlyPnaclFd(
305 const std::string& filename, IPC::Message* reply_msg) {
306 // This posts a task to another thread, but the renderer will
307 // block until the reply is sent.
308 nacl_file_host::GetReadonlyPnaclFd(this, filename, reply_msg);
309 }
310
311 void ChromeRenderMessageFilter::OnNaClCreateTemporaryFile(
312 IPC::Message* reply_msg) {
313 nacl_file_host::CreateTemporaryFile(this, reply_msg);
314 }
315
316 void ChromeRenderMessageFilter::OnNaClErrorStatus(int render_view_id,
317 int error_id) {
318 // Currently there is only one kind of error status, for which
319 // we want to show the user an infobar.
320 ShowNaClInfobar(render_process_id_, render_view_id, error_id);
321 }
322
323 void ChromeRenderMessageFilter::OnOpenNaClExecutable(int render_view_id,
324 const GURL& file_url,
325 IPC::Message* reply_msg) {
326 nacl_file_host::OpenNaClExecutable(this, extension_info_map_,
327 render_view_id, file_url, reply_msg);
328 }
329 #endif
330
331 void ChromeRenderMessageFilter::OnDnsPrefetch( 279 void ChromeRenderMessageFilter::OnDnsPrefetch(
332 const std::vector<std::string>& hostnames) { 280 const std::vector<std::string>& hostnames) {
333 if (profile_->GetNetworkPredictor()) 281 if (profile_->GetNetworkPredictor())
334 profile_->GetNetworkPredictor()->DnsPrefetchList(hostnames); 282 profile_->GetNetworkPredictor()->DnsPrefetchList(hostnames);
335 } 283 }
336 284
337 void ChromeRenderMessageFilter::OnPreconnect(const GURL& url) { 285 void ChromeRenderMessageFilter::OnPreconnect(const GURL& url) {
338 if (profile_->GetNetworkPredictor()) 286 if (profile_->GetNetworkPredictor())
339 profile_->GetNetworkPredictor()->PreconnectUrlAndSubresources(url, GURL()); 287 profile_->GetNetworkPredictor()->PreconnectUrlAndSubresources(url, GURL());
340 } 288 }
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 729
782 void ChromeRenderMessageFilter::OnSetCookie(const IPC::Message& message, 730 void ChromeRenderMessageFilter::OnSetCookie(const IPC::Message& message,
783 const GURL& url, 731 const GURL& url,
784 const GURL& first_party_for_cookies, 732 const GURL& first_party_for_cookies,
785 const std::string& cookie) { 733 const std::string& cookie) {
786 #if defined(ENABLE_AUTOMATION) 734 #if defined(ENABLE_AUTOMATION)
787 AutomationResourceMessageFilter::SetCookiesForUrl( 735 AutomationResourceMessageFilter::SetCookiesForUrl(
788 render_process_id_, message.routing_id(), url, cookie); 736 render_process_id_, message.routing_id(), url, cookie);
789 #endif 737 #endif
790 } 738 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698