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/process_handle.h" | 9 #include "base/process/process_handle.h" |
10 #include "content/common/sandbox_util.h" | 10 #include "content/common/sandbox_util.h" |
11 #include "content/renderer/pepper/fullscreen_container.h" | 11 #include "content/renderer/pepper/fullscreen_container.h" |
12 #include "content/renderer/pepper/host_globals.h" | 12 #include "content/renderer/pepper/host_globals.h" |
13 #include "content/renderer/pepper/pepper_browser_connection.h" | 13 #include "content/renderer/pepper/pepper_browser_connection.h" |
14 #include "content/renderer/pepper/pepper_graphics_2d_host.h" | 14 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
15 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" | 15 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" |
16 #include "content/renderer/pepper/pepper_in_process_router.h" | 16 #include "content/renderer/pepper/pepper_in_process_router.h" |
17 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 17 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
18 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 18 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
19 #include "content/renderer/pepper/plugin_delegate.h" | |
20 #include "content/renderer/pepper/plugin_module.h" | 19 #include "content/renderer/pepper/plugin_module.h" |
21 #include "content/renderer/render_view_impl.h" | 20 #include "content/renderer/render_view_impl.h" |
22 #include "content/renderer/render_widget_fullscreen_pepper.h" | 21 #include "content/renderer/render_widget_fullscreen_pepper.h" |
23 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
24 #include "ppapi/host/ppapi_host.h" | 23 #include "ppapi/host/ppapi_host.h" |
25 #include "ppapi/proxy/host_dispatcher.h" | 24 #include "ppapi/proxy/host_dispatcher.h" |
26 #include "third_party/WebKit/public/platform/WebRect.h" | 25 #include "third_party/WebKit/public/platform/WebRect.h" |
27 #include "third_party/WebKit/public/web/WebDocument.h" | 26 #include "third_party/WebKit/public/web/WebDocument.h" |
28 #include "third_party/WebKit/public/web/WebElement.h" | 27 #include "third_party/WebKit/public/web/WebElement.h" |
29 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 28 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 123 } |
125 | 124 |
126 PepperBrowserConnection* | 125 PepperBrowserConnection* |
127 RendererPpapiHostImpl::GetBrowserConnection(PP_Instance instance) const { | 126 RendererPpapiHostImpl::GetBrowserConnection(PP_Instance instance) const { |
128 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance); | 127 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance); |
129 if (!instance_object) | 128 if (!instance_object) |
130 return NULL; | 129 return NULL; |
131 | 130 |
132 // Since we're the embedder, we can make assumptions about the delegate on | 131 // Since we're the embedder, we can make assumptions about the delegate on |
133 // the instance. | 132 // the instance. |
134 PepperPluginDelegateImpl* delegate = | 133 PepperPluginDelegateImpl* delegate = instance_object->delegate(); |
135 static_cast<PepperPluginDelegateImpl*>(instance_object->delegate()); | |
136 if (!delegate) | 134 if (!delegate) |
137 return NULL; | 135 return NULL; |
138 | 136 |
139 return delegate->pepper_browser_connection(); | 137 return delegate->pepper_browser_connection(); |
140 } | 138 } |
141 | 139 |
142 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetPluginInstanceImpl( | 140 PepperPluginInstanceImpl* RendererPpapiHostImpl::GetPluginInstanceImpl( |
143 PP_Instance instance) const { | 141 PP_Instance instance) const { |
144 return GetAndValidateInstance(instance); | 142 return GetAndValidateInstance(instance); |
145 } | 143 } |
146 | 144 |
147 ppapi::host::PpapiHost* RendererPpapiHostImpl::GetPpapiHost() { | 145 ppapi::host::PpapiHost* RendererPpapiHostImpl::GetPpapiHost() { |
148 return ppapi_host_.get(); | 146 return ppapi_host_.get(); |
149 } | 147 } |
150 | 148 |
151 RenderView* RendererPpapiHostImpl::GetRenderViewForInstance( | 149 RenderView* RendererPpapiHostImpl::GetRenderViewForInstance( |
152 PP_Instance instance) const { | 150 PP_Instance instance) const { |
153 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance); | 151 PepperPluginInstanceImpl* instance_object = GetAndValidateInstance(instance); |
154 if (!instance_object) | 152 if (!instance_object) |
155 return NULL; | 153 return NULL; |
156 | 154 |
157 // Since we're the embedder, we can make assumptions about the delegate on | 155 // Since we're the embedder, we can make assumptions about the delegate on |
158 // the instance and get back to our RenderView. | 156 // the instance and get back to our RenderView. |
159 return static_cast<PepperPluginDelegateImpl*>( | 157 return instance_object->delegate()->render_view(); |
160 instance_object->delegate())->render_view(); | |
161 } | 158 } |
162 | 159 |
163 bool RendererPpapiHostImpl::IsValidInstance(PP_Instance instance) const { | 160 bool RendererPpapiHostImpl::IsValidInstance(PP_Instance instance) const { |
164 return !!GetAndValidateInstance(instance); | 161 return !!GetAndValidateInstance(instance); |
165 } | 162 } |
166 | 163 |
167 PepperPluginInstance* RendererPpapiHostImpl::GetPluginInstance( | 164 PepperPluginInstance* RendererPpapiHostImpl::GetPluginInstance( |
168 PP_Instance instance) const { | 165 PP_Instance instance) const { |
169 return GetAndValidateInstance(instance); | 166 return GetAndValidateInstance(instance); |
170 } | 167 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 PepperPluginInstanceImpl* instance = | 261 PepperPluginInstanceImpl* instance = |
265 HostGlobals::Get()->GetInstance(pp_instance); | 262 HostGlobals::Get()->GetInstance(pp_instance); |
266 if (!instance) | 263 if (!instance) |
267 return NULL; | 264 return NULL; |
268 if (!instance->IsValidInstanceOf(module_)) | 265 if (!instance->IsValidInstanceOf(module_)) |
269 return NULL; | 266 return NULL; |
270 return instance; | 267 return instance; |
271 } | 268 } |
272 | 269 |
273 } // namespace content | 270 } // namespace content |
OLD | NEW |