| 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 "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 VisitedLinkCommon::Fingerprints pending_; | 235 VisitedLinkCommon::Fingerprints pending_; |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 namespace { | 238 namespace { |
| 239 | 239 |
| 240 // Helper class that we pass to ResourceMessageFilter so that it can find the | 240 // Helper class that we pass to ResourceMessageFilter so that it can find the |
| 241 // right net::URLRequestContext for a request. | 241 // right net::URLRequestContext for a request. |
| 242 class RendererURLRequestContextOverride | 242 class RendererURLRequestContextOverride |
| 243 : public ResourceMessageFilter::URLRequestContextOverride { | 243 : public ResourceMessageFilter::URLRequestContextOverride { |
| 244 public: | 244 public: |
| 245 explicit RendererURLRequestContextOverride(Profile* profile) | 245 RendererURLRequestContextOverride(Profile* profile, |
| 246 : request_context_(profile->GetRequestContext()), | 246 const Extension* installed_app) |
| 247 : request_context_(profile->GetRequestContextForPossibleApp( |
| 248 installed_app)), |
| 247 media_request_context_(profile->GetRequestContextForMedia()) { | 249 media_request_context_(profile->GetRequestContextForMedia()) { |
| 248 } | 250 } |
| 249 | 251 |
| 250 virtual net::URLRequestContext* GetRequestContext( | 252 virtual net::URLRequestContext* GetRequestContext( |
| 251 ResourceType::Type resource_type) { | 253 ResourceType::Type resource_type) { |
| 252 URLRequestContextGetter* request_context = request_context_; | 254 URLRequestContextGetter* request_context = request_context_; |
| 253 // If the request has resource type of ResourceType::MEDIA, we use a request | 255 // If the request has resource type of ResourceType::MEDIA, we use a request |
| 254 // context specific to media for handling it because these resources have | 256 // context specific to media for handling it because these resources have |
| 255 // specific needs for caching. | 257 // specific needs for caching. |
| 256 if (resource_type == ResourceType::MEDIA) | 258 if (resource_type == ResourceType::MEDIA) |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 434 } |
| 433 | 435 |
| 434 return true; | 436 return true; |
| 435 } | 437 } |
| 436 | 438 |
| 437 void BrowserRenderProcessHost::CreateMessageFilters() { | 439 void BrowserRenderProcessHost::CreateMessageFilters() { |
| 438 scoped_refptr<RenderMessageFilter> render_message_filter( | 440 scoped_refptr<RenderMessageFilter> render_message_filter( |
| 439 new RenderMessageFilter(id(), | 441 new RenderMessageFilter(id(), |
| 440 PluginService::GetInstance(), | 442 PluginService::GetInstance(), |
| 441 profile(), | 443 profile(), |
| 444 profile()->GetRequestContextForPossibleApp( |
| 445 installed_app_), |
| 442 widget_helper_)); | 446 widget_helper_)); |
| 443 channel_->AddFilter(render_message_filter); | 447 channel_->AddFilter(render_message_filter); |
| 444 | 448 |
| 445 scoped_refptr<RendererURLRequestContextOverride> url_request_context_override( | 449 scoped_refptr<RendererURLRequestContextOverride> url_request_context_override( |
| 446 new RendererURLRequestContextOverride(profile())); | 450 new RendererURLRequestContextOverride(profile(), installed_app_)); |
| 447 | 451 |
| 448 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 452 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
| 449 id(), ChildProcessInfo::RENDER_PROCESS, | 453 id(), ChildProcessInfo::RENDER_PROCESS, |
| 450 g_browser_process->resource_dispatcher_host()); | 454 g_browser_process->resource_dispatcher_host()); |
| 451 resource_message_filter->set_url_request_context_override( | 455 resource_message_filter->set_url_request_context_override( |
| 452 url_request_context_override); | 456 url_request_context_override); |
| 453 channel_->AddFilter(resource_message_filter); | 457 channel_->AddFilter(resource_message_filter); |
| 454 | 458 |
| 455 channel_->AddFilter(new AudioRendererHost()); | 459 channel_->AddFilter(new AudioRendererHost()); |
| 456 channel_->AddFilter( | 460 channel_->AddFilter( |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 IPC::PlatformFileForTransit file; | 1301 IPC::PlatformFileForTransit file; |
| 1298 #if defined(OS_POSIX) | 1302 #if defined(OS_POSIX) |
| 1299 file = base::FileDescriptor(model_file, false); | 1303 file = base::FileDescriptor(model_file, false); |
| 1300 #elif defined(OS_WIN) | 1304 #elif defined(OS_WIN) |
| 1301 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, | 1305 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, |
| 1302 false, DUPLICATE_SAME_ACCESS); | 1306 false, DUPLICATE_SAME_ACCESS); |
| 1303 #endif | 1307 #endif |
| 1304 Send(new ViewMsg_SetPhishingModel(file)); | 1308 Send(new ViewMsg_SetPhishingModel(file)); |
| 1305 } | 1309 } |
| 1306 } | 1310 } |
| OLD | NEW |