This source file includes following definitions.
- GetLivePluginSet
- AddRefResource
- ReleaseResource
- GetTime
- GetTickTime
- CallOnMainThread
- IsMainThread
- ReadImageData
- RunMessageLoop
- QuitMessageLoop
- GetLiveObjectsForInstance
- IsOutOfProcess
- SimulateInputEvent
- GetDocumentURL
- GetLiveVars
- SetMinimumArrayBufferSizeForShmem
- InternalGetInterface
- GetInterface
- LoadEntryPointsFromLibrary
- CreateHostForInProcessModule
- reserve_instance_id_
- SetRendererPpapiHost
- InitAsInternalPlugin
- InitAsLibrary
- InitAsProxied
- CreateModuleForExternalPluginInstance
- InitAsProxiedExternalPlugin
- IsProxied
- GetPeerProcessId
- GetPluginChildId
- GetCore
- SupportsInterface
- CreateInstance
- GetSomeInstance
- GetPluginInterface
- InstanceCreated
- InstanceDeleted
- GetCallbackTracker
- PluginCrashed
- SetReserveInstanceIDCallback
- ReserveInstanceID
- SetBroker
- GetBroker
- CreateOutOfProcessModule
- ResetHostGlobalsForTest
- InitializeModule
- Create
#include "content/renderer/pepper/plugin_module.h"
#include <set>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "content/common/view_messages.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/renderer/pepper/common.h"
#include "content/renderer/pepper/host_dispatcher_wrapper.h"
#include "content/renderer/pepper/host_globals.h"
#include "content/renderer/pepper/pepper_hung_plugin_filter.h"
#include "content/renderer/pepper/pepper_plugin_instance_impl.h"
#include "content/renderer/pepper/pepper_plugin_registry.h"
#include "content/renderer/pepper/ppb_image_data_impl.h"
#include "content/renderer/pepper/ppb_proxy_impl.h"
#include "content/renderer/pepper/ppb_scrollbar_impl.h"
#include "content/renderer/pepper/ppb_var_deprecated_impl.h"
#include "content/renderer/pepper/ppb_video_decoder_impl.h"
#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
#include "content/renderer/render_view_impl.h"
#include "ppapi/c/dev/ppb_alarms_dev.h"
#include "ppapi/c/dev/ppb_audio_input_dev.h"
#include "ppapi/c/dev/ppb_buffer_dev.h"
#include "ppapi/c/dev/ppb_char_set_dev.h"
#include "ppapi/c/dev/ppb_crypto_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/c/dev/ppb_device_ref_dev.h"
#include "ppapi/c/dev/ppb_file_chooser_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/c/dev/ppb_opengles2ext_dev.h"
#include "ppapi/c/dev/ppb_printing_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_text_input_dev.h"
#include "ppapi/c/dev/ppb_trace_event_dev.h"
#include "ppapi/c/dev/ppb_truetype_font_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/dev/ppb_video_capture_dev.h"
#include "ppapi/c/dev/ppb_video_decoder_dev.h"
#include "ppapi/c/dev/ppb_view_dev.h"
#include "ppapi/c/dev/ppb_widget_dev.h"
#include "ppapi/c/dev/ppb_zoom_dev.h"
#include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppb_audio.h"
#include "ppapi/c/ppb_audio_buffer.h"
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/ppb_console.h"
#include "ppapi/c/ppb_core.h"
#include "ppapi/c/ppb_file_io.h"
#include "ppapi/c/ppb_file_mapping.h"
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/c/ppb_file_system.h"
#include "ppapi/c/ppb_fullscreen.h"
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/c/ppb_graphics_3d.h"
#include "ppapi/c/ppb_host_resolver.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/c/ppb_media_stream_audio_track.h"
#include "ppapi/c/ppb_media_stream_video_track.h"
#include "ppapi/c/ppb_messaging.h"
#include "ppapi/c/ppb_mouse_cursor.h"
#include "ppapi/c/ppb_mouse_lock.h"
#include "ppapi/c/ppb_net_address.h"
#include "ppapi/c/ppb_network_list.h"
#include "ppapi/c/ppb_network_monitor.h"
#include "ppapi/c/ppb_network_proxy.h"
#include "ppapi/c/ppb_opengles2.h"
#include "ppapi/c/ppb_tcp_socket.h"
#include "ppapi/c/ppb_text_input_controller.h"
#include "ppapi/c/ppb_udp_socket.h"
#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/c/ppb_url_request_info.h"
#include "ppapi/c/ppb_url_response_info.h"
#include "ppapi/c/ppb_var.h"
#include "ppapi/c/ppb_var_array.h"
#include "ppapi/c/ppb_var_array_buffer.h"
#include "ppapi/c/ppb_var_dictionary.h"
#include "ppapi/c/ppb_video_frame.h"
#include "ppapi/c/ppb_view.h"
#include "ppapi/c/ppp.h"
#include "ppapi/c/ppp_instance.h"
#include "ppapi/c/private/ppb_ext_crx_file_system_private.h"
#include "ppapi/c/private/ppb_file_io_private.h"
#include "ppapi/c/private/ppb_file_ref_private.h"
#include "ppapi/c/private/ppb_find_private.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/c/private/ppb_flash_clipboard.h"
#include "ppapi/c/private/ppb_flash_device_id.h"
#include "ppapi/c/private/ppb_flash_drm.h"
#include "ppapi/c/private/ppb_flash_file.h"
#include "ppapi/c/private/ppb_flash_font_file.h"
#include "ppapi/c/private/ppb_flash_fullscreen.h"
#include "ppapi/c/private/ppb_flash_menu.h"
#include "ppapi/c/private/ppb_flash_message_loop.h"
#include "ppapi/c/private/ppb_flash_print.h"
#include "ppapi/c/private/ppb_host_resolver_private.h"
#include "ppapi/c/private/ppb_instance_private.h"
#include "ppapi/c/private/ppb_isolated_file_system_private.h"
#include "ppapi/c/private/ppb_output_protection_private.h"
#include "ppapi/c/private/ppb_pdf.h"
#include "ppapi/c/private/ppb_proxy_private.h"
#include "ppapi/c/private/ppb_talk_private.h"
#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
#include "ppapi/c/private/ppb_tcp_socket_private.h"
#include "ppapi/c/private/ppb_testing_private.h"
#include "ppapi/c/private/ppb_udp_socket_private.h"
#include "ppapi/c/private/ppb_uma_private.h"
#include "ppapi/c/private/ppb_video_destination_private.h"
#include "ppapi/c/private/ppb_video_source_private.h"
#include "ppapi/c/private/ppb_x509_certificate_private.h"
#include "ppapi/c/trusted/ppb_broker_trusted.h"
#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
#include "ppapi/c/trusted/ppb_char_set_trusted.h"
#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
#include "ppapi/shared_impl/callback_tracker.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "ppapi/shared_impl/ppapi_switches.h"
#include "ppapi/shared_impl/ppb_input_event_shared.h"
#include "ppapi/shared_impl/ppb_opengles2_shared.h"
#include "ppapi/shared_impl/ppb_var_shared.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_graphics_2d_api.h"
#include "ppapi/thunk/thunk.h"
#if defined(OS_CHROMEOS)
#include "ppapi/c/private/ppb_platform_verification_private.h"
#endif
using ppapi::InputEventData;
using ppapi::PpapiGlobals;
using ppapi::TimeTicksToPPTimeTicks;
using ppapi::TimeToPPTime;
using ppapi::thunk::EnterResource;
using ppapi::thunk::PPB_Graphics2D_API;
using ppapi::thunk::PPB_InputEvent_API;
namespace content {
namespace {
HostGlobals* host_globals = NULL;
typedef std::set<PluginModule*> PluginModuleSet;
PluginModuleSet* GetLivePluginSet() {
CR_DEFINE_STATIC_LOCAL(PluginModuleSet, live_plugin_libs, ());
return &live_plugin_libs;
}
void AddRefResource(PP_Resource resource) {
PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(resource);
}
void ReleaseResource(PP_Resource resource) {
PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(resource);
}
PP_Time GetTime() {
return TimeToPPTime(base::Time::Now());
}
PP_TimeTicks GetTickTime() {
return TimeTicksToPPTimeTicks(base::TimeTicks::Now());
}
void CallOnMainThread(int delay_in_msec,
PP_CompletionCallback callback,
int32_t result) {
if (callback.func) {
PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostDelayedTask(
FROM_HERE,
base::Bind(callback.func, callback.user_data, result),
base::TimeDelta::FromMilliseconds(delay_in_msec));
}
}
PP_Bool IsMainThread() {
return BoolToPPBool(PpapiGlobals::Get()->
GetMainThreadMessageLoop()->BelongsToCurrentThread());
}
const PPB_Core core_interface = {
&AddRefResource,
&ReleaseResource,
&GetTime,
&GetTickTime,
&CallOnMainThread,
&IsMainThread
};
PP_Bool ReadImageData(PP_Resource device_context_2d,
PP_Resource image,
const PP_Point* top_left) {
EnterResource<PPB_Graphics2D_API> enter(device_context_2d, true);
if (enter.failed())
return PP_FALSE;
return BoolToPPBool(enter.object()->ReadImageData(image, top_left));
}
void RunMessageLoop(PP_Instance instance) {
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
base::MessageLoop::current()->Run();
}
void QuitMessageLoop(PP_Instance instance) {
base::MessageLoop::current()->QuitNow();
}
uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
return HostGlobals::Get()->GetResourceTracker()->GetLiveObjectsForInstance(
instance_id);
}
PP_Bool IsOutOfProcess() {
return PP_FALSE;
}
void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
PepperPluginInstanceImpl* plugin_instance =
host_globals->GetInstance(instance);
if (!plugin_instance)
return;
EnterResource<PPB_InputEvent_API> enter(input_event, false);
if (enter.failed())
return;
const InputEventData& input_event_data = enter.object()->GetInputEventData();
plugin_instance->SimulateInputEvent(input_event_data);
}
PP_Var GetDocumentURL(PP_Instance instance, PP_URLComponents_Dev* components) {
PepperPluginInstanceImpl* plugin_instance =
host_globals->GetInstance(instance);
if (!plugin_instance)
return PP_MakeUndefined();
return plugin_instance->GetDocumentURL(instance, components);
}
uint32_t GetLiveVars(PP_Var live_vars[], uint32_t array_size) {
std::vector<PP_Var> vars =
PpapiGlobals::Get()->GetVarTracker()->GetLiveVars();
for (size_t i = 0u;
i < std::min(static_cast<size_t>(array_size), vars.size());
++i)
live_vars[i] = vars[i];
return vars.size();
}
void SetMinimumArrayBufferSizeForShmem(PP_Instance ,
uint32_t ) {
}
const PPB_Testing_Private testing_interface = {
&ReadImageData,
&RunMessageLoop,
&QuitMessageLoop,
&GetLiveObjectsForInstance,
&IsOutOfProcess,
&SimulateInputEvent,
&GetDocumentURL,
&GetLiveVars,
&SetMinimumArrayBufferSizeForShmem
};
const void* InternalGetInterface(const char* name) {
const void* custom_interface =
GetContentClient()->renderer()->CreatePPAPIInterface(name);
if (custom_interface)
return custom_interface;
#define PROXIED_IFACE(iface_str, iface_struct) \
if (strcmp(name, iface_str) == 0) \
return ppapi::thunk::Get##iface_struct##_Thunk();
#include "ppapi/thunk/interfaces_ppb_private.h"
#include "ppapi/thunk/interfaces_ppb_private_flash.h"
#include "ppapi/thunk/interfaces_ppb_private_no_permissions.h"
#include "ppapi/thunk/interfaces_ppb_public_dev.h"
#include "ppapi/thunk/interfaces_ppb_public_dev_channel.h"
#include "ppapi/thunk/interfaces_ppb_public_stable.h"
#undef PROXIED_IFACE
#define LEGACY_IFACE(iface_str, function_name) \
if (strcmp(name, iface_str) == 0) \
return function_name;
#include "ppapi/thunk/interfaces_legacy.h"
#undef LEGACY_IFACE
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePepperTesting)) {
if (strcmp(name, PPB_TESTING_PRIVATE_INTERFACE) == 0)
return &testing_interface;
}
return NULL;
}
const void* GetInterface(const char* name) {
CHECK(IsMainThread());
return InternalGetInterface(name);
}
bool LoadEntryPointsFromLibrary(
const base::NativeLibrary& library,
PepperPluginInfo::EntryPoints* entry_points) {
entry_points->get_interface =
reinterpret_cast<PepperPluginInfo::GetInterfaceFunc>(
base::GetFunctionPointerFromNativeLibrary(library,
"PPP_GetInterface"));
if (!entry_points->get_interface) {
LOG(WARNING) << "No PPP_GetInterface in plugin library";
return false;
}
entry_points->initialize_module =
reinterpret_cast<PepperPluginInfo::PPP_InitializeModuleFunc>(
base::GetFunctionPointerFromNativeLibrary(library,
"PPP_InitializeModule"));
if (!entry_points->initialize_module) {
LOG(WARNING) << "No PPP_InitializeModule in plugin library";
return false;
}
entry_points->shutdown_module =
reinterpret_cast<PepperPluginInfo::PPP_ShutdownModuleFunc>(
base::GetFunctionPointerFromNativeLibrary(library,
"PPP_ShutdownModule"));
return true;
}
void CreateHostForInProcessModule(RenderFrameImpl* render_frame,
PluginModule* module,
const WebPluginInfo& webplugin_info) {
const PepperPluginInfo* info =
PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info);
DCHECK(!info->is_out_of_process);
ppapi::PpapiPermissions perms(
PepperPluginRegistry::GetInstance()->GetInfoForPlugin(
webplugin_info)->permissions);
RendererPpapiHostImpl* host_impl =
RendererPpapiHostImpl::CreateOnModuleForInProcess(module, perms);
render_frame->PepperPluginCreated(host_impl);
}
}
PluginModule::PluginModule(const std::string& name,
const base::FilePath& path,
const ppapi::PpapiPermissions& perms)
: callback_tracker_(new ppapi::CallbackTracker),
is_in_destructor_(false),
is_crashed_(false),
broker_(NULL),
library_(NULL),
name_(name),
path_(path),
permissions_(perms),
reserve_instance_id_(NULL) {
if (!host_globals)
host_globals = new HostGlobals;
memset(&entry_points_, 0, sizeof(entry_points_));
pp_module_ = HostGlobals::Get()->AddModule(this);
GetLivePluginSet()->insert(this);
}
PluginModule::~PluginModule() {
CHECK(!is_in_destructor_);
is_in_destructor_ = true;
DCHECK(instances_.empty());
renderer_ppapi_host_.reset();
GetLivePluginSet()->erase(this);
callback_tracker_->AbortAll();
if (entry_points_.shutdown_module)
entry_points_.shutdown_module();
if (library_)
base::UnloadNativeLibrary(library_);
HostGlobals::Get()->ModuleDeleted(pp_module_);
if (!is_crashed_) {
PepperPluginRegistry::GetInstance()->PluginModuleDead(this);
}
}
void PluginModule::SetRendererPpapiHost(
scoped_ptr<RendererPpapiHostImpl> host) {
renderer_ppapi_host_ = host.Pass();
}
bool PluginModule::InitAsInternalPlugin(
const PepperPluginInfo::EntryPoints& entry_points) {
if (InitializeModule(entry_points)) {
entry_points_ = entry_points;
return true;
}
return false;
}
bool PluginModule::InitAsLibrary(const base::FilePath& path) {
base::NativeLibrary library = base::LoadNativeLibrary(path, NULL);
if (!library)
return false;
PepperPluginInfo::EntryPoints entry_points;
if (!LoadEntryPointsFromLibrary(library, &entry_points) ||
!InitializeModule(entry_points)) {
base::UnloadNativeLibrary(library);
return false;
}
entry_points_ = entry_points;
library_ = library;
return true;
}
void PluginModule::InitAsProxied(
HostDispatcherWrapper* host_dispatcher_wrapper) {
DCHECK(!host_dispatcher_wrapper_.get());
host_dispatcher_wrapper_.reset(host_dispatcher_wrapper);
}
scoped_refptr<PluginModule>
PluginModule::CreateModuleForExternalPluginInstance() {
scoped_refptr<PluginModule> external_plugin_module(
new PluginModule(name_,
path_,
permissions_));
return external_plugin_module;
}
PP_ExternalPluginResult PluginModule::InitAsProxiedExternalPlugin(
PepperPluginInstanceImpl* instance) {
DCHECK(host_dispatcher_wrapper_.get());
host_dispatcher_wrapper_->AddInstance(instance->pp_instance());
return instance->ResetAsProxied(this);
}
bool PluginModule::IsProxied() const {
return !!host_dispatcher_wrapper_;
}
base::ProcessId PluginModule::GetPeerProcessId() {
if (host_dispatcher_wrapper_)
return host_dispatcher_wrapper_->peer_pid();
return base::kNullProcessId;
}
int PluginModule::GetPluginChildId() {
if (host_dispatcher_wrapper_)
return host_dispatcher_wrapper_->plugin_child_id();
return 0;
}
const PPB_Core* PluginModule::GetCore() {
return &core_interface;
}
bool PluginModule::SupportsInterface(const char* name) {
return !!InternalGetInterface(name);
}
PepperPluginInstanceImpl* PluginModule::CreateInstance(
RenderFrameImpl* render_frame,
blink::WebPluginContainer* container,
const GURL& plugin_url) {
PepperPluginInstanceImpl* instance = PepperPluginInstanceImpl::Create(
render_frame, this, container, plugin_url);
if (!instance) {
LOG(WARNING) << "Plugin doesn't support instance interface, failing.";
return NULL;
}
if (host_dispatcher_wrapper_)
host_dispatcher_wrapper_->AddInstance(instance->pp_instance());
return instance;
}
PepperPluginInstanceImpl* PluginModule::GetSomeInstance() const {
CHECK(!instances_.empty());
return *instances_.begin();
}
const void* PluginModule::GetPluginInterface(const char* name) const {
if (host_dispatcher_wrapper_)
return host_dispatcher_wrapper_->GetProxiedInterface(name);
if (!entry_points_.get_interface)
return NULL;
return entry_points_.get_interface(name);
}
void PluginModule::InstanceCreated(PepperPluginInstanceImpl* instance) {
instances_.insert(instance);
}
void PluginModule::InstanceDeleted(PepperPluginInstanceImpl* instance) {
if (host_dispatcher_wrapper_)
host_dispatcher_wrapper_->RemoveInstance(instance->pp_instance());
instances_.erase(instance);
}
scoped_refptr<ppapi::CallbackTracker> PluginModule::GetCallbackTracker() {
return callback_tracker_;
}
void PluginModule::PluginCrashed() {
DCHECK(!is_crashed_);
is_crashed_ = true;
for (PluginInstanceSet::iterator i = instances_.begin();
i != instances_.end(); ++i)
(*i)->InstanceCrashed();
PepperPluginRegistry::GetInstance()->PluginModuleDead(this);
}
void PluginModule::SetReserveInstanceIDCallback(
PP_Bool (*reserve)(PP_Module, PP_Instance)) {
DCHECK(!reserve_instance_id_) << "Only expect one set.";
reserve_instance_id_ = reserve;
}
bool PluginModule::ReserveInstanceID(PP_Instance instance) {
if (reserve_instance_id_)
return PPBoolToBool(reserve_instance_id_(pp_module_, instance));
return true;
}
void PluginModule::SetBroker(PepperBroker* broker) {
DCHECK(!broker_ || !broker);
broker_ = broker;
}
PepperBroker* PluginModule::GetBroker() {
return broker_;
}
RendererPpapiHostImpl* PluginModule::CreateOutOfProcessModule(
RenderFrameImpl* render_frame,
const base::FilePath& path,
ppapi::PpapiPermissions permissions,
const IPC::ChannelHandle& channel_handle,
base::ProcessId peer_pid,
int plugin_child_id,
bool is_external) {
scoped_refptr<PepperHungPluginFilter> hung_filter(new PepperHungPluginFilter(
path, render_frame->GetRoutingID(), plugin_child_id));
scoped_ptr<HostDispatcherWrapper> dispatcher(
new HostDispatcherWrapper(this,
peer_pid,
plugin_child_id,
permissions,
is_external));
if (!dispatcher->Init(
channel_handle,
&GetInterface,
ppapi::Preferences(render_frame->render_view()->webkit_preferences()),
hung_filter.get()))
return NULL;
RendererPpapiHostImpl* host_impl =
RendererPpapiHostImpl::CreateOnModuleForOutOfProcess(
this, dispatcher->dispatcher(), permissions);
render_frame->PepperPluginCreated(host_impl);
InitAsProxied(dispatcher.release());
return host_impl;
}
void PluginModule::ResetHostGlobalsForTest() {
delete host_globals;
host_globals = NULL;
}
bool PluginModule::InitializeModule(
const PepperPluginInfo::EntryPoints& entry_points) {
DCHECK(!host_dispatcher_wrapper_.get()) << "Don't call for proxied modules.";
DCHECK(entry_points.initialize_module != NULL);
int retval = entry_points.initialize_module(pp_module(), &GetInterface);
if (retval != 0) {
LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
return false;
}
return true;
}
scoped_refptr<PluginModule> PluginModule::Create(
RenderFrameImpl* render_frame,
const WebPluginInfo& webplugin_info,
bool* pepper_plugin_was_registered) {
*pepper_plugin_was_registered = true;
base::FilePath path(webplugin_info.path);
scoped_refptr<PluginModule> module =
PepperPluginRegistry::GetInstance()->GetLiveModule(path);
if (module.get()) {
if (!module->renderer_ppapi_host()) {
CreateHostForInProcessModule(render_frame, module.get(), webplugin_info);
}
return module;
}
const PepperPluginInfo* info =
PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info);
if (!info) {
*pepper_plugin_was_registered = false;
return scoped_refptr<PluginModule>();
} else if (!info->is_out_of_process) {
return scoped_refptr<PluginModule>();
}
ppapi::PpapiPermissions permissions =
ppapi::PpapiPermissions::GetForCommandLine(info->permissions);
IPC::ChannelHandle channel_handle;
base::ProcessId peer_pid;
int plugin_child_id = 0;
render_frame->Send(new ViewHostMsg_OpenChannelToPepperPlugin(
path, &channel_handle, &peer_pid, &plugin_child_id));
if (channel_handle.name.empty()) {
return scoped_refptr<PluginModule>();
}
module = new PluginModule(info->name, path, permissions);
PepperPluginRegistry::GetInstance()->AddLiveModule(path, module.get());
if (!module->CreateOutOfProcessModule(render_frame,
path,
permissions,
channel_handle,
peer_pid,
plugin_child_id,
false))
return scoped_refptr<PluginModule>();
return module;
}
}