Chromium Code Reviews| 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/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | |
| 11 #include <objbase.h> // For CoInitialize/CoUninitialize. | |
| 12 #endif | |
| 13 | |
| 10 #include <algorithm> | 14 #include <algorithm> |
| 11 #include <limits> | 15 #include <limits> |
| 12 #include <vector> | 16 #include <vector> |
| 13 | 17 |
| 14 #if defined(OS_POSIX) | 18 #if defined(OS_POSIX) |
| 15 #include <utility> // for pair<> | 19 #include <utility> // for pair<> |
| 16 #endif | 20 #endif |
| 17 | 21 |
| 18 #include "base/base_switches.h" | 22 #include "base/base_switches.h" |
| 19 #include "base/bind.h" | 23 #include "base/bind.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 #include "content/browser/renderer_host/quota_dispatcher_host.h" | 70 #include "content/browser/renderer_host/quota_dispatcher_host.h" |
| 67 #include "content/browser/renderer_host/render_message_filter.h" | 71 #include "content/browser/renderer_host/render_message_filter.h" |
| 68 #include "content/browser/renderer_host/render_view_host.h" | 72 #include "content/browser/renderer_host/render_view_host.h" |
| 69 #include "content/browser/renderer_host/render_view_host_delegate.h" | 73 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 70 #include "content/browser/renderer_host/render_widget_helper.h" | 74 #include "content/browser/renderer_host/render_widget_helper.h" |
| 71 #include "content/browser/renderer_host/render_widget_host.h" | 75 #include "content/browser/renderer_host/render_widget_host.h" |
| 72 #include "content/browser/renderer_host/resource_message_filter.h" | 76 #include "content/browser/renderer_host/resource_message_filter.h" |
| 73 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 77 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
| 74 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 78 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
| 75 #include "content/browser/resolve_proxy_msg_helper.h" | 79 #include "content/browser/resolve_proxy_msg_helper.h" |
| 80 #include "content/browser/resource_context.h" | |
| 76 #include "content/browser/speech/speech_input_dispatcher_host.h" | 81 #include "content/browser/speech/speech_input_dispatcher_host.h" |
| 77 #include "content/browser/trace_message_filter.h" | 82 #include "content/browser/trace_message_filter.h" |
| 78 #include "content/browser/user_metrics.h" | 83 #include "content/browser/user_metrics.h" |
| 79 #include "content/browser/webui/web_ui_factory.h" | 84 #include "content/browser/webui/web_ui_factory.h" |
| 80 #include "content/browser/worker_host/worker_message_filter.h" | 85 #include "content/browser/worker_host/worker_message_filter.h" |
| 81 #include "content/common/child_process_host_impl.h" | 86 #include "content/common/child_process_host_impl.h" |
| 82 #include "content/common/child_process_messages.h" | 87 #include "content/common/child_process_messages.h" |
| 83 #include "content/common/gpu/gpu_messages.h" | 88 #include "content/common/gpu/gpu_messages.h" |
| 84 #include "content/public/browser/notification_service.h" | 89 #include "content/public/browser/notification_service.h" |
| 85 #include "content/common/resource_messages.h" | 90 #include "content/common/resource_messages.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 97 #include "media/base/media_switches.h" | 102 #include "media/base/media_switches.h" |
| 98 #include "net/url_request/url_request_context_getter.h" | 103 #include "net/url_request/url_request_context_getter.h" |
| 99 #include "ui/base/ui_base_switches.h" | 104 #include "ui/base/ui_base_switches.h" |
| 100 #include "ui/gfx/gl/gl_switches.h" | 105 #include "ui/gfx/gl/gl_switches.h" |
| 101 #include "webkit/fileapi/file_system_path_manager.h" | 106 #include "webkit/fileapi/file_system_path_manager.h" |
| 102 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 107 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 103 #include "webkit/glue/resource_type.h" | 108 #include "webkit/glue/resource_type.h" |
| 104 #include "webkit/plugins/plugin_switches.h" | 109 #include "webkit/plugins/plugin_switches.h" |
| 105 | 110 |
| 106 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
| 107 #include <objbase.h> | |
| 108 #include "base/synchronization/waitable_event.h" | 112 #include "base/synchronization/waitable_event.h" |
| 109 #include "content/common/font_cache_dispatcher_win.h" | 113 #include "content/common/font_cache_dispatcher_win.h" |
| 110 #endif | 114 #endif |
| 111 | 115 |
| 112 #include "third_party/skia/include/core/SkBitmap.h" | 116 #include "third_party/skia/include/core/SkBitmap.h" |
| 113 | 117 |
| 114 using content::BrowserThread; | 118 using content::BrowserThread; |
| 115 using content::ChildProcessHost; | 119 using content::ChildProcessHost; |
| 116 using content::ChildProcessHostImpl; | 120 using content::ChildProcessHostImpl; |
| 117 | 121 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 | 457 |
| 454 void RenderProcessHostImpl::CreateMessageFilters() { | 458 void RenderProcessHostImpl::CreateMessageFilters() { |
| 455 scoped_refptr<RenderMessageFilter> render_message_filter( | 459 scoped_refptr<RenderMessageFilter> render_message_filter( |
| 456 new RenderMessageFilter( | 460 new RenderMessageFilter( |
| 457 GetID(), | 461 GetID(), |
| 458 PluginService::GetInstance(), | 462 PluginService::GetInstance(), |
| 459 GetBrowserContext(), | 463 GetBrowserContext(), |
| 460 GetBrowserContext()->GetRequestContextForRenderProcess(GetID()), | 464 GetBrowserContext()->GetRequestContextForRenderProcess(GetID()), |
| 461 widget_helper_)); | 465 widget_helper_)); |
| 462 channel_->AddFilter(render_message_filter); | 466 channel_->AddFilter(render_message_filter); |
| 467 content::BrowserContext* browser_context = GetBrowserContext(); | |
| 468 const content::ResourceContext* resource_context = | |
| 469 &browser_context->GetResourceContext(); | |
| 463 | 470 |
| 464 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 471 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
| 465 GetID(), content::PROCESS_TYPE_RENDERER, | 472 GetID(), content::PROCESS_TYPE_RENDERER, |
| 466 &GetBrowserContext()->GetResourceContext(), | 473 resource_context, |
| 467 new RendererURLRequestContextSelector(GetBrowserContext(), GetID()), | 474 new RendererURLRequestContextSelector(browser_context, GetID()), |
| 468 content::GetContentClient()->browser()->GetResourceDispatcherHost()); | 475 content::GetContentClient()->browser()->GetResourceDispatcherHost()); |
| 469 | 476 |
| 470 channel_->AddFilter(resource_message_filter); | 477 channel_->AddFilter(resource_message_filter); |
| 471 channel_->AddFilter(new AudioInputRendererHost( | 478 channel_->AddFilter(new AudioInputRendererHost( |
|
Avi (use Gerrit)
2011/12/06 15:22:59
unwrap this and subsequent lines where wrapping is
tommi (sloooow) - chröme
2011/12/06 15:48:21
Done.
| |
| 472 &GetBrowserContext()->GetResourceContext())); | 479 resource_context)); |
| 480 channel_->AddFilter(new AudioRendererHost(resource_context)); | |
| 473 channel_->AddFilter( | 481 channel_->AddFilter( |
| 474 new AudioRendererHost(&GetBrowserContext()->GetResourceContext())); | 482 new VideoCaptureHost(resource_context)); |
| 475 channel_->AddFilter( | 483 channel_->AddFilter( |
| 476 new VideoCaptureHost(&GetBrowserContext()->GetResourceContext())); | 484 new AppCacheDispatcherHost(browser_context->GetAppCacheService(), |
| 477 channel_->AddFilter( | |
| 478 new AppCacheDispatcherHost(GetBrowserContext()->GetAppCacheService(), | |
| 479 GetID())); | 485 GetID())); |
| 480 channel_->AddFilter(new ClipboardMessageFilter()); | 486 channel_->AddFilter(new ClipboardMessageFilter()); |
| 481 channel_->AddFilter( | 487 channel_->AddFilter( |
| 482 new DOMStorageMessageFilter(GetID(), | 488 new DOMStorageMessageFilter(GetID(), |
| 483 GetBrowserContext()->GetWebKitContext())); | 489 browser_context->GetWebKitContext())); |
| 484 channel_->AddFilter( | 490 channel_->AddFilter( |
| 485 new IndexedDBDispatcherHost(GetID(), | 491 new IndexedDBDispatcherHost(GetID(), |
| 486 GetBrowserContext()->GetWebKitContext())); | 492 browser_context->GetWebKitContext())); |
| 487 channel_->AddFilter( | 493 channel_->AddFilter( |
| 488 GeolocationDispatcherHost::New( | 494 GeolocationDispatcherHost::New( |
| 489 GetID(), GetBrowserContext()->GetGeolocationPermissionContext())); | 495 GetID(), browser_context->GetGeolocationPermissionContext())); |
| 490 channel_->AddFilter(new GpuMessageFilter(GetID(), widget_helper_.get())); | 496 channel_->AddFilter(new GpuMessageFilter(GetID(), widget_helper_.get())); |
| 491 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost( | 497 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost( |
| 492 &GetBrowserContext()->GetResourceContext(), GetID())); | 498 resource_context, GetID())); |
| 493 channel_->AddFilter(new PepperFileMessageFilter(GetID(), | 499 channel_->AddFilter(new PepperFileMessageFilter(GetID(), |
| 494 GetBrowserContext())); | 500 browser_context)); |
| 495 channel_->AddFilter( | 501 channel_->AddFilter( |
| 496 new PepperMessageFilter(&GetBrowserContext()->GetResourceContext())); | 502 new PepperMessageFilter(resource_context)); |
| 497 channel_->AddFilter(new speech_input::SpeechInputDispatcherHost( | 503 channel_->AddFilter(new speech_input::SpeechInputDispatcherHost( |
| 498 GetID(), GetBrowserContext()->GetRequestContext(), | 504 GetID(), browser_context->GetRequestContext(), |
| 499 GetBrowserContext()->GetSpeechInputPreferences())); | 505 browser_context->GetSpeechInputPreferences(), |
| 506 resource_context->audio_manager())); | |
| 500 channel_->AddFilter( | 507 channel_->AddFilter( |
| 501 new FileSystemDispatcherHost( | 508 new FileSystemDispatcherHost( |
| 502 GetBrowserContext()->GetRequestContext(), | 509 browser_context->GetRequestContext(), |
| 503 GetBrowserContext()->GetFileSystemContext())); | 510 browser_context->GetFileSystemContext())); |
| 504 channel_->AddFilter(new device_orientation::MessageFilter()); | 511 channel_->AddFilter(new device_orientation::MessageFilter()); |
| 505 channel_->AddFilter( | 512 channel_->AddFilter( |
| 506 new BlobMessageFilter(GetID(), | 513 new BlobMessageFilter(GetID(), |
| 507 GetBrowserContext()->GetBlobStorageContext())); | 514 browser_context->GetBlobStorageContext())); |
| 508 channel_->AddFilter(new FileUtilitiesMessageFilter(GetID())); | 515 channel_->AddFilter(new FileUtilitiesMessageFilter(GetID())); |
| 509 channel_->AddFilter(new MimeRegistryMessageFilter()); | 516 channel_->AddFilter(new MimeRegistryMessageFilter()); |
| 510 channel_->AddFilter(new DatabaseMessageFilter( | 517 channel_->AddFilter(new DatabaseMessageFilter( |
| 511 GetBrowserContext()->GetDatabaseTracker())); | 518 browser_context->GetDatabaseTracker())); |
| 512 #if defined(OS_MACOSX) | 519 #if defined(OS_MACOSX) |
| 513 channel_->AddFilter(new TextInputClientMessageFilter(GetID())); | 520 channel_->AddFilter(new TextInputClientMessageFilter(GetID())); |
| 514 #elif defined(OS_WIN) | 521 #elif defined(OS_WIN) |
| 515 channel_->AddFilter(new FontCacheDispatcher()); | 522 channel_->AddFilter(new FontCacheDispatcher()); |
| 516 #endif | 523 #endif |
| 517 | 524 |
| 518 SocketStreamDispatcherHost* socket_stream_dispatcher_host = | 525 SocketStreamDispatcherHost* socket_stream_dispatcher_host = |
| 519 new SocketStreamDispatcherHost( | 526 new SocketStreamDispatcherHost( |
| 520 new RendererURLRequestContextSelector(GetBrowserContext(), GetID()), | 527 new RendererURLRequestContextSelector(browser_context, GetID()), |
| 521 &GetBrowserContext()->GetResourceContext()); | 528 resource_context); |
| 522 channel_->AddFilter(socket_stream_dispatcher_host); | 529 channel_->AddFilter(socket_stream_dispatcher_host); |
| 523 | 530 |
| 524 channel_->AddFilter( | 531 channel_->AddFilter( |
| 525 new WorkerMessageFilter( | 532 new WorkerMessageFilter( |
| 526 GetID(), | 533 GetID(), |
| 527 &GetBrowserContext()->GetResourceContext(), | 534 resource_context, |
| 528 content::GetContentClient()->browser()->GetResourceDispatcherHost(), | 535 content::GetContentClient()->browser()->GetResourceDispatcherHost(), |
| 529 base::Bind(&RenderWidgetHelper::GetNextRoutingID, | 536 base::Bind(&RenderWidgetHelper::GetNextRoutingID, |
| 530 base::Unretained(widget_helper_.get())))); | 537 base::Unretained(widget_helper_.get())))); |
| 531 | 538 |
| 532 #if defined(ENABLE_P2P_APIS) | 539 #if defined(ENABLE_P2P_APIS) |
| 533 channel_->AddFilter(new content::P2PSocketDispatcherHost( | 540 channel_->AddFilter(new content::P2PSocketDispatcherHost( |
| 534 &GetBrowserContext()->GetResourceContext())); | 541 resource_context)); |
| 535 #endif | 542 #endif |
| 536 | 543 |
| 537 channel_->AddFilter(new TraceMessageFilter()); | 544 channel_->AddFilter(new TraceMessageFilter()); |
| 538 channel_->AddFilter(new ResolveProxyMsgHelper( | 545 channel_->AddFilter(new ResolveProxyMsgHelper( |
| 539 GetBrowserContext()->GetRequestContextForRenderProcess(GetID()))); | 546 browser_context->GetRequestContextForRenderProcess(GetID()))); |
| 540 channel_->AddFilter(new QuotaDispatcherHost( | 547 channel_->AddFilter(new QuotaDispatcherHost( |
| 541 GetID(), GetBrowserContext()->GetQuotaManager(), | 548 GetID(), browser_context->GetQuotaManager(), |
| 542 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); | 549 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); |
| 543 channel_->AddFilter(new content::GamepadBrowserMessageFilter(this)); | 550 channel_->AddFilter(new content::GamepadBrowserMessageFilter(this)); |
| 544 channel_->AddFilter(new ProfilerMessageFilter()); | 551 channel_->AddFilter(new ProfilerMessageFilter()); |
| 545 } | 552 } |
| 546 | 553 |
| 547 int RenderProcessHostImpl::GetNextRoutingID() { | 554 int RenderProcessHostImpl::GetNextRoutingID() { |
| 548 return widget_helper_->GetNextRoutingID(); | 555 return widget_helper_->GetNextRoutingID(); |
| 549 } | 556 } |
| 550 | 557 |
| 551 void RenderProcessHostImpl::UpdateAndSendMaxPageID(int32 page_id) { | 558 void RenderProcessHostImpl::UpdateAndSendMaxPageID(int32 page_id) { |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1322 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1329 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
| 1323 // Only honor the request if appropriate persmissions are granted. | 1330 // Only honor the request if appropriate persmissions are granted. |
| 1324 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1331 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
| 1325 content::GetContentClient()->browser()->OpenItem(path); | 1332 content::GetContentClient()->browser()->OpenItem(path); |
| 1326 } | 1333 } |
| 1327 | 1334 |
| 1328 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1335 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
| 1329 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1336 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
| 1330 MHTMLGenerated(job_id, data_size); | 1337 MHTMLGenerated(job_id, data_size); |
| 1331 } | 1338 } |
| OLD | NEW |