| 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/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/renderer/pepper/pepper_graphics_2d_host.h" | 9 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
| 10 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" | 10 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 renderer_ppapi_host = pepper_plugin_delegate->CreateExternalPluginModule( | 46 renderer_ppapi_host = pepper_plugin_delegate->CreateExternalPluginModule( |
| 47 plugin_module, | 47 plugin_module, |
| 48 file_path, | 48 file_path, |
| 49 permissions, | 49 permissions, |
| 50 channel_handle, | 50 channel_handle, |
| 51 plugin_child_id); | 51 plugin_child_id); |
| 52 } | 52 } |
| 53 return renderer_ppapi_host; | 53 return renderer_ppapi_host; |
| 54 } | 54 } |
| 55 | 55 |
| 56 | |
| 57 // Out-of-process constructor. | 56 // Out-of-process constructor. |
| 58 RendererPpapiHostImpl::RendererPpapiHostImpl( | 57 RendererPpapiHostImpl::RendererPpapiHostImpl( |
| 59 PluginModule* module, | 58 PluginModule* module, |
| 60 ppapi::proxy::HostDispatcher* dispatcher, | 59 ppapi::proxy::HostDispatcher* dispatcher, |
| 61 const ppapi::PpapiPermissions& permissions) | 60 const ppapi::PpapiPermissions& permissions) |
| 62 : module_(module), | 61 : module_(module), |
| 63 dispatcher_(dispatcher) { | 62 dispatcher_(dispatcher) { |
| 64 // Hook the PpapiHost up to the dispatcher for out-of-process communication. | 63 // Hook the PpapiHost up to the dispatcher for out-of-process communication. |
| 65 ppapi_host_.reset( | 64 ppapi_host_.reset( |
| 66 new ppapi::host::PpapiHost(dispatcher, permissions)); | 65 new ppapi::host::PpapiHost(dispatcher, permissions)); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 177 } |
| 179 | 178 |
| 180 WebKit::WebPluginContainer* RendererPpapiHostImpl::GetContainerForInstance( | 179 WebKit::WebPluginContainer* RendererPpapiHostImpl::GetContainerForInstance( |
| 181 PP_Instance instance) const { | 180 PP_Instance instance) const { |
| 182 PluginInstance* instance_object = GetAndValidateInstance(instance); | 181 PluginInstance* instance_object = GetAndValidateInstance(instance); |
| 183 if (!instance_object) | 182 if (!instance_object) |
| 184 return NULL; | 183 return NULL; |
| 185 return instance_object->container(); | 184 return instance_object->container(); |
| 186 } | 185 } |
| 187 | 186 |
| 187 base::ProcessId RendererPpapiHostImpl::GetPluginPID() const { |
| 188 if (dispatcher_) |
| 189 return dispatcher_->channel()->peer_pid(); |
| 190 return base::kNullProcessId; |
| 191 } |
| 192 |
| 188 bool RendererPpapiHostImpl::HasUserGesture(PP_Instance instance) const { | 193 bool RendererPpapiHostImpl::HasUserGesture(PP_Instance instance) const { |
| 189 PluginInstance* instance_object = GetAndValidateInstance(instance); | 194 PluginInstance* instance_object = GetAndValidateInstance(instance); |
| 190 if (!instance_object) | 195 if (!instance_object) |
| 191 return false; | 196 return false; |
| 192 | 197 |
| 193 if (instance_object->module()->permissions().HasPermission( | 198 if (instance_object->module()->permissions().HasPermission( |
| 194 ppapi::PERMISSION_BYPASS_USER_GESTURE)) | 199 ppapi::PERMISSION_BYPASS_USER_GESTURE)) |
| 195 return true; | 200 return true; |
| 196 return instance_object->IsProcessingUserGesture(); | 201 return instance_object->IsProcessingUserGesture(); |
| 197 } | 202 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 PP_Instance pp_instance) const { | 254 PP_Instance pp_instance) const { |
| 250 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); | 255 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); |
| 251 if (!instance) | 256 if (!instance) |
| 252 return NULL; | 257 return NULL; |
| 253 if (instance->module() != module_) | 258 if (instance->module() != module_) |
| 254 return NULL; | 259 return NULL; |
| 255 return instance; | 260 return instance; |
| 256 } | 261 } |
| 257 | 262 |
| 258 } // namespace content | 263 } // namespace content |
| OLD | NEW |