| 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 // 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) | 10 #if defined(OS_WIN) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 #include "webkit/glue/resource_type.h" | 107 #include "webkit/glue/resource_type.h" |
| 108 #include "webkit/plugins/plugin_switches.h" | 108 #include "webkit/plugins/plugin_switches.h" |
| 109 | 109 |
| 110 #if defined(OS_WIN) | 110 #if defined(OS_WIN) |
| 111 #include "base/synchronization/waitable_event.h" | 111 #include "base/synchronization/waitable_event.h" |
| 112 #include "content/common/font_cache_dispatcher_win.h" | 112 #include "content/common/font_cache_dispatcher_win.h" |
| 113 #endif | 113 #endif |
| 114 | 114 |
| 115 #include "third_party/skia/include/core/SkBitmap.h" | 115 #include "third_party/skia/include/core/SkBitmap.h" |
| 116 | 116 |
| 117 using content::BrowserContext; |
| 117 using content::BrowserMessageFilter; | 118 using content::BrowserMessageFilter; |
| 118 using content::BrowserThread; | 119 using content::BrowserThread; |
| 119 using content::ChildProcessHost; | 120 using content::ChildProcessHost; |
| 120 using content::ChildProcessHostImpl; | 121 using content::ChildProcessHostImpl; |
| 121 using content::UserMetricsAction; | 122 using content::UserMetricsAction; |
| 122 using content::WebUIControllerFactory; | 123 using content::WebUIControllerFactory; |
| 123 | 124 |
| 124 extern bool g_exited_main_message_loop; | 125 extern bool g_exited_main_message_loop; |
| 125 | 126 |
| 126 // This class creates the IO thread for the renderer when running in | 127 // This class creates the IO thread for the renderer when running in |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 454 |
| 454 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 455 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
| 455 GetID(), content::PROCESS_TYPE_RENDERER, resource_context, | 456 GetID(), content::PROCESS_TYPE_RENDERER, resource_context, |
| 456 new RendererURLRequestContextSelector(browser_context, GetID())); | 457 new RendererURLRequestContextSelector(browser_context, GetID())); |
| 457 | 458 |
| 458 channel_->AddFilter(resource_message_filter); | 459 channel_->AddFilter(resource_message_filter); |
| 459 channel_->AddFilter(new AudioInputRendererHost(resource_context)); | 460 channel_->AddFilter(new AudioInputRendererHost(resource_context)); |
| 460 channel_->AddFilter(new AudioRendererHost(resource_context)); | 461 channel_->AddFilter(new AudioRendererHost(resource_context)); |
| 461 channel_->AddFilter(new VideoCaptureHost(resource_context)); | 462 channel_->AddFilter(new VideoCaptureHost(resource_context)); |
| 462 channel_->AddFilter(new AppCacheDispatcherHost( | 463 channel_->AddFilter(new AppCacheDispatcherHost( |
| 463 browser_context->GetAppCacheService(), GetID())); | 464 BrowserContext::GetAppCacheService(browser_context), GetID())); |
| 464 channel_->AddFilter(new ClipboardMessageFilter()); | 465 channel_->AddFilter(new ClipboardMessageFilter()); |
| 465 channel_->AddFilter(new DOMStorageMessageFilter(GetID(), | 466 channel_->AddFilter(new DOMStorageMessageFilter(GetID(), |
| 466 browser_context->GetWebKitContext())); | 467 BrowserContext::GetWebKitContext(browser_context))); |
| 467 channel_->AddFilter(new IndexedDBDispatcherHost(GetID(), | 468 channel_->AddFilter(new IndexedDBDispatcherHost(GetID(), |
| 468 browser_context->GetWebKitContext())); | 469 BrowserContext::GetWebKitContext(browser_context))); |
| 469 channel_->AddFilter(GeolocationDispatcherHost::New( | 470 channel_->AddFilter(GeolocationDispatcherHost::New( |
| 470 GetID(), browser_context->GetGeolocationPermissionContext())); | 471 GetID(), browser_context->GetGeolocationPermissionContext())); |
| 471 channel_->AddFilter(new GpuMessageFilter(GetID(), widget_helper_.get())); | 472 channel_->AddFilter(new GpuMessageFilter(GetID(), widget_helper_.get())); |
| 472 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost( | 473 channel_->AddFilter(new media_stream::MediaStreamDispatcherHost( |
| 473 resource_context, GetID())); | 474 resource_context, GetID())); |
| 474 channel_->AddFilter(new PepperFileMessageFilter(GetID(), browser_context)); | 475 channel_->AddFilter(new PepperFileMessageFilter(GetID(), browser_context)); |
| 475 channel_->AddFilter(new PepperMessageFilter(PepperMessageFilter::RENDERER, | 476 channel_->AddFilter(new PepperMessageFilter(PepperMessageFilter::RENDERER, |
| 476 GetID(), resource_context)); | 477 GetID(), resource_context)); |
| 477 channel_->AddFilter(new speech_input::SpeechInputDispatcherHost( | 478 channel_->AddFilter(new speech_input::SpeechInputDispatcherHost( |
| 478 GetID(), browser_context->GetRequestContext(), | 479 GetID(), browser_context->GetRequestContext(), |
| 479 browser_context->GetSpeechInputPreferences(), resource_context)); | 480 browser_context->GetSpeechInputPreferences(), resource_context)); |
| 480 channel_->AddFilter(new FileSystemDispatcherHost( | 481 channel_->AddFilter(new FileSystemDispatcherHost( |
| 481 browser_context->GetRequestContext(), | 482 browser_context->GetRequestContext(), |
| 482 browser_context->GetFileSystemContext())); | 483 BrowserContext::GetFileSystemContext(browser_context))); |
| 483 channel_->AddFilter(new device_orientation::MessageFilter()); | 484 channel_->AddFilter(new device_orientation::MessageFilter()); |
| 484 channel_->AddFilter(new BlobMessageFilter(GetID(), | 485 channel_->AddFilter(new BlobMessageFilter(GetID(), |
| 485 browser_context->GetBlobStorageContext())); | 486 BrowserContext::GetBlobStorageContext(browser_context))); |
| 486 channel_->AddFilter(new FileUtilitiesMessageFilter(GetID())); | 487 channel_->AddFilter(new FileUtilitiesMessageFilter(GetID())); |
| 487 channel_->AddFilter(new MimeRegistryMessageFilter()); | 488 channel_->AddFilter(new MimeRegistryMessageFilter()); |
| 488 channel_->AddFilter(new DatabaseMessageFilter( | 489 channel_->AddFilter(new DatabaseMessageFilter( |
| 489 browser_context->GetDatabaseTracker())); | 490 BrowserContext::GetDatabaseTracker(browser_context))); |
| 490 #if defined(OS_MACOSX) | 491 #if defined(OS_MACOSX) |
| 491 channel_->AddFilter(new TextInputClientMessageFilter(GetID())); | 492 channel_->AddFilter(new TextInputClientMessageFilter(GetID())); |
| 492 #elif defined(OS_WIN) | 493 #elif defined(OS_WIN) |
| 493 channel_->AddFilter(new FontCacheDispatcher()); | 494 channel_->AddFilter(new FontCacheDispatcher()); |
| 494 #endif | 495 #endif |
| 495 | 496 |
| 496 SocketStreamDispatcherHost* socket_stream_dispatcher_host = | 497 SocketStreamDispatcherHost* socket_stream_dispatcher_host = |
| 497 new SocketStreamDispatcherHost( | 498 new SocketStreamDispatcherHost( |
| 498 new RendererURLRequestContextSelector(browser_context, GetID()), | 499 new RendererURLRequestContextSelector(browser_context, GetID()), |
| 499 resource_context); | 500 resource_context); |
| 500 channel_->AddFilter(socket_stream_dispatcher_host); | 501 channel_->AddFilter(socket_stream_dispatcher_host); |
| 501 | 502 |
| 502 channel_->AddFilter(new WorkerMessageFilter(GetID(), resource_context, | 503 channel_->AddFilter(new WorkerMessageFilter(GetID(), resource_context, |
| 503 base::Bind(&RenderWidgetHelper::GetNextRoutingID, | 504 base::Bind(&RenderWidgetHelper::GetNextRoutingID, |
| 504 base::Unretained(widget_helper_.get())))); | 505 base::Unretained(widget_helper_.get())))); |
| 505 | 506 |
| 506 #if defined(ENABLE_P2P_APIS) | 507 #if defined(ENABLE_P2P_APIS) |
| 507 channel_->AddFilter(new content::P2PSocketDispatcherHost(resource_context)); | 508 channel_->AddFilter(new content::P2PSocketDispatcherHost(resource_context)); |
| 508 #endif | 509 #endif |
| 509 | 510 |
| 510 channel_->AddFilter(new TraceMessageFilter()); | 511 channel_->AddFilter(new TraceMessageFilter()); |
| 511 channel_->AddFilter(new ResolveProxyMsgHelper( | 512 channel_->AddFilter(new ResolveProxyMsgHelper( |
| 512 browser_context->GetRequestContextForRenderProcess(GetID()))); | 513 browser_context->GetRequestContextForRenderProcess(GetID()))); |
| 513 channel_->AddFilter(new QuotaDispatcherHost(GetID(), | 514 channel_->AddFilter(new QuotaDispatcherHost( |
| 514 browser_context->GetQuotaManager(), | 515 GetID(), |
| 516 content::BrowserContext::GetQuotaManager(browser_context), |
| 515 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); | 517 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); |
| 516 channel_->AddFilter(new content::GamepadBrowserMessageFilter(this)); | 518 channel_->AddFilter(new content::GamepadBrowserMessageFilter(this)); |
| 517 channel_->AddFilter(new ProfilerMessageFilter()); | 519 channel_->AddFilter(new ProfilerMessageFilter()); |
| 518 } | 520 } |
| 519 | 521 |
| 520 int RenderProcessHostImpl::GetNextRoutingID() { | 522 int RenderProcessHostImpl::GetNextRoutingID() { |
| 521 return widget_helper_->GetNextRoutingID(); | 523 return widget_helper_->GetNextRoutingID(); |
| 522 } | 524 } |
| 523 | 525 |
| 524 void RenderProcessHostImpl::CancelResourceRequests(int render_widget_id) { | 526 void RenderProcessHostImpl::CancelResourceRequests(int render_widget_id) { |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 // Only honor the request if appropriate persmissions are granted. | 1294 // Only honor the request if appropriate persmissions are granted. |
| 1293 if (ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(GetID(), | 1295 if (ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(GetID(), |
| 1294 path)) | 1296 path)) |
| 1295 content::GetContentClient()->browser()->OpenItem(path); | 1297 content::GetContentClient()->browser()->OpenItem(path); |
| 1296 } | 1298 } |
| 1297 | 1299 |
| 1298 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1300 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
| 1299 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1301 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
| 1300 MHTMLGenerated(job_id, data_size); | 1302 MHTMLGenerated(job_id, data_size); |
| 1301 } | 1303 } |
| OLD | NEW |