| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #include "media/video/capture/video_capture_proxy.h" | 74 #include "media/video/capture/video_capture_proxy.h" |
| 75 #include "ppapi/c/dev/pp_video_dev.h" | 75 #include "ppapi/c/dev/pp_video_dev.h" |
| 76 #include "ppapi/c/pp_errors.h" | 76 #include "ppapi/c/pp_errors.h" |
| 77 #include "ppapi/c/private/ppb_flash.h" | 77 #include "ppapi/c/private/ppb_flash.h" |
| 78 #include "ppapi/host/ppapi_host.h" | 78 #include "ppapi/host/ppapi_host.h" |
| 79 #include "ppapi/proxy/host_dispatcher.h" | 79 #include "ppapi/proxy/host_dispatcher.h" |
| 80 #include "ppapi/proxy/ppapi_messages.h" | 80 #include "ppapi/proxy/ppapi_messages.h" |
| 81 #include "ppapi/proxy/url_loader_resource.h" | 81 #include "ppapi/proxy/url_loader_resource.h" |
| 82 #include "ppapi/shared_impl/api_id.h" | 82 #include "ppapi/shared_impl/api_id.h" |
| 83 #include "ppapi/shared_impl/file_path.h" | 83 #include "ppapi/shared_impl/file_path.h" |
| 84 #include "ppapi/shared_impl/file_type_conversion.h" |
| 84 #include "ppapi/shared_impl/platform_file.h" | 85 #include "ppapi/shared_impl/platform_file.h" |
| 85 #include "ppapi/shared_impl/ppapi_globals.h" | 86 #include "ppapi/shared_impl/ppapi_globals.h" |
| 86 #include "ppapi/shared_impl/ppapi_permissions.h" | 87 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 87 #include "ppapi/shared_impl/ppapi_preferences.h" | 88 #include "ppapi/shared_impl/ppapi_preferences.h" |
| 88 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | 89 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
| 89 #include "ppapi/shared_impl/ppp_instance_combined.h" | 90 #include "ppapi/shared_impl/ppp_instance_combined.h" |
| 90 #include "ppapi/shared_impl/resource_tracker.h" | 91 #include "ppapi/shared_impl/resource_tracker.h" |
| 91 #include "ppapi/shared_impl/socket_option_data.h" | 92 #include "ppapi/shared_impl/socket_option_data.h" |
| 92 #include "ppapi/thunk/enter.h" | 93 #include "ppapi/thunk/enter.h" |
| 93 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" | 94 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 if (!plugin_module) | 895 if (!plugin_module) |
| 895 return; | 896 return; |
| 896 | 897 |
| 897 PepperBrokerImpl* broker = | 898 PepperBrokerImpl* broker = |
| 898 static_cast<PepperBrokerImpl*>(plugin_module->GetBroker()); | 899 static_cast<PepperBrokerImpl*>(plugin_module->GetBroker()); |
| 899 broker->OnBrokerPermissionResult(client.get(), result); | 900 broker->OnBrokerPermissionResult(client.get(), result); |
| 900 } | 901 } |
| 901 | 902 |
| 902 bool PepperPluginDelegateImpl::AsyncOpenFile( | 903 bool PepperPluginDelegateImpl::AsyncOpenFile( |
| 903 const base::FilePath& path, | 904 const base::FilePath& path, |
| 904 int flags, | 905 int pp_open_flags, |
| 905 const AsyncOpenFileCallback& callback) { | 906 const AsyncOpenFileCallback& callback) { |
| 906 int message_id = pending_async_open_files_.Add( | 907 int message_id = pending_async_open_files_.Add( |
| 907 new AsyncOpenFileCallback(callback)); | 908 new AsyncOpenFileCallback(callback)); |
| 908 IPC::Message* msg = new ViewHostMsg_AsyncOpenFile( | 909 IPC::Message* msg = new ViewHostMsg_AsyncOpenPepperFile( |
| 909 render_view_->routing_id(), path, flags, message_id); | 910 render_view_->routing_id(), path, pp_open_flags, message_id); |
| 910 return render_view_->Send(msg); | 911 return render_view_->Send(msg); |
| 911 } | 912 } |
| 912 | 913 |
| 913 void PepperPluginDelegateImpl::OnAsyncFileOpened( | 914 void PepperPluginDelegateImpl::OnAsyncFileOpened( |
| 914 base::PlatformFileError error_code, | 915 base::PlatformFileError error_code, |
| 915 base::PlatformFile file, | 916 base::PlatformFile file, |
| 916 int message_id) { | 917 int message_id) { |
| 917 AsyncOpenFileCallback* callback = | 918 AsyncOpenFileCallback* callback = |
| 918 pending_async_open_files_.Lookup(message_id); | 919 pending_async_open_files_.Lookup(message_id); |
| 919 DCHECK(callback); | 920 DCHECK(callback); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 const ReadDirectoryCallback& success_callback, | 1056 const ReadDirectoryCallback& success_callback, |
| 1056 const StatusCallback& error_callback) { | 1057 const StatusCallback& error_callback) { |
| 1057 FileSystemDispatcher* file_system_dispatcher = | 1058 FileSystemDispatcher* file_system_dispatcher = |
| 1058 ChildThread::current()->file_system_dispatcher(); | 1059 ChildThread::current()->file_system_dispatcher(); |
| 1059 file_system_dispatcher->ReadDirectory( | 1060 file_system_dispatcher->ReadDirectory( |
| 1060 directory_path, success_callback, error_callback); | 1061 directory_path, success_callback, error_callback); |
| 1061 } | 1062 } |
| 1062 | 1063 |
| 1063 void PepperPluginDelegateImpl::AsyncOpenFileSystemURL( | 1064 void PepperPluginDelegateImpl::AsyncOpenFileSystemURL( |
| 1064 const GURL& path, | 1065 const GURL& path, |
| 1065 int flags, | 1066 int pp_open_flags, |
| 1066 const AsyncOpenFileSystemURLCallback& callback) { | 1067 const AsyncOpenFileSystemURLCallback& callback) { |
| 1068 // TODO(tommycli): Eventually just pass the Pepper flags straight to the |
| 1069 // FileSystemDispatcher so it can handle doing the security check. |
| 1070 int platform_file_flags = 0; |
| 1071 if (!ppapi::PepperFileOpenFlagsToPlatformFileFlags( |
| 1072 pp_open_flags, &platform_file_flags)) { |
| 1073 DidFailOpenFileSystemURL(callback, base::PLATFORM_FILE_ERROR_FAILED); |
| 1074 return; |
| 1075 } |
| 1076 |
| 1067 FileSystemDispatcher* file_system_dispatcher = | 1077 FileSystemDispatcher* file_system_dispatcher = |
| 1068 ChildThread::current()->file_system_dispatcher(); | 1078 ChildThread::current()->file_system_dispatcher(); |
| 1069 file_system_dispatcher->OpenFile( | 1079 file_system_dispatcher->OpenFile( |
| 1070 path, flags, | 1080 path, platform_file_flags, |
| 1071 base::Bind(&DidOpenFileSystemURL, callback), | 1081 base::Bind(&DidOpenFileSystemURL, callback), |
| 1072 base::Bind(&DidFailOpenFileSystemURL, callback)); | 1082 base::Bind(&DidFailOpenFileSystemURL, callback)); |
| 1073 } | 1083 } |
| 1074 | 1084 |
| 1075 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( | 1085 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( |
| 1076 const GURL& url, base::FilePath* platform_path) { | 1086 const GURL& url, base::FilePath* platform_path) { |
| 1077 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( | 1087 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( |
| 1078 url, platform_path)); | 1088 url, platform_path)); |
| 1079 } | 1089 } |
| 1080 | 1090 |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 should_close_source); | 1647 should_close_source); |
| 1638 } | 1648 } |
| 1639 | 1649 |
| 1640 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { | 1650 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { |
| 1641 RendererPpapiHostImpl* host = | 1651 RendererPpapiHostImpl* host = |
| 1642 RendererPpapiHostImpl::GetForPPInstance(instance); | 1652 RendererPpapiHostImpl::GetForPPInstance(instance); |
| 1643 return host && host->IsRunningInProcess(); | 1653 return host && host->IsRunningInProcess(); |
| 1644 } | 1654 } |
| 1645 | 1655 |
| 1646 } // namespace content | 1656 } // namespace content |
| OLD | NEW |