Chromium Code Reviews| Index: webkit/plugins/ppapi/ppb_file_system_impl.cc |
| =================================================================== |
| --- webkit/plugins/ppapi/ppb_file_system_impl.cc (revision 75471) |
| +++ webkit/plugins/ppapi/ppb_file_system_impl.cc (working copy) |
| @@ -12,6 +12,7 @@ |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| #include "webkit/fileapi/file_system_types.h" |
| +#include "webkit/plugins/ppapi/common.h" |
| #include "webkit/plugins/ppapi/file_callbacks.h" |
| #include "webkit/plugins/ppapi/plugin_delegate.h" |
| #include "webkit/plugins/ppapi/plugin_module.h" |
| @@ -31,11 +32,22 @@ |
| if (!plugin_instance) |
| return 0; |
| + if (type != PP_FILESYSTEMTYPE_EXTERNAL && |
| + type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && |
| + type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) |
| + return 0; |
| + |
| PPB_FileSystem_Impl* file_system = |
| new PPB_FileSystem_Impl(plugin_instance, type); |
| return file_system->GetReference(); |
| } |
| +PP_Bool IsFileSystem(PP_Resource resource) { |
| + scoped_refptr<PPB_FileSystem_Impl> file_system( |
| + Resource::GetAs<PPB_FileSystem_Impl>(resource)); |
| + return BoolToPPBool(!!file_system.get()); |
| +} |
| + |
| int32_t Open(PP_Resource file_system_id, |
| int64 expected_size, |
| PP_CompletionCallback callback) { |
| @@ -66,9 +78,19 @@ |
| return PP_ERROR_WOULDBLOCK; |
| } |
| +PP_FileSystemType_Dev GetType(PP_Resource resource) { |
| + scoped_refptr<PPB_FileSystem_Impl> file_system( |
| + Resource::GetAs<PPB_FileSystem_Impl>(resource)); |
| + if (!file_system) |
| + return PP_FILESYSTEMTYPE_NONE; |
|
vtl
2011/02/21 19:06:00
Maybe PP_FILESYSTEMTYPE_INVALID would be more appr
brettw
2011/02/21 19:19:10
Done.
|
| + return file_system->type(); |
| +} |
| + |
| const PPB_FileSystem_Dev ppb_filesystem = { |
| &Create, |
| - &Open |
| + &IsFileSystem, |
| + &Open, |
| + &GetType |
| }; |
| } // namespace |
| @@ -79,6 +101,7 @@ |
| instance_(instance), |
| type_(type), |
| opened_(false) { |
| + DCHECK(type_ != PP_FILESYSTEMTYPE_NONE); |
| } |
| PPB_FileSystem_Impl* PPB_FileSystem_Impl::AsPPB_FileSystem_Impl() { |