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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "content/renderer/render_widget_fullscreen_pepper.h" | 56 #include "content/renderer/render_widget_fullscreen_pepper.h" |
57 #include "content/renderer/webplugin_delegate_proxy.h" | 57 #include "content/renderer/webplugin_delegate_proxy.h" |
58 #include "googleurl/src/gurl.h" | 58 #include "googleurl/src/gurl.h" |
59 #include "ipc/ipc_channel_handle.h" | 59 #include "ipc/ipc_channel_handle.h" |
60 #include "media/video/capture/video_capture_proxy.h" | 60 #include "media/video/capture/video_capture_proxy.h" |
61 #include "ppapi/c/dev/pp_video_dev.h" | 61 #include "ppapi/c/dev/pp_video_dev.h" |
62 #include "ppapi/c/pp_errors.h" | 62 #include "ppapi/c/pp_errors.h" |
63 #include "ppapi/c/private/ppb_flash.h" | 63 #include "ppapi/c/private/ppb_flash.h" |
64 #include "ppapi/host/ppapi_host.h" | 64 #include "ppapi/host/ppapi_host.h" |
65 #include "ppapi/proxy/host_dispatcher.h" | 65 #include "ppapi/proxy/host_dispatcher.h" |
| 66 #include "ppapi/proxy/pepper_file_messages.h" |
66 #include "ppapi/proxy/ppapi_messages.h" | 67 #include "ppapi/proxy/ppapi_messages.h" |
67 #include "ppapi/shared_impl/file_path.h" | 68 #include "ppapi/shared_impl/file_path.h" |
68 #include "ppapi/shared_impl/platform_file.h" | 69 #include "ppapi/shared_impl/platform_file.h" |
69 #include "ppapi/shared_impl/ppapi_permissions.h" | 70 #include "ppapi/shared_impl/ppapi_permissions.h" |
70 #include "ppapi/shared_impl/ppapi_preferences.h" | 71 #include "ppapi/shared_impl/ppapi_preferences.h" |
71 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | 72 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
72 #include "ppapi/thunk/enter.h" | 73 #include "ppapi/thunk/enter.h" |
73 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" | 74 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" |
74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 75 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
75 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 76 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 const AsyncOpenFileSystemURLCallback& callback) { | 1065 const AsyncOpenFileSystemURLCallback& callback) { |
1065 | 1066 |
1066 FileSystemDispatcher* file_system_dispatcher = | 1067 FileSystemDispatcher* file_system_dispatcher = |
1067 ChildThread::current()->file_system_dispatcher(); | 1068 ChildThread::current()->file_system_dispatcher(); |
1068 return file_system_dispatcher->OpenFile(path, flags, | 1069 return file_system_dispatcher->OpenFile(path, flags, |
1069 new AsyncOpenFileSystemURLCallbackTranslator( | 1070 new AsyncOpenFileSystemURLCallbackTranslator( |
1070 callback, | 1071 callback, |
1071 base::Bind(&DoNotifyCloseFile, path))); | 1072 base::Bind(&DoNotifyCloseFile, path))); |
1072 } | 1073 } |
1073 | 1074 |
| 1075 base::PlatformFileError PepperPluginDelegateImpl::OpenFile( |
| 1076 const ppapi::PepperFilePath& path, |
| 1077 int flags, |
| 1078 base::PlatformFile* file) { |
| 1079 IPC::PlatformFileForTransit transit_file; |
| 1080 base::PlatformFileError error; |
| 1081 IPC::Message* msg = new PepperFileMsg_OpenFile( |
| 1082 path, flags, &error, &transit_file); |
| 1083 if (!render_view_->Send(msg)) { |
| 1084 *file = base::kInvalidPlatformFileValue; |
| 1085 return base::PLATFORM_FILE_ERROR_FAILED; |
| 1086 } |
| 1087 *file = IPC::PlatformFileForTransitToPlatformFile(transit_file); |
| 1088 return error; |
| 1089 } |
| 1090 |
| 1091 base::PlatformFileError PepperPluginDelegateImpl::RenameFile( |
| 1092 const ppapi::PepperFilePath& from_path, |
| 1093 const ppapi::PepperFilePath& to_path) { |
| 1094 base::PlatformFileError error; |
| 1095 IPC::Message* msg = new PepperFileMsg_RenameFile(from_path, to_path, &error); |
| 1096 if (!render_view_->Send(msg)) |
| 1097 return base::PLATFORM_FILE_ERROR_FAILED; |
| 1098 return error; |
| 1099 } |
| 1100 |
| 1101 base::PlatformFileError PepperPluginDelegateImpl::DeleteFileOrDir( |
| 1102 const ppapi::PepperFilePath& path, |
| 1103 bool recursive) { |
| 1104 base::PlatformFileError error; |
| 1105 IPC::Message* msg = new PepperFileMsg_DeleteFileOrDir( |
| 1106 path, recursive, &error); |
| 1107 if (!render_view_->Send(msg)) |
| 1108 return base::PLATFORM_FILE_ERROR_FAILED; |
| 1109 return error; |
| 1110 } |
| 1111 |
| 1112 base::PlatformFileError PepperPluginDelegateImpl::CreateDir( |
| 1113 const ppapi::PepperFilePath& path) { |
| 1114 base::PlatformFileError error; |
| 1115 IPC::Message* msg = new PepperFileMsg_CreateDir(path, &error); |
| 1116 if (!render_view_->Send(msg)) |
| 1117 return base::PLATFORM_FILE_ERROR_FAILED; |
| 1118 return error; |
| 1119 } |
| 1120 |
| 1121 base::PlatformFileError PepperPluginDelegateImpl::QueryFile( |
| 1122 const ppapi::PepperFilePath& path, |
| 1123 base::PlatformFileInfo* info) { |
| 1124 base::PlatformFileError error; |
| 1125 IPC::Message* msg = new PepperFileMsg_QueryFile(path, info, &error); |
| 1126 if (!render_view_->Send(msg)) |
| 1127 return base::PLATFORM_FILE_ERROR_FAILED; |
| 1128 return error; |
| 1129 } |
| 1130 |
| 1131 base::PlatformFileError PepperPluginDelegateImpl::GetDirContents( |
| 1132 const ppapi::PepperFilePath& path, |
| 1133 ppapi::DirContents* contents) { |
| 1134 base::PlatformFileError error; |
| 1135 IPC::Message* msg = new PepperFileMsg_GetDirContents(path, contents, &error); |
| 1136 if (!render_view_->Send(msg)) |
| 1137 return base::PLATFORM_FILE_ERROR_FAILED; |
| 1138 return error; |
| 1139 } |
| 1140 |
| 1141 base::PlatformFileError PepperPluginDelegateImpl::CreateTemporaryFile( |
| 1142 base::PlatformFile* file) { |
| 1143 IPC::PlatformFileForTransit transit_file; |
| 1144 base::PlatformFileError error; |
| 1145 IPC::Message* msg = new PepperFileMsg_CreateTemporaryFile(&error, |
| 1146 &transit_file); |
| 1147 if (!render_view_->Send(msg)) { |
| 1148 *file = base::kInvalidPlatformFileValue; |
| 1149 return base::PLATFORM_FILE_ERROR_FAILED; |
| 1150 } |
| 1151 *file = IPC::PlatformFileForTransitToPlatformFile(transit_file); |
| 1152 return error; |
| 1153 } |
| 1154 |
1074 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( | 1155 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( |
1075 const GURL& url, FilePath* platform_path) { | 1156 const GURL& url, FilePath* platform_path) { |
1076 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( | 1157 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( |
1077 url, platform_path)); | 1158 url, platform_path)); |
1078 } | 1159 } |
1079 | 1160 |
1080 scoped_refptr<base::MessageLoopProxy> | 1161 scoped_refptr<base::MessageLoopProxy> |
1081 PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() { | 1162 PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() { |
1082 return RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(); | 1163 return RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(); |
1083 } | 1164 } |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 RenderWidgetFullscreenPepper* container = | 1803 RenderWidgetFullscreenPepper* container = |
1723 static_cast<RenderWidgetFullscreenPepper*>( | 1804 static_cast<RenderWidgetFullscreenPepper*>( |
1724 instance->fullscreen_container()); | 1805 instance->fullscreen_container()); |
1725 return container->mouse_lock_dispatcher(); | 1806 return container->mouse_lock_dispatcher(); |
1726 } else { | 1807 } else { |
1727 return render_view_->mouse_lock_dispatcher(); | 1808 return render_view_->mouse_lock_dispatcher(); |
1728 } | 1809 } |
1729 } | 1810 } |
1730 | 1811 |
1731 } // namespace content | 1812 } // namespace content |
OLD | NEW |