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 #include "content/browser/plugin_process_host.h" | 5 #include "content/browser/plugin_process_host.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 ResourceMessageFilter::GetContextsCallback get_contexts_callback( | 259 ResourceMessageFilter::GetContextsCallback get_contexts_callback( |
260 base::Bind(&PluginProcessHost::GetContexts, | 260 base::Bind(&PluginProcessHost::GetContexts, |
261 base::Unretained(this))); | 261 base::Unretained(this))); |
262 | 262 |
263 // TODO(jam): right now we're passing NULL for appcache, blob storage, and | 263 // TODO(jam): right now we're passing NULL for appcache, blob storage, and |
264 // file system. If NPAPI plugins actually use this, we'll have to plumb them. | 264 // file system. If NPAPI plugins actually use this, we'll have to plumb them. |
265 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 265 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
266 process_->GetData().id, PROCESS_TYPE_PLUGIN, NULL, NULL, NULL, | 266 process_->GetData().id, PROCESS_TYPE_PLUGIN, NULL, NULL, NULL, |
267 get_contexts_callback); | 267 get_contexts_callback); |
268 process_->GetHost()->AddFilter(resource_message_filter); | 268 process_->AddFilter(resource_message_filter); |
269 return true; | 269 return true; |
270 } | 270 } |
271 | 271 |
272 void PluginProcessHost::ForceShutdown() { | 272 void PluginProcessHost::ForceShutdown() { |
273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
274 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); | 274 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); |
275 process_->ForceShutdown(); | 275 process_->ForceShutdown(); |
276 } | 276 } |
277 | 277 |
278 void PluginProcessHost::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { | |
279 process_->GetHost()->AddFilter(filter); | |
280 } | |
281 | |
282 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { | 278 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
283 bool handled = true; | 279 bool handled = true; |
284 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) | 280 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) |
285 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) | 281 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) |
286 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelDestroyed, | 282 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelDestroyed, |
287 OnChannelDestroyed) | 283 OnChannelDestroyed) |
288 #if defined(OS_WIN) | 284 #if defined(OS_WIN) |
289 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, | 285 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, |
290 OnPluginWindowDestroyed) | 286 OnPluginWindowDestroyed) |
291 #endif | 287 #endif |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 415 } |
420 | 416 |
421 void PluginProcessHost::GetContexts(const ResourceHostMsg_Request& request, | 417 void PluginProcessHost::GetContexts(const ResourceHostMsg_Request& request, |
422 ResourceContext** resource_context, | 418 ResourceContext** resource_context, |
423 net::URLRequestContext** request_context) { | 419 net::URLRequestContext** request_context) { |
424 *resource_context = resource_context_map_[request.origin_pid]; | 420 *resource_context = resource_context_map_[request.origin_pid]; |
425 *request_context = (*resource_context)->GetRequestContext(); | 421 *request_context = (*resource_context)->GetRequestContext(); |
426 } | 422 } |
427 | 423 |
428 } // namespace content | 424 } // namespace content |
OLD | NEW |