Index: webkit/plugins/ppapi/ppb_file_io_impl.cc |
diff --git a/webkit/plugins/ppapi/ppb_file_io_impl.cc b/webkit/plugins/ppapi/ppb_file_io_impl.cc |
index d1022709bbf48801b1fad183f63527e9f8349f14..f792123094aa035d2e8a7f28f5279957d6827714 100644 |
--- a/webkit/plugins/ppapi/ppb_file_io_impl.cc |
+++ b/webkit/plugins/ppapi/ppb_file_io_impl.cc |
@@ -6,6 +6,7 @@ |
#include "base/bind.h" |
#include "base/callback.h" |
+#include "base/callback_helpers.h" |
#include "base/file_util.h" |
#include "base/file_util_proxy.h" |
#include "base/message_loop_proxy.h" |
@@ -64,7 +65,7 @@ int32_t PPB_FileIO_Impl::OpenValidated( |
file_system_url_ = file_ref->GetFileSystemURL(); |
if (!plugin_delegate->AsyncOpenFileSystemURL( |
file_system_url_, flags, |
- base::Bind(&PPB_FileIO_Impl::ExecutePlatformOpenFileCallback, |
+ base::Bind(&PPB_FileIO_Impl::ExecuteOpenFileSystemURLCallback, |
weak_factory_.GetWeakPtr()))) |
return PP_ERROR_FAILED; |
} else { |
@@ -211,8 +212,9 @@ void PPB_FileIO_Impl::Close() { |
PluginDelegate* plugin_delegate = GetPluginDelegate(); |
if (file_ != base::kInvalidPlatformFileValue && plugin_delegate) { |
base::FileUtilProxy::Close( |
- plugin_delegate->GetFileThreadMessageLoopProxy(), file_, |
- base::FileUtilProxy::StatusCallback()); |
+ plugin_delegate->GetFileThreadMessageLoopProxy(), |
+ file_, |
+ base::ResetAndReturn(¬ify_close_file_callback_)); |
file_ = base::kInvalidPlatformFileValue; |
quota_file_io_.reset(); |
} |
@@ -294,6 +296,15 @@ void PPB_FileIO_Impl::ExecutePlatformOpenFileCallback( |
ExecuteOpenFileCallback(::ppapi::PlatformFileErrorToPepperError(error_code)); |
} |
+void PPB_FileIO_Impl::ExecuteOpenFileSystemURLCallback( |
+ base::PlatformFileError error_code, |
+ base::PassPlatformFile file, |
+ const PluginDelegate::NotifyCloseFileCallback& callback) { |
+ if (error_code == base::PLATFORM_FILE_OK) |
+ notify_close_file_callback_ = callback; |
+ ExecutePlatformOpenFileCallback(error_code, file); |
+} |
+ |
void PPB_FileIO_Impl::ExecutePlatformQueryCallback( |
base::PlatformFileError error_code, |
const base::PlatformFileInfo& file_info) { |