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" |
| 11 #include "content/renderer/pepper/pepper_browser_connection.h" |
11 #include "content/renderer/pepper/pepper_graphics_2d_host.h" | 12 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
12 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" | 13 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" |
13 #include "content/renderer/pepper/pepper_in_process_router.h" | 14 #include "content/renderer/pepper/pepper_in_process_router.h" |
14 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 15 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
15 #include "content/renderer/render_view_impl.h" | 16 #include "content/renderer/render_view_impl.h" |
16 #include "content/renderer/render_widget_fullscreen_pepper.h" | 17 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 18 #include "ipc/ipc_message.h" |
17 #include "ppapi/host/ppapi_host.h" | 19 #include "ppapi/host/ppapi_host.h" |
18 #include "ppapi/proxy/host_dispatcher.h" | 20 #include "ppapi/proxy/host_dispatcher.h" |
19 #include "third_party/WebKit/public/platform/WebRect.h" | 21 #include "third_party/WebKit/public/platform/WebRect.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
23 #include "ui/gfx/point.h" | 25 #include "ui/gfx/point.h" |
24 #include "webkit/plugins/ppapi/fullscreen_container.h" | 26 #include "webkit/plugins/ppapi/fullscreen_container.h" |
25 #include "webkit/plugins/ppapi/host_globals.h" | 27 #include "webkit/plugins/ppapi/host_globals.h" |
26 #include "webkit/plugins/ppapi/plugin_delegate.h" | 28 #include "webkit/plugins/ppapi/plugin_delegate.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 base::GetCurrentProcId(), | 266 base::GetCurrentProcId(), |
265 should_close_source); | 267 should_close_source); |
266 } | 268 } |
267 return dispatcher_->ShareHandleWithRemote(handle, should_close_source); | 269 return dispatcher_->ShareHandleWithRemote(handle, should_close_source); |
268 } | 270 } |
269 | 271 |
270 bool RendererPpapiHostImpl::IsRunningInProcess() const { | 272 bool RendererPpapiHostImpl::IsRunningInProcess() const { |
271 return is_running_in_process_; | 273 return is_running_in_process_; |
272 } | 274 } |
273 | 275 |
| 276 void RendererPpapiHostImpl::CreateBrowserResourceHost( |
| 277 PP_Instance instance, |
| 278 const IPC::Message& nested_msg, |
| 279 const base::Callback<void(int)>& callback) const { |
| 280 PluginInstance* instance_object = GetAndValidateInstance(instance); |
| 281 if (!instance_object) |
| 282 callback.Run(0); |
| 283 |
| 284 // Since we're the embedder, we can make assumptions about the delegate on |
| 285 // the instance. |
| 286 PepperPluginDelegateImpl* delegate = |
| 287 static_cast<PepperPluginDelegateImpl*>(instance_object->delegate()); |
| 288 if (!delegate) |
| 289 callback.Run(0); |
| 290 |
| 291 PepperBrowserConnection* browser_connection = |
| 292 delegate->pepper_browser_connection(); |
| 293 browser_connection->SendBrowserCreate(module_->GetPluginChildId(), |
| 294 instance, |
| 295 nested_msg, |
| 296 callback); |
| 297 } |
| 298 |
274 PluginInstance* RendererPpapiHostImpl::GetAndValidateInstance( | 299 PluginInstance* RendererPpapiHostImpl::GetAndValidateInstance( |
275 PP_Instance pp_instance) const { | 300 PP_Instance pp_instance) const { |
276 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); | 301 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); |
277 if (!instance) | 302 if (!instance) |
278 return NULL; | 303 return NULL; |
279 if (!instance->IsValidInstanceOf(module_)) | 304 if (!instance->IsValidInstanceOf(module_)) |
280 return NULL; | 305 return NULL; |
281 return instance; | 306 return instance; |
282 } | 307 } |
283 | 308 |
284 } // namespace content | 309 } // namespace content |
OLD | NEW |