| 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/renderer/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 permissions, | 422 permissions, |
| 423 channel_handle, | 423 channel_handle, |
| 424 peer_pid, | 424 peer_pid, |
| 425 plugin_child_id, | 425 plugin_child_id, |
| 426 false)) // is_external = false | 426 false)) // is_external = false |
| 427 return scoped_refptr<webkit::ppapi::PluginModule>(); | 427 return scoped_refptr<webkit::ppapi::PluginModule>(); |
| 428 | 428 |
| 429 return module; | 429 return module; |
| 430 } | 430 } |
| 431 | 431 |
| 432 RendererPpapiHost* PepperPluginDelegateImpl::CreateExternalPluginModule( | |
| 433 scoped_refptr<webkit::ppapi::PluginModule> module, | |
| 434 const base::FilePath& path, | |
| 435 ppapi::PpapiPermissions permissions, | |
| 436 const IPC::ChannelHandle& channel_handle, | |
| 437 base::ProcessId peer_pid, | |
| 438 int plugin_child_id) { | |
| 439 // We don't call PepperPluginRegistry::AddLiveModule, as this module is | |
| 440 // managed externally. | |
| 441 return CreateOutOfProcessModule(module.get(), | |
| 442 path, | |
| 443 permissions, | |
| 444 channel_handle, | |
| 445 peer_pid, | |
| 446 plugin_child_id, | |
| 447 true); // is_external = true | |
| 448 } | |
| 449 | |
| 450 scoped_refptr<PepperBrokerImpl> PepperPluginDelegateImpl::CreateBroker( | 432 scoped_refptr<PepperBrokerImpl> PepperPluginDelegateImpl::CreateBroker( |
| 451 webkit::ppapi::PluginModule* plugin_module) { | 433 webkit::ppapi::PluginModule* plugin_module) { |
| 452 DCHECK(plugin_module); | 434 DCHECK(plugin_module); |
| 453 DCHECK(!plugin_module->GetBroker()); | 435 DCHECK(!plugin_module->GetBroker()); |
| 454 | 436 |
| 455 // The broker path is the same as the plugin. | 437 // The broker path is the same as the plugin. |
| 456 const base::FilePath& broker_path = plugin_module->path(); | 438 const base::FilePath& broker_path = plugin_module->path(); |
| 457 | 439 |
| 458 scoped_refptr<PepperBrokerImpl> broker = | 440 scoped_refptr<PepperBrokerImpl> broker = |
| 459 new PepperBrokerImpl(plugin_module, this); | 441 new PepperBrokerImpl(plugin_module, this); |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 } else { | 1337 } else { |
| 1356 // Running out-of-process. Initiate an IPC call to notify the plugin | 1338 // Running out-of-process. Initiate an IPC call to notify the plugin |
| 1357 // process. | 1339 // process. |
| 1358 ppapi::proxy::HostDispatcher* dispatcher = | 1340 ppapi::proxy::HostDispatcher* dispatcher = |
| 1359 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance); | 1341 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance); |
| 1360 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 1342 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
| 1361 ppapi::API_ID_PPP_INSTANCE, pp_instance, pending_host_id, data)); | 1343 ppapi::API_ID_PPP_INSTANCE, pp_instance, pending_host_id, data)); |
| 1362 } | 1344 } |
| 1363 } | 1345 } |
| 1364 | 1346 |
| 1347 RendererPpapiHost* PepperPluginDelegateImpl::CreateExternalPluginModule( |
| 1348 scoped_refptr<webkit::ppapi::PluginModule> module, |
| 1349 const base::FilePath& path, |
| 1350 ppapi::PpapiPermissions permissions, |
| 1351 const IPC::ChannelHandle& channel_handle, |
| 1352 base::ProcessId peer_pid, |
| 1353 int plugin_child_id) { |
| 1354 // We don't call PepperPluginRegistry::AddLiveModule, as this module is |
| 1355 // managed externally. |
| 1356 return CreateOutOfProcessModule(module.get(), |
| 1357 path, |
| 1358 permissions, |
| 1359 channel_handle, |
| 1360 peer_pid, |
| 1361 plugin_child_id, |
| 1362 true); // is_external = true |
| 1363 } |
| 1364 |
| 1365 base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory( | 1365 base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory( |
| 1366 size_t size) { | 1366 size_t size) { |
| 1367 return RenderThread::Get()->HostAllocateSharedMemoryBuffer(size).release(); | 1367 return RenderThread::Get()->HostAllocateSharedMemoryBuffer(size).release(); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 ppapi::Preferences PepperPluginDelegateImpl::GetPreferences() { | 1370 ppapi::Preferences PepperPluginDelegateImpl::GetPreferences() { |
| 1371 return ppapi::Preferences(render_view_->webkit_preferences()); | 1371 return ppapi::Preferences(render_view_->webkit_preferences()); |
| 1372 } | 1372 } |
| 1373 | 1373 |
| 1374 bool PepperPluginDelegateImpl::LockMouse( | 1374 bool PepperPluginDelegateImpl::LockMouse( |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 should_close_source); | 1690 should_close_source); |
| 1691 } | 1691 } |
| 1692 | 1692 |
| 1693 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { | 1693 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { |
| 1694 RendererPpapiHostImpl* host = | 1694 RendererPpapiHostImpl* host = |
| 1695 RendererPpapiHostImpl::GetForPPInstance(instance); | 1695 RendererPpapiHostImpl::GetForPPInstance(instance); |
| 1696 return host && host->IsRunningInProcess(); | 1696 return host && host->IsRunningInProcess(); |
| 1697 } | 1697 } |
| 1698 | 1698 |
| 1699 } // namespace content | 1699 } // namespace content |
| OLD | NEW |