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