| 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/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "content/renderer/render_view_impl.h" | 57 #include "content/renderer/render_view_impl.h" |
| 58 #include "content/renderer/render_widget_fullscreen_pepper.h" | 58 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 59 #include "content/renderer/webplugin_delegate_proxy.h" | 59 #include "content/renderer/webplugin_delegate_proxy.h" |
| 60 #include "googleurl/src/gurl.h" | 60 #include "googleurl/src/gurl.h" |
| 61 #include "ipc/ipc_channel_handle.h" | 61 #include "ipc/ipc_channel_handle.h" |
| 62 #include "media/base/audio_hardware_config.h" | 62 #include "media/base/audio_hardware_config.h" |
| 63 #include "media/video/capture/video_capture_proxy.h" | 63 #include "media/video/capture/video_capture_proxy.h" |
| 64 #include "ppapi/c/dev/pp_video_dev.h" | 64 #include "ppapi/c/dev/pp_video_dev.h" |
| 65 #include "ppapi/c/pp_errors.h" | 65 #include "ppapi/c/pp_errors.h" |
| 66 #include "ppapi/c/private/ppb_flash.h" | 66 #include "ppapi/c/private/ppb_flash.h" |
| 67 #include "ppapi/host/file_system_registry.h" |
| 67 #include "ppapi/host/ppapi_host.h" | 68 #include "ppapi/host/ppapi_host.h" |
| 68 #include "ppapi/proxy/host_dispatcher.h" | 69 #include "ppapi/proxy/host_dispatcher.h" |
| 69 #include "ppapi/proxy/ppapi_messages.h" | 70 #include "ppapi/proxy/ppapi_messages.h" |
| 70 #include "ppapi/shared_impl/file_path.h" | 71 #include "ppapi/shared_impl/file_path.h" |
| 71 #include "ppapi/shared_impl/platform_file.h" | 72 #include "ppapi/shared_impl/platform_file.h" |
| 72 #include "ppapi/shared_impl/ppapi_permissions.h" | 73 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 73 #include "ppapi/shared_impl/ppapi_preferences.h" | 74 #include "ppapi/shared_impl/ppapi_preferences.h" |
| 74 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | 75 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
| 75 #include "ppapi/thunk/enter.h" | 76 #include "ppapi/thunk/enter.h" |
| 76 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" | 77 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 338 |
| 338 ppapi::PpapiPermissions perms( | 339 ppapi::PpapiPermissions perms( |
| 339 PepperPluginRegistry::GetInstance()->GetInfoForPlugin( | 340 PepperPluginRegistry::GetInstance()->GetInfoForPlugin( |
| 340 webplugin_info)->permissions); | 341 webplugin_info)->permissions); |
| 341 RendererPpapiHostImpl* host_impl = | 342 RendererPpapiHostImpl* host_impl = |
| 342 RendererPpapiHostImpl::CreateOnModuleForInProcess( | 343 RendererPpapiHostImpl::CreateOnModuleForInProcess( |
| 343 module, perms); | 344 module, perms); |
| 344 render_view->PpapiPluginCreated(host_impl); | 345 render_view->PpapiPluginCreated(host_impl); |
| 345 } | 346 } |
| 346 | 347 |
| 347 template <typename HostType> | |
| 348 const HostType* GetRendererResourceHost( | |
| 349 PP_Instance instance, PP_Resource resource) { | |
| 350 const ppapi::host::PpapiHost* ppapi_host = | |
| 351 RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost(); | |
| 352 if (!resource || !ppapi_host) | |
| 353 return NULL; | |
| 354 return static_cast<HostType*>(ppapi_host->GetResourceHost(resource)); | |
| 355 } | |
| 356 | |
| 357 } // namespace | 348 } // namespace |
| 358 | 349 |
| 359 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view) | 350 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view) |
| 360 : RenderViewObserver(render_view), | 351 : RenderViewObserver(render_view), |
| 361 render_view_(render_view), | 352 render_view_(render_view), |
| 362 focused_plugin_(NULL), | 353 focused_plugin_(NULL), |
| 363 last_mouse_event_target_(NULL), | 354 last_mouse_event_target_(NULL), |
| 364 device_enumeration_event_handler_( | 355 device_enumeration_event_handler_( |
| 365 new PepperDeviceEnumerationEventHandler()) { | 356 new PepperDeviceEnumerationEventHandler()) { |
| 366 } | 357 } |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 // event target. Potentially a Pepper plugin will receive the event. | 1016 // event target. Potentially a Pepper plugin will receive the event. |
| 1026 // In order to tell whether a plugin gets the last mouse event and which it | 1017 // In order to tell whether a plugin gets the last mouse event and which it |
| 1027 // is, we set |last_mouse_event_target_| to NULL here. If a plugin gets the | 1018 // is, we set |last_mouse_event_target_| to NULL here. If a plugin gets the |
| 1028 // event, it will notify us via DidReceiveMouseEvent() and set itself as | 1019 // event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 1029 // |last_mouse_event_target_|. | 1020 // |last_mouse_event_target_|. |
| 1030 last_mouse_event_target_ = NULL; | 1021 last_mouse_event_target_ = NULL; |
| 1031 } | 1022 } |
| 1032 | 1023 |
| 1033 bool PepperPluginDelegateImpl::IsFileSystemOpened(PP_Instance instance, | 1024 bool PepperPluginDelegateImpl::IsFileSystemOpened(PP_Instance instance, |
| 1034 PP_Resource resource) const { | 1025 PP_Resource resource) const { |
| 1035 const PepperFileSystemHost* host = | 1026 return ppapi::host::FileSystemRegistry::GetInstance()-> |
| 1036 GetRendererResourceHost<PepperFileSystemHost>(instance, resource); | 1027 LookUp(instance, resource).IsOpened(); |
| 1037 return host && host->IsOpened(); | |
| 1038 } | 1028 } |
| 1039 | 1029 |
| 1040 PP_FileSystemType PepperPluginDelegateImpl::GetFileSystemType( | 1030 PP_FileSystemType PepperPluginDelegateImpl::GetFileSystemType( |
| 1041 PP_Instance instance, PP_Resource resource) const { | 1031 PP_Instance instance, |
| 1042 const PepperFileSystemHost* host = | 1032 PP_Resource resource) const { |
| 1043 GetRendererResourceHost<PepperFileSystemHost>(instance, resource); | 1033 return ppapi::host::FileSystemRegistry::GetInstance()-> |
| 1044 return host ? host->GetType() : PP_FILESYSTEMTYPE_INVALID; | 1034 LookUp(instance, resource).GetType(); |
| 1045 } | 1035 } |
| 1046 | 1036 |
| 1047 GURL PepperPluginDelegateImpl::GetFileSystemRootUrl( | 1037 GURL PepperPluginDelegateImpl::GetFileSystemRootUrl( |
| 1048 PP_Instance instance, PP_Resource resource) const { | 1038 PP_Instance instance, PP_Resource resource) const { |
| 1049 const PepperFileSystemHost* host = | 1039 return ppapi::host::FileSystemRegistry::GetInstance()-> |
| 1050 GetRendererResourceHost<PepperFileSystemHost>(instance, resource); | 1040 LookUp(instance, resource).GetRootUrl(); |
| 1051 return host ? host->GetRootUrl() : GURL(); | |
| 1052 } | 1041 } |
| 1053 | 1042 |
| 1054 bool PepperPluginDelegateImpl::MakeDirectory( | 1043 bool PepperPluginDelegateImpl::MakeDirectory( |
| 1055 const GURL& path, | 1044 const GURL& path, |
| 1056 bool recursive, | 1045 bool recursive, |
| 1057 fileapi::FileSystemCallbackDispatcher* dispatcher) { | 1046 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 1058 FileSystemDispatcher* file_system_dispatcher = | 1047 FileSystemDispatcher* file_system_dispatcher = |
| 1059 ChildThread::current()->file_system_dispatcher(); | 1048 ChildThread::current()->file_system_dispatcher(); |
| 1060 return file_system_dispatcher->Create( | 1049 return file_system_dispatcher->Create( |
| 1061 path, false, true, recursive, dispatcher); | 1050 path, false, true, recursive, dispatcher); |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 should_close_source); | 1632 should_close_source); |
| 1644 } | 1633 } |
| 1645 | 1634 |
| 1646 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { | 1635 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { |
| 1647 RendererPpapiHostImpl* host = | 1636 RendererPpapiHostImpl* host = |
| 1648 RendererPpapiHostImpl::GetForPPInstance(instance); | 1637 RendererPpapiHostImpl::GetForPPInstance(instance); |
| 1649 return host && host->IsRunningInProcess(); | 1638 return host && host->IsRunningInProcess(); |
| 1650 } | 1639 } |
| 1651 | 1640 |
| 1652 } // namespace content | 1641 } // namespace content |
| OLD | NEW |