| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" | 8 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" |
| 9 #include "content/renderer/pepper/pepper_in_process_router.h" | 9 #include "content/renderer/pepper/pepper_in_process_router.h" |
| 10 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 10 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // the instance and get back to our RenderView. | 100 // the instance and get back to our RenderView. |
| 101 return static_cast<PepperPluginDelegateImpl*>( | 101 return static_cast<PepperPluginDelegateImpl*>( |
| 102 instance_object->delegate())->render_view(); | 102 instance_object->delegate())->render_view(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool RendererPpapiHostImpl::IsValidInstance( | 105 bool RendererPpapiHostImpl::IsValidInstance( |
| 106 PP_Instance instance) const { | 106 PP_Instance instance) const { |
| 107 return !!GetAndValidateInstance(instance); | 107 return !!GetAndValidateInstance(instance); |
| 108 } | 108 } |
| 109 | 109 |
| 110 WebKit::WebPluginContainer* RendererPpapiHostImpl::GetContainerForInstance( |
| 111 PP_Instance instance) const { |
| 112 PluginInstance* instance_object = GetAndValidateInstance(instance); |
| 113 if (!instance_object) |
| 114 return NULL; |
| 115 return instance_object->container(); |
| 116 } |
| 117 |
| 110 bool RendererPpapiHostImpl::HasUserGesture(PP_Instance instance) const { | 118 bool RendererPpapiHostImpl::HasUserGesture(PP_Instance instance) const { |
| 111 PluginInstance* instance_object = GetAndValidateInstance(instance); | 119 PluginInstance* instance_object = GetAndValidateInstance(instance); |
| 112 if (!instance_object) | 120 if (!instance_object) |
| 113 return false; | 121 return false; |
| 114 | 122 |
| 115 if (instance_object->module()->permissions().HasPermission( | 123 if (instance_object->module()->permissions().HasPermission( |
| 116 ppapi::PERMISSION_BYPASS_USER_GESTURE)) | 124 ppapi::PERMISSION_BYPASS_USER_GESTURE)) |
| 117 return true; | 125 return true; |
| 118 return instance_object->IsProcessingUserGesture(); | 126 return instance_object->IsProcessingUserGesture(); |
| 119 } | 127 } |
| 120 | 128 |
| 121 PluginInstance* RendererPpapiHostImpl::GetAndValidateInstance( | 129 PluginInstance* RendererPpapiHostImpl::GetAndValidateInstance( |
| 122 PP_Instance pp_instance) const { | 130 PP_Instance pp_instance) const { |
| 123 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); | 131 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); |
| 124 if (!instance) | 132 if (!instance) |
| 125 return NULL; | 133 return NULL; |
| 126 if (instance->module() != module_) | 134 if (instance->module() != module_) |
| 127 return NULL; | 135 return NULL; |
| 128 return instance; | 136 return instance; |
| 129 } | 137 } |
| 130 | 138 |
| 131 } // namespace content | 139 } // namespace content |
| OLD | NEW |