diff options
Diffstat (limited to 'webkit/plugins/ppapi/ppb_file_system_impl.cc')
-rw-r--r-- | webkit/plugins/ppapi/ppb_file_system_impl.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/webkit/plugins/ppapi/ppb_file_system_impl.cc b/webkit/plugins/ppapi/ppb_file_system_impl.cc index 2a4bb05..ac9f900 100644 --- a/webkit/plugins/ppapi/ppb_file_system_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_system_impl.cc @@ -18,18 +18,16 @@ #include "webkit/plugins/ppapi/plugin_module.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" -#include "webkit/plugins/ppapi/resource.h" -#include "webkit/plugins/ppapi/resource_tracker.h" +#include "webkit/plugins/ppapi/resource_helper.h" using ppapi::thunk::PPB_FileSystem_API; namespace webkit { namespace ppapi { -PPB_FileSystem_Impl::PPB_FileSystem_Impl(PluginInstance* instance, +PPB_FileSystem_Impl::PPB_FileSystem_Impl(PP_Instance instance, PP_FileSystemType type) : Resource(instance), - instance_(instance), type_(type), opened_(false), called_open_(false) { @@ -40,7 +38,7 @@ PPB_FileSystem_Impl::~PPB_FileSystem_Impl() { } // static -PP_Resource PPB_FileSystem_Impl::Create(PluginInstance* instance, +PP_Resource PPB_FileSystem_Impl::Create(PP_Instance instance, PP_FileSystemType type) { if (type != PP_FILESYSTEMTYPE_EXTERNAL && type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && @@ -64,14 +62,18 @@ int32_t PPB_FileSystem_Impl::Open(int64_t expected_size, type_ != PP_FILESYSTEMTYPE_LOCALTEMPORARY) return PP_ERROR_FAILED; + PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); + if (!plugin_instance) + return PP_ERROR_FAILED; + fileapi::FileSystemType file_system_type = (type_ == PP_FILESYSTEMTYPE_LOCALTEMPORARY ? fileapi::kFileSystemTypeTemporary : fileapi::kFileSystemTypePersistent); - if (!instance()->delegate()->OpenFileSystem( - instance()->container()->element().document().url(), + if (!plugin_instance->delegate()->OpenFileSystem( + plugin_instance->container()->element().document().url(), file_system_type, expected_size, - new FileCallbacks(instance()->module()->AsWeakPtr(), + new FileCallbacks(plugin_instance->module()->AsWeakPtr(), pp_resource(), callback, NULL, scoped_refptr<PPB_FileSystem_Impl>(this), NULL))) return PP_ERROR_FAILED; |