Index: content/renderer/pepper/pepper_plugin_delegate_impl.cc |
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
index 55c3e12266dc22fea8062eba44318dc0d0786c62..85b757810c01979e036c0a98f79ad17afd8b1b32 100644 |
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc |
@@ -81,6 +81,7 @@ |
#include "ppapi/proxy/url_loader_resource.h" |
#include "ppapi/shared_impl/api_id.h" |
#include "ppapi/shared_impl/file_path.h" |
+#include "ppapi/shared_impl/file_type_conversion.h" |
#include "ppapi/shared_impl/platform_file.h" |
#include "ppapi/shared_impl/ppapi_globals.h" |
#include "ppapi/shared_impl/ppapi_permissions.h" |
@@ -901,12 +902,12 @@ void PepperPluginDelegateImpl::OnPpapiBrokerPermissionResult( |
bool PepperPluginDelegateImpl::AsyncOpenFile( |
const base::FilePath& path, |
- int flags, |
+ int pp_open_flags, |
const AsyncOpenFileCallback& callback) { |
int message_id = pending_async_open_files_.Add( |
new AsyncOpenFileCallback(callback)); |
- IPC::Message* msg = new ViewHostMsg_AsyncOpenFile( |
- render_view_->routing_id(), path, flags, message_id); |
+ IPC::Message* msg = new ViewHostMsg_AsyncOpenPepperFile( |
+ render_view_->routing_id(), path, pp_open_flags, message_id); |
return render_view_->Send(msg); |
} |
@@ -1062,12 +1063,21 @@ void PepperPluginDelegateImpl::ReadDirectory( |
void PepperPluginDelegateImpl::AsyncOpenFileSystemURL( |
const GURL& path, |
- int flags, |
+ int pp_open_flags, |
const AsyncOpenFileSystemURLCallback& callback) { |
+ // TODO(tommycli): Eventually just pass the Pepper flags straight to the |
+ // FileSystemDispatcher so it can handle doing the security check. |
+ int platform_file_flags = 0; |
+ if (!ppapi::PepperFileOpenFlagsToPlatformFileFlags( |
+ pp_open_flags, &platform_file_flags)) { |
+ DidFailOpenFileSystemURL(callback, base::PLATFORM_FILE_ERROR_FAILED); |
+ return; |
+ } |
+ |
FileSystemDispatcher* file_system_dispatcher = |
ChildThread::current()->file_system_dispatcher(); |
file_system_dispatcher->OpenFile( |
- path, flags, |
+ path, platform_file_flags, |
base::Bind(&DidOpenFileSystemURL, callback), |
base::Bind(&DidFailOpenFileSystemURL, callback)); |
} |