OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/browser_render_process_host.h" | 8 #include "content/browser/renderer_host/browser_render_process_host.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 }; | 241 }; |
242 | 242 |
243 namespace { | 243 namespace { |
244 | 244 |
245 // Helper class that we pass to ResourceMessageFilter so that it can find the | 245 // Helper class that we pass to ResourceMessageFilter so that it can find the |
246 // right net::URLRequestContext for a request. | 246 // right net::URLRequestContext for a request. |
247 class RendererURLRequestContextSelector | 247 class RendererURLRequestContextSelector |
248 : public ResourceMessageFilter::URLRequestContextSelector { | 248 : public ResourceMessageFilter::URLRequestContextSelector { |
249 public: | 249 public: |
250 RendererURLRequestContextSelector(Profile* profile, | 250 RendererURLRequestContextSelector(Profile* profile, |
251 const Extension* installed_app) | 251 int render_child_id) |
252 : request_context_(profile->GetRequestContextForPossibleApp( | 252 : request_context_(profile->GetRequestContextForRenderProcess( |
253 installed_app)), | 253 render_child_id)), |
254 media_request_context_(profile->GetRequestContextForMedia()) { | 254 media_request_context_(profile->GetRequestContextForMedia()) { |
255 } | 255 } |
256 | 256 |
257 virtual net::URLRequestContext* GetRequestContext( | 257 virtual net::URLRequestContext* GetRequestContext( |
258 ResourceType::Type resource_type) { | 258 ResourceType::Type resource_type) { |
259 net::URLRequestContextGetter* request_context = request_context_; | 259 net::URLRequestContextGetter* request_context = request_context_; |
260 // If the request has resource type of ResourceType::MEDIA, we use a request | 260 // If the request has resource type of ResourceType::MEDIA, we use a request |
261 // context specific to media for handling it because these resources have | 261 // context specific to media for handling it because these resources have |
262 // specific needs for caching. | 262 // specific needs for caching. |
263 if (resource_type == ResourceType::MEDIA) | 263 if (resource_type == ResourceType::MEDIA) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 this)); | 438 this)); |
439 | 439 |
440 fast_shutdown_started_ = false; | 440 fast_shutdown_started_ = false; |
441 } | 441 } |
442 | 442 |
443 return true; | 443 return true; |
444 } | 444 } |
445 | 445 |
446 void BrowserRenderProcessHost::CreateMessageFilters() { | 446 void BrowserRenderProcessHost::CreateMessageFilters() { |
447 scoped_refptr<RenderMessageFilter> render_message_filter( | 447 scoped_refptr<RenderMessageFilter> render_message_filter( |
448 new RenderMessageFilter(id(), | 448 new RenderMessageFilter( |
449 PluginService::GetInstance(), | 449 id(), |
450 profile(), | 450 PluginService::GetInstance(), |
451 profile()->GetRequestContextForPossibleApp( | 451 profile(), |
452 installed_app_), | 452 profile()->GetRequestContextForRenderProcess(id()), |
453 widget_helper_)); | 453 widget_helper_)); |
454 channel_->AddFilter(render_message_filter); | 454 channel_->AddFilter(render_message_filter); |
455 | 455 |
456 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 456 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
457 id(), ChildProcessInfo::RENDER_PROCESS, | 457 id(), ChildProcessInfo::RENDER_PROCESS, |
458 &profile()->GetResourceContext(), | 458 &profile()->GetResourceContext(), |
459 new RendererURLRequestContextSelector(profile(), installed_app_), | 459 new RendererURLRequestContextSelector(profile(), id()), |
460 g_browser_process->resource_dispatcher_host()); | 460 g_browser_process->resource_dispatcher_host()); |
461 | 461 |
462 channel_->AddFilter(resource_message_filter); | 462 channel_->AddFilter(resource_message_filter); |
463 channel_->AddFilter(new AudioInputRendererHost()); | 463 channel_->AddFilter(new AudioInputRendererHost()); |
464 channel_->AddFilter(new AudioRendererHost()); | 464 channel_->AddFilter(new AudioRendererHost()); |
465 channel_->AddFilter( | 465 channel_->AddFilter( |
466 new AppCacheDispatcherHost(&profile()->GetResourceContext(), id())); | 466 new AppCacheDispatcherHost(&profile()->GetResourceContext(), id())); |
467 channel_->AddFilter(new ClipboardMessageFilter()); | 467 channel_->AddFilter(new ClipboardMessageFilter()); |
468 channel_->AddFilter( | 468 channel_->AddFilter( |
469 new DOMStorageMessageFilter(id(), profile()->GetWebKitContext(), | 469 new DOMStorageMessageFilter(id(), profile()->GetWebKitContext(), |
(...skipping 15 matching lines...) Expand all Loading... |
485 channel_->AddFilter(new device_orientation::MessageFilter()); | 485 channel_->AddFilter(new device_orientation::MessageFilter()); |
486 channel_->AddFilter( | 486 channel_->AddFilter( |
487 new BlobMessageFilter(id(), profile()->GetBlobStorageContext())); | 487 new BlobMessageFilter(id(), profile()->GetBlobStorageContext())); |
488 channel_->AddFilter(new FileUtilitiesMessageFilter(id())); | 488 channel_->AddFilter(new FileUtilitiesMessageFilter(id())); |
489 channel_->AddFilter(new MimeRegistryMessageFilter()); | 489 channel_->AddFilter(new MimeRegistryMessageFilter()); |
490 channel_->AddFilter(new DatabaseMessageFilter( | 490 channel_->AddFilter(new DatabaseMessageFilter( |
491 profile()->GetDatabaseTracker(), profile()->GetHostContentSettingsMap())); | 491 profile()->GetDatabaseTracker(), profile()->GetHostContentSettingsMap())); |
492 | 492 |
493 SocketStreamDispatcherHost* socket_stream_dispatcher_host = | 493 SocketStreamDispatcherHost* socket_stream_dispatcher_host = |
494 new SocketStreamDispatcherHost( | 494 new SocketStreamDispatcherHost( |
495 new RendererURLRequestContextSelector(profile(), installed_app_)); | 495 new RendererURLRequestContextSelector(profile(), id())); |
496 channel_->AddFilter(socket_stream_dispatcher_host); | 496 channel_->AddFilter(socket_stream_dispatcher_host); |
497 | 497 |
498 channel_->AddFilter( | 498 channel_->AddFilter( |
499 new WorkerMessageFilter( | 499 new WorkerMessageFilter( |
500 id(), | 500 id(), |
501 &profile()->GetResourceContext(), | 501 &profile()->GetResourceContext(), |
502 g_browser_process->resource_dispatcher_host(), | 502 g_browser_process->resource_dispatcher_host(), |
503 NewCallbackWithReturnValue( | 503 NewCallbackWithReturnValue( |
504 widget_helper_.get(), &RenderWidgetHelper::GetNextRoutingID))); | 504 widget_helper_.get(), &RenderWidgetHelper::GetNextRoutingID))); |
505 | 505 |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 IPC::PlatformFileForTransit file; | 1315 IPC::PlatformFileForTransit file; |
1316 #if defined(OS_POSIX) | 1316 #if defined(OS_POSIX) |
1317 file = base::FileDescriptor(model_file, false); | 1317 file = base::FileDescriptor(model_file, false); |
1318 #elif defined(OS_WIN) | 1318 #elif defined(OS_WIN) |
1319 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, | 1319 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, |
1320 false, DUPLICATE_SAME_ACCESS); | 1320 false, DUPLICATE_SAME_ACCESS); |
1321 #endif | 1321 #endif |
1322 Send(new SafeBrowsingMsg_SetPhishingModel(file)); | 1322 Send(new SafeBrowsingMsg_SetPhishingModel(file)); |
1323 } | 1323 } |
1324 } | 1324 } |
OLD | NEW |