| 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/renderer_ppapi_host_impl.h" | 5 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "content/common/sandbox_util.h" | 10 #include "content/common/sandbox_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "webkit/plugins/ppapi/host_globals.h" | 27 #include "webkit/plugins/ppapi/host_globals.h" |
| 28 #include "webkit/plugins/ppapi/plugin_delegate.h" | 28 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 29 #include "webkit/plugins/ppapi/plugin_module.h" | 29 #include "webkit/plugins/ppapi/plugin_module.h" |
| 30 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 30 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 31 | 31 |
| 32 using webkit::ppapi::HostGlobals; | 32 using webkit::ppapi::HostGlobals; |
| 33 using webkit::ppapi::PluginInstance; | 33 using webkit::ppapi::PluginInstance; |
| 34 using webkit::ppapi::PluginModule; | 34 using webkit::ppapi::PluginModule; |
| 35 | 35 |
| 36 namespace content { | 36 namespace content { |
| 37 | |
| 38 // static | |
| 39 CONTENT_EXPORT RendererPpapiHost* | |
| 40 RendererPpapiHost::CreateExternalPluginModule( | |
| 41 scoped_refptr<PluginModule> plugin_module, | |
| 42 PluginInstance* plugin_instance, | |
| 43 const base::FilePath& file_path, | |
| 44 ppapi::PpapiPermissions permissions, | |
| 45 const IPC::ChannelHandle& channel_handle, | |
| 46 base::ProcessId plugin_pid, | |
| 47 int plugin_child_id) { | |
| 48 RendererPpapiHost* renderer_ppapi_host = NULL; | |
| 49 // Since we're the embedder, we can make assumptions about the delegate on | |
| 50 // the instance. | |
| 51 PepperPluginDelegateImpl* pepper_plugin_delegate = | |
| 52 static_cast<PepperPluginDelegateImpl*>(plugin_instance->delegate()); | |
| 53 if (pepper_plugin_delegate) { | |
| 54 renderer_ppapi_host = pepper_plugin_delegate->CreateExternalPluginModule( | |
| 55 plugin_module, | |
| 56 file_path, | |
| 57 permissions, | |
| 58 channel_handle, | |
| 59 plugin_pid, | |
| 60 plugin_child_id); | |
| 61 } | |
| 62 return renderer_ppapi_host; | |
| 63 } | |
| 64 | |
| 65 // static | 37 // static |
| 66 CONTENT_EXPORT RendererPpapiHost* | 38 CONTENT_EXPORT RendererPpapiHost* |
| 67 RendererPpapiHost::GetForPPInstance(PP_Instance instance) { | 39 RendererPpapiHost::GetForPPInstance(PP_Instance instance) { |
| 68 return RendererPpapiHostImpl::GetForPPInstance(instance); | 40 return RendererPpapiHostImpl::GetForPPInstance(instance); |
| 69 } | 41 } |
| 70 | 42 |
| 71 // Out-of-process constructor. | 43 // Out-of-process constructor. |
| 72 RendererPpapiHostImpl::RendererPpapiHostImpl( | 44 RendererPpapiHostImpl::RendererPpapiHostImpl( |
| 73 PluginModule* module, | 45 PluginModule* module, |
| 74 ppapi::proxy::HostDispatcher* dispatcher, | 46 ppapi::proxy::HostDispatcher* dispatcher, |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 PP_Instance pp_instance) const { | 268 PP_Instance pp_instance) const { |
| 297 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); | 269 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); |
| 298 if (!instance) | 270 if (!instance) |
| 299 return NULL; | 271 return NULL; |
| 300 if (!instance->IsValidInstanceOf(module_)) | 272 if (!instance->IsValidInstanceOf(module_)) |
| 301 return NULL; | 273 return NULL; |
| 302 return instance; | 274 return instance; |
| 303 } | 275 } |
| 304 | 276 |
| 305 } // namespace content | 277 } // namespace content |
| OLD | NEW |