| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // the instance and get back to our RenderView. | 113 // the instance and get back to our RenderView. |
| 114 return static_cast<PepperPluginDelegateImpl*>( | 114 return static_cast<PepperPluginDelegateImpl*>( |
| 115 instance_object->delegate())->render_view(); | 115 instance_object->delegate())->render_view(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool RendererPpapiHostImpl::IsValidInstance( | 118 bool RendererPpapiHostImpl::IsValidInstance( |
| 119 PP_Instance instance) const { | 119 PP_Instance instance) const { |
| 120 return !!GetAndValidateInstance(instance); | 120 return !!GetAndValidateInstance(instance); |
| 121 } | 121 } |
| 122 | 122 |
| 123 WebKit::WebPluginContainer* RendererPpapiHostImpl::GetContainerForInstance( |
| 124 PP_Instance instance) const { |
| 125 PluginInstance* instance_object = GetAndValidateInstance(instance); |
| 126 if (!instance_object) |
| 127 return NULL; |
| 128 return instance_object->container(); |
| 129 } |
| 130 |
| 123 bool RendererPpapiHostImpl::HasUserGesture(PP_Instance instance) const { | 131 bool RendererPpapiHostImpl::HasUserGesture(PP_Instance instance) const { |
| 124 PluginInstance* instance_object = GetAndValidateInstance(instance); | 132 PluginInstance* instance_object = GetAndValidateInstance(instance); |
| 125 if (!instance_object) | 133 if (!instance_object) |
| 126 return false; | 134 return false; |
| 127 | 135 |
| 128 if (instance_object->module()->permissions().HasPermission( | 136 if (instance_object->module()->permissions().HasPermission( |
| 129 ppapi::PERMISSION_BYPASS_USER_GESTURE)) | 137 ppapi::PERMISSION_BYPASS_USER_GESTURE)) |
| 130 return true; | 138 return true; |
| 131 return instance_object->IsProcessingUserGesture(); | 139 return instance_object->IsProcessingUserGesture(); |
| 132 } | 140 } |
| 133 | 141 |
| 134 PluginInstance* RendererPpapiHostImpl::GetAndValidateInstance( | 142 PluginInstance* RendererPpapiHostImpl::GetAndValidateInstance( |
| 135 PP_Instance pp_instance) const { | 143 PP_Instance pp_instance) const { |
| 136 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); | 144 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); |
| 137 if (!instance) | 145 if (!instance) |
| 138 return NULL; | 146 return NULL; |
| 139 if (instance->module() != module_) | 147 if (instance->module() != module_) |
| 140 return NULL; | 148 return NULL; |
| 141 return instance; | 149 return instance; |
| 142 } | 150 } |
| 143 | 151 |
| 144 } // namespace content | 152 } // namespace content |
| OLD | NEW |