Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(930)

Unified Diff: webkit/plugins/ppapi/ppb_file_system_impl.cc

Issue 6543028: Implement the filesystem proxy. This allows the FileRef tests to pass in the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {
« ppapi/proxy/ppb_file_system_proxy.cc ('K') | « webkit/plugins/ppapi/ppb_file_ref_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698