| 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_graphics_2d_host.h" | 11 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
| 12 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" | 12 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" |
| 13 #include "content/renderer/pepper/pepper_in_process_router.h" | 13 #include "content/renderer/pepper/pepper_in_process_router.h" |
| 14 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 14 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| 15 #include "content/renderer/render_view_impl.h" | 15 #include "content/renderer/render_view_impl.h" |
| 16 #include "content/renderer/render_widget_fullscreen_pepper.h" | 16 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 17 #include "ppapi/host/ppapi_host.h" | 17 #include "ppapi/host/ppapi_host.h" |
| 18 #include "ppapi/proxy/host_dispatcher.h" | 18 #include "ppapi/proxy/host_dispatcher.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" | 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 20 #include "ui/gfx/point.h" | 23 #include "ui/gfx/point.h" |
| 21 #include "webkit/plugins/ppapi/fullscreen_container.h" | 24 #include "webkit/plugins/ppapi/fullscreen_container.h" |
| 22 #include "webkit/plugins/ppapi/host_globals.h" | 25 #include "webkit/plugins/ppapi/host_globals.h" |
| 23 #include "webkit/plugins/ppapi/plugin_delegate.h" | 26 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 24 #include "webkit/plugins/ppapi/plugin_module.h" | 27 #include "webkit/plugins/ppapi/plugin_module.h" |
| 25 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 28 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 26 | 29 |
| 27 using webkit::ppapi::HostGlobals; | 30 using webkit::ppapi::HostGlobals; |
| 28 using webkit::ppapi::PluginInstance; | 31 using webkit::ppapi::PluginInstance; |
| 29 using webkit::ppapi::PluginModule; | 32 using webkit::ppapi::PluginModule; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 plugin_instance->flash_fullscreen()) { | 239 plugin_instance->flash_fullscreen()) { |
| 237 WebKit::WebRect window_rect = render_view->windowRect(); | 240 WebKit::WebRect window_rect = render_view->windowRect(); |
| 238 WebKit::WebRect screen_rect = render_view->screenInfo().rect; | 241 WebKit::WebRect screen_rect = render_view->screenInfo().rect; |
| 239 return gfx::Point(pt.x() - window_rect.x + screen_rect.x, | 242 return gfx::Point(pt.x() - window_rect.x + screen_rect.x, |
| 240 pt.y() - window_rect.y + screen_rect.y); | 243 pt.y() - window_rect.y + screen_rect.y); |
| 241 } | 244 } |
| 242 return gfx::Point(pt.x() + plugin_instance->view_data().rect.point.x, | 245 return gfx::Point(pt.x() + plugin_instance->view_data().rect.point.x, |
| 243 pt.y() + plugin_instance->view_data().rect.point.y); | 246 pt.y() + plugin_instance->view_data().rect.point.y); |
| 244 } | 247 } |
| 245 | 248 |
| 249 GURL RendererPpapiHostImpl::GetDocumentURLForInstance( |
| 250 PP_Instance instance) const { |
| 251 webkit::ppapi::PluginInstance* plugin_instance = |
| 252 GetAndValidateInstance(instance); |
| 253 if (!plugin_instance) |
| 254 return GURL(); |
| 255 return plugin_instance->container()->element().document().url(); |
| 256 } |
| 257 |
| 246 IPC::PlatformFileForTransit RendererPpapiHostImpl::ShareHandleWithRemote( | 258 IPC::PlatformFileForTransit RendererPpapiHostImpl::ShareHandleWithRemote( |
| 247 base::PlatformFile handle, | 259 base::PlatformFile handle, |
| 248 bool should_close_source) { | 260 bool should_close_source) { |
| 249 if (!dispatcher_) { | 261 if (!dispatcher_) { |
| 250 DCHECK(is_running_in_process_); | 262 DCHECK(is_running_in_process_); |
| 251 // Duplicate the file handle for in process mode so this function | 263 // Duplicate the file handle for in process mode so this function |
| 252 // has the same semantics for both in process mode and out of | 264 // has the same semantics for both in process mode and out of |
| 253 // process mode (i.e., the remote side must cloes the handle). | 265 // process mode (i.e., the remote side must cloes the handle). |
| 254 return BrokerGetFileHandleForProcess(handle, | 266 return BrokerGetFileHandleForProcess(handle, |
| 255 base::GetCurrentProcId(), | 267 base::GetCurrentProcId(), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 266 PP_Instance pp_instance) const { | 278 PP_Instance pp_instance) const { |
| 267 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); | 279 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); |
| 268 if (!instance) | 280 if (!instance) |
| 269 return NULL; | 281 return NULL; |
| 270 if (!instance->IsValidInstanceOf(module_)) | 282 if (!instance->IsValidInstanceOf(module_)) |
| 271 return NULL; | 283 return NULL; |
| 272 return instance; | 284 return instance; |
| 273 } | 285 } |
| 274 | 286 |
| 275 } // namespace content | 287 } // namespace content |
| OLD | NEW |