Commit 491af3c6 authored by nhiroki@chromium.org's avatar nhiroki@chromium.org

[Retry] PPAPI: Add new PPB_FileRef.MakeDirectory to support exclusive operation

Original Review: https://codereview.chromium.org/113363004/

Current PPB_FileRef.MakeDirectory returns PP_OK if a directory exists on
the given path. This makes it difficult to create POSIX compatible API on
top of PPAPI.

This change introduces new PPB_FileRef.MakeDirectory as dev channel API.
That makes a new directory according to the given PP_MakeDirectoryFlags
values. The flags provide exclusive operation option. If exclusive flag
is specified and a directory exists on the given path, the function fails
and returns PP_ERROR_FILEEXISTS.


BUG=314879
TEST=browser_tests
TBR=dmichael@chromium.org,yzshen@chromium.org,tsepez@chromium.org

Review URL: https://codereview.chromium.org/131403004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244148 0039d316-1c4b-4281-b951-d872f2087c98
parent 021b50df
...@@ -124,6 +124,7 @@ bool IsSupportedPepperInterface(const char* name) { ...@@ -124,6 +124,7 @@ bool IsSupportedPepperInterface(const char* name) {
#include "ppapi/thunk/interfaces_ppb_private_flash.h" #include "ppapi/thunk/interfaces_ppb_private_flash.h"
#include "ppapi/thunk/interfaces_ppb_private_no_permissions.h" #include "ppapi/thunk/interfaces_ppb_private_no_permissions.h"
#include "ppapi/thunk/interfaces_ppb_public_dev.h" #include "ppapi/thunk/interfaces_ppb_public_dev.h"
#include "ppapi/thunk/interfaces_ppb_public_dev_channel.h"
#include "ppapi/thunk/interfaces_ppb_public_stable.h" #include "ppapi/thunk/interfaces_ppb_public_stable.h"
#undef UNPROXIED_IFACE #undef UNPROXIED_IFACE
......
...@@ -33,7 +33,7 @@ PepperExternalFileRefBackend::~PepperExternalFileRefBackend() { ...@@ -33,7 +33,7 @@ PepperExternalFileRefBackend::~PepperExternalFileRefBackend() {
int32_t PepperExternalFileRefBackend::MakeDirectory( int32_t PepperExternalFileRefBackend::MakeDirectory(
ppapi::host::ReplyMessageContext reply_context, ppapi::host::ReplyMessageContext reply_context,
bool make_ancestors) { int32_t make_directory_flags) {
// This operation isn't supported for external filesystems. // This operation isn't supported for external filesystems.
return PP_ERROR_NOACCESS; return PP_ERROR_NOACCESS;
} }
......
...@@ -28,7 +28,7 @@ class PepperExternalFileRefBackend : public PepperFileRefBackend { ...@@ -28,7 +28,7 @@ class PepperExternalFileRefBackend : public PepperFileRefBackend {
// PepperFileRefBackend overrides. // PepperFileRefBackend overrides.
virtual int32_t MakeDirectory(ppapi::host::ReplyMessageContext context, virtual int32_t MakeDirectory(ppapi::host::ReplyMessageContext context,
bool make_ancestors) OVERRIDE; int32_t make_directory_flags) OVERRIDE;
virtual int32_t Touch(ppapi::host::ReplyMessageContext context, virtual int32_t Touch(ppapi::host::ReplyMessageContext context,
PP_Time last_accessed_time, PP_Time last_accessed_time,
PP_Time last_modified_time) OVERRIDE; PP_Time last_modified_time) OVERRIDE;
......
...@@ -180,12 +180,12 @@ int32_t PepperFileRefHost::OnResourceMessageReceived( ...@@ -180,12 +180,12 @@ int32_t PepperFileRefHost::OnResourceMessageReceived(
int32_t PepperFileRefHost::OnMakeDirectory( int32_t PepperFileRefHost::OnMakeDirectory(
ppapi::host::HostMessageContext* context, ppapi::host::HostMessageContext* context,
bool make_ancestors) { int32_t make_directory_flags) {
int32_t rv = CanCreate(); int32_t rv = CanCreate();
if (rv != PP_OK) if (rv != PP_OK)
return rv; return rv;
return backend_->MakeDirectory(context->MakeReplyMessageContext(), return backend_->MakeDirectory(
make_ancestors); context->MakeReplyMessageContext(), make_directory_flags);
} }
int32_t PepperFileRefHost::OnTouch(ppapi::host::HostMessageContext* context, int32_t PepperFileRefHost::OnTouch(ppapi::host::HostMessageContext* context,
......
...@@ -29,7 +29,7 @@ class PepperFileRefBackend { ...@@ -29,7 +29,7 @@ class PepperFileRefBackend {
virtual ~PepperFileRefBackend(); virtual ~PepperFileRefBackend();
virtual int32_t MakeDirectory(ppapi::host::ReplyMessageContext context, virtual int32_t MakeDirectory(ppapi::host::ReplyMessageContext context,
bool make_ancestors) = 0; int32_t make_directory_flags) = 0;
virtual int32_t Touch(ppapi::host::ReplyMessageContext context, virtual int32_t Touch(ppapi::host::ReplyMessageContext context,
PP_Time last_accessed_time, PP_Time last_accessed_time,
PP_Time last_modified_time) = 0; PP_Time last_modified_time) = 0;
...@@ -89,7 +89,7 @@ class CONTENT_EXPORT PepperFileRefHost ...@@ -89,7 +89,7 @@ class CONTENT_EXPORT PepperFileRefHost
private: private:
int32_t OnMakeDirectory(ppapi::host::HostMessageContext* context, int32_t OnMakeDirectory(ppapi::host::HostMessageContext* context,
bool make_ancestors); int32_t make_directory_flags);
int32_t OnTouch(ppapi::host::HostMessageContext* context, int32_t OnTouch(ppapi::host::HostMessageContext* context,
PP_Time last_access_time, PP_Time last_access_time,
PP_Time last_modified_time); PP_Time last_modified_time);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "ppapi/c/pp_file_info.h" #include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_resource.h"
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/host/dispatch_host_message.h" #include "ppapi/host/dispatch_host_message.h"
#include "ppapi/host/ppapi_host.h" #include "ppapi/host/ppapi_host.h"
#include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppapi_messages.h"
...@@ -92,14 +93,14 @@ void PepperInternalFileRefBackend::DidFinish( ...@@ -92,14 +93,14 @@ void PepperInternalFileRefBackend::DidFinish(
int32_t PepperInternalFileRefBackend::MakeDirectory( int32_t PepperInternalFileRefBackend::MakeDirectory(
ppapi::host::ReplyMessageContext reply_context, ppapi::host::ReplyMessageContext reply_context,
bool make_ancestors) { int32_t make_directory_flags) {
if (!GetFileSystemURL().is_valid()) if (!GetFileSystemURL().is_valid())
return PP_ERROR_FAILED; return PP_ERROR_FAILED;
GetFileSystemContext()->operation_runner()->CreateDirectory( GetFileSystemContext()->operation_runner()->CreateDirectory(
GetFileSystemURL(), GetFileSystemURL(),
false, !!(make_directory_flags & PP_MAKEDIRECTORYFLAG_EXCLUSIVE),
make_ancestors, !!(make_directory_flags & PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS),
base::Bind(&PepperInternalFileRefBackend::DidFinish, base::Bind(&PepperInternalFileRefBackend::DidFinish,
weak_factory_.GetWeakPtr(), weak_factory_.GetWeakPtr(),
reply_context, reply_context,
......
...@@ -32,7 +32,7 @@ class PepperInternalFileRefBackend : public PepperFileRefBackend { ...@@ -32,7 +32,7 @@ class PepperInternalFileRefBackend : public PepperFileRefBackend {
// PepperFileRefBackend overrides. // PepperFileRefBackend overrides.
virtual int32_t MakeDirectory(ppapi::host::ReplyMessageContext context, virtual int32_t MakeDirectory(ppapi::host::ReplyMessageContext context,
bool make_ancestors) OVERRIDE; int32_t make_directory_flags) OVERRIDE;
virtual int32_t Touch(ppapi::host::ReplyMessageContext context, virtual int32_t Touch(ppapi::host::ReplyMessageContext context,
PP_Time last_accessed_time, PP_Time last_accessed_time,
PP_Time last_modified_time) OVERRIDE; PP_Time last_modified_time) OVERRIDE;
......
...@@ -315,11 +315,12 @@ const void* InternalGetInterface(const char* name) { ...@@ -315,11 +315,12 @@ const void* InternalGetInterface(const char* name) {
#define PROXIED_IFACE(iface_str, iface_struct) \ #define PROXIED_IFACE(iface_str, iface_struct) \
UNPROXIED_IFACE(iface_str, iface_struct) UNPROXIED_IFACE(iface_str, iface_struct)
#include "ppapi/thunk/interfaces_ppb_public_stable.h"
#include "ppapi/thunk/interfaces_ppb_public_dev.h"
#include "ppapi/thunk/interfaces_ppb_private.h" #include "ppapi/thunk/interfaces_ppb_private.h"
#include "ppapi/thunk/interfaces_ppb_private_no_permissions.h"
#include "ppapi/thunk/interfaces_ppb_private_flash.h" #include "ppapi/thunk/interfaces_ppb_private_flash.h"
#include "ppapi/thunk/interfaces_ppb_private_no_permissions.h"
#include "ppapi/thunk/interfaces_ppb_public_dev.h"
#include "ppapi/thunk/interfaces_ppb_public_dev_channel.h"
#include "ppapi/thunk/interfaces_ppb_public_stable.h"
#undef UNPROXIED_API #undef UNPROXIED_API
#undef PROXIED_IFACE #undef PROXIED_IFACE
......
...@@ -548,7 +548,8 @@ Then the ``pp::FileRef::MakeDirectory`` function is called. ...@@ -548,7 +548,8 @@ Then the ``pp::FileRef::MakeDirectory`` function is called.
.. naclcode:: .. naclcode::
int32_t result = ref.MakeDirectory(pp::BlockUntilComplete()); int32_t result = ref.MakeDirectory(
PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete());
if (result != PP_OK) { if (result != PP_OK) {
ShowErrorMessage("Make directory failed", result); ShowErrorMessage("Make directory failed", result);
return; return;
......
...@@ -312,7 +312,8 @@ class FileIoInstance : public pp::Instance { ...@@ -312,7 +312,8 @@ class FileIoInstance : public pp::Instance {
} }
pp::FileRef ref(file_system_, dir_name.c_str()); pp::FileRef ref(file_system_, dir_name.c_str());
int32_t result = ref.MakeDirectory(pp::BlockUntilComplete()); int32_t result = ref.MakeDirectory(
PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete());
if (result != PP_OK) { if (result != PP_OK) {
ShowErrorMessage("Make directory failed", result); ShowErrorMessage("Make directory failed", result);
return; return;
......
...@@ -75,7 +75,8 @@ Error Html5Fs::Mkdir(const Path& path, int permissions) { ...@@ -75,7 +75,8 @@ Error Html5Fs::Mkdir(const Path& path, int permissions) {
return ENOENT; return ENOENT;
int32_t result = ppapi()->GetFileRefInterface()->MakeDirectory( int32_t result = ppapi()->GetFileRefInterface()->MakeDirectory(
fileref_resource.pp_resource(), PP_FALSE, PP_BlockUntilComplete()); fileref_resource.pp_resource(), PP_MAKEDIRECTORYFLAG_NONE,
PP_BlockUntilComplete());
if (result != PP_OK) if (result != PP_OK)
return PPErrorToErrno(result); return PPErrorToErrno(result);
......
...@@ -47,17 +47,17 @@ BEGIN_INTERFACE(FileIoInterface, PPB_FileIO_1_0, PPB_FILEIO_INTERFACE_1_0) ...@@ -47,17 +47,17 @@ BEGIN_INTERFACE(FileIoInterface, PPB_FileIO_1_0, PPB_FILEIO_INTERFACE_1_0)
const char*, int32_t, PP_CompletionCallback) const char*, int32_t, PP_CompletionCallback)
END_INTERFACE(FileIoInterface, PPB_FileIO_1_0) END_INTERFACE(FileIoInterface, PPB_FileIO_1_0)
BEGIN_INTERFACE(FileRefInterface, PPB_FileRef_1_1, PPB_FILEREF_INTERFACE_1_1) BEGIN_INTERFACE(FileRefInterface, PPB_FileRef_1_2, PPB_FILEREF_INTERFACE_1_2)
METHOD2(FileRefInterface, PP_Resource, Create, PP_Resource, const char*) METHOD2(FileRefInterface, PP_Resource, Create, PP_Resource, const char*)
METHOD2(FileRefInterface, int32_t, Delete, PP_Resource, PP_CompletionCallback) METHOD2(FileRefInterface, int32_t, Delete, PP_Resource, PP_CompletionCallback)
METHOD1(FileRefInterface, PP_Var, GetName, PP_Resource) METHOD1(FileRefInterface, PP_Var, GetName, PP_Resource)
METHOD3(FileRefInterface, int32_t, MakeDirectory, PP_Resource, PP_Bool, METHOD3(FileRefInterface, int32_t, MakeDirectory, PP_Resource, int32_t,
PP_CompletionCallback) PP_CompletionCallback)
METHOD3(FileRefInterface, int32_t, Query, PP_Resource, PP_FileInfo*, METHOD3(FileRefInterface, int32_t, Query, PP_Resource, PP_FileInfo*,
PP_CompletionCallback) PP_CompletionCallback)
METHOD3(FileRefInterface, int32_t, ReadDirectoryEntries, PP_Resource, METHOD3(FileRefInterface, int32_t, ReadDirectoryEntries, PP_Resource,
const PP_ArrayOutput&, PP_CompletionCallback) const PP_ArrayOutput&, PP_CompletionCallback)
END_INTERFACE(FileRefInterface, PPB_FileRef_1_1) END_INTERFACE(FileRefInterface, PPB_FileRef_1_2)
BEGIN_INTERFACE(FileSystemInterface, PPB_FileSystem_1_0, BEGIN_INTERFACE(FileSystemInterface, PPB_FileSystem_1_0,
PPB_FILESYSTEM_INTERFACE_1_0) PPB_FILESYSTEM_INTERFACE_1_0)
......
...@@ -500,7 +500,7 @@ PP_Var FakeFileRefInterface::GetName(PP_Resource file_ref) { ...@@ -500,7 +500,7 @@ PP_Var FakeFileRefInterface::GetName(PP_Resource file_ref) {
} }
int32_t FakeFileRefInterface::MakeDirectory(PP_Resource directory_ref, int32_t FakeFileRefInterface::MakeDirectory(PP_Resource directory_ref,
PP_Bool make_ancestors, int32_t make_directory_flags,
PP_CompletionCallback callback) { PP_CompletionCallback callback) {
FakeFileRefResource* directory_ref_resource = FakeFileRefResource* directory_ref_resource =
core_interface_->resource_manager()->Get<FakeFileRefResource>( core_interface_->resource_manager()->Get<FakeFileRefResource>(
...@@ -508,9 +508,9 @@ int32_t FakeFileRefInterface::MakeDirectory(PP_Resource directory_ref, ...@@ -508,9 +508,9 @@ int32_t FakeFileRefInterface::MakeDirectory(PP_Resource directory_ref,
if (directory_ref_resource == NULL) if (directory_ref_resource == NULL)
return PP_ERROR_BADRESOURCE; return PP_ERROR_BADRESOURCE;
// TODO(binji): We don't currently use make_ancestors==PP_TRUE in nacl_io, so // TODO(binji): We don't currently use make_directory_flags in nacl_io, so
// I won't bother implementing it. // I won't bother implementing it.
if (make_ancestors == PP_TRUE) if (make_directory_flags)
return PP_ERROR_FAILED; return PP_ERROR_FAILED;
FakeHtml5FsFilesystem* filesystem = directory_ref_resource->filesystem; FakeHtml5FsFilesystem* filesystem = directory_ref_resource->filesystem;
......
...@@ -136,7 +136,7 @@ class FakeFileRefInterface : public nacl_io::FileRefInterface { ...@@ -136,7 +136,7 @@ class FakeFileRefInterface : public nacl_io::FileRefInterface {
virtual PP_Resource Create(PP_Resource file_system, const char* path); virtual PP_Resource Create(PP_Resource file_system, const char* path);
virtual PP_Var GetName(PP_Resource file_ref); virtual PP_Var GetName(PP_Resource file_ref);
virtual int32_t MakeDirectory(PP_Resource directory_ref, virtual int32_t MakeDirectory(PP_Resource directory_ref,
PP_Bool make_ancestors, int32_t make_directory_flags,
PP_CompletionCallback callback); PP_CompletionCallback callback);
virtual int32_t Delete(PP_Resource file_ref, PP_CompletionCallback callback); virtual int32_t Delete(PP_Resource file_ref, PP_CompletionCallback callback);
virtual int32_t Query(PP_Resource file_ref, virtual int32_t Query(PP_Resource file_ref,
......
...@@ -10,7 +10,25 @@ ...@@ -10,7 +10,25 @@
label Chrome { label Chrome {
M14 = 1.0, M14 = 1.0,
M28 = 1.1 M28 = 1.1,
[channel=dev] M34 = 1.2
};
/**
* The <code>PP_MakeDirectoryFlags</code> enum contains flags used to control
* behavior of <code>PPB_FileRef.MakeDirectory()</code>.
*/
enum PP_MakeDirectoryFlags {
PP_MAKEDIRECTORYFLAG_NONE = 0 << 0,
/** Requests that ancestor directories are created if they do not exist. */
PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS = 1 << 0,
/**
* Requests that the PPB_FileRef.MakeDirectory() call fails if the directory
* already exists.
*/
PP_MAKEDIRECTORYFLAG_EXCLUSIVE = 1 << 1
}; };
/** /**
...@@ -105,16 +123,39 @@ interface PPB_FileRef { ...@@ -105,16 +123,39 @@ interface PPB_FileRef {
* @param[in] make_ancestors A <code>PP_Bool</code> set to * @param[in] make_ancestors A <code>PP_Bool</code> set to
* <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code> * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code>
* if ancestor directories are not needed. * if ancestor directories are not needed.
* @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
* completion of MakeDirectory().
* *
* @return An int32_t containing an error code from <code>pp_errors.h</code>. * @return An int32_t containing an error code from <code>pp_errors.h</code>.
* Succeeds if the directory already exists. Fails if ancestor directories * Succeeds if the directory already exists. Fails if ancestor directories
* do not exist and <code>make_ancestors</code> was passed as * do not exist and <code>make_ancestors</code> was passed as
* <code>PP_FALSE</code>. * <code>PP_FALSE</code>.
*/ */
[deprecate=1.2]
int32_t MakeDirectory([in] PP_Resource directory_ref, int32_t MakeDirectory([in] PP_Resource directory_ref,
[in] PP_Bool make_ancestors, [in] PP_Bool make_ancestors,
[in] PP_CompletionCallback callback); [in] PP_CompletionCallback callback);
/**
* MakeDirectory() makes a new directory in the file system according to the
* given <code>make_directory_flags</code>, which is a bit-mask of the
* <code>PP_MakeDirectoryFlags</code> values. It is not valid to make a
* directory in the external file system.
*
* @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
* reference.
* @param[in] make_directory_flags A bit-mask of the
* <code>PP_MakeDirectoryFlags</code> values.
* @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
* completion of MakeDirectory().
*
* @return An int32_t containing an error code from <code>pp_errors.h</code>.
*/
[version=1.2]
int32_t MakeDirectory([in] PP_Resource directory_ref,
[in] int32_t make_directory_flags,
[in] PP_CompletionCallback callback);
/** /**
* Touch() Updates time stamps for a file. You must have write access to the * Touch() Updates time stamps for a file. You must have write access to the
* file if it exists in the external filesystem. * file if it exists in the external filesystem.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
/* From ppb_file_ref.idl modified Thu Aug 15 10:50:43 2013. */ /* From ppb_file_ref.idl modified Wed Jan 8 12:40:12 2014. */
#ifndef PPAPI_C_PPB_FILE_REF_H_ #ifndef PPAPI_C_PPB_FILE_REF_H_
#define PPAPI_C_PPB_FILE_REF_H_ #define PPAPI_C_PPB_FILE_REF_H_
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define PPB_FILEREF_INTERFACE_1_0 "PPB_FileRef;1.0" #define PPB_FILEREF_INTERFACE_1_0 "PPB_FileRef;1.0"
#define PPB_FILEREF_INTERFACE_1_1 "PPB_FileRef;1.1" #define PPB_FILEREF_INTERFACE_1_1 "PPB_FileRef;1.1"
#define PPB_FILEREF_INTERFACE_1_2 "PPB_FileRef;1.2" /* dev */
#define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_1 #define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_1
/** /**
...@@ -29,6 +30,28 @@ ...@@ -29,6 +30,28 @@
*/ */
/**
* @addtogroup Enums
* @{
*/
/**
* The <code>PP_MakeDirectoryFlags</code> enum contains flags used to control
* behavior of <code>PPB_FileRef.MakeDirectory()</code>.
*/
typedef enum {
PP_MAKEDIRECTORYFLAG_NONE = 0 << 0,
/** Requests that ancestor directories are created if they do not exist. */
PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS = 1 << 0,
/**
* Requests that the PPB_FileRef.MakeDirectory() call fails if the directory
* already exists.
*/
PP_MAKEDIRECTORYFLAG_EXCLUSIVE = 1 << 1
} PP_MakeDirectoryFlags;
/**
* @}
*/
/** /**
* @addtogroup Interfaces * @addtogroup Interfaces
* @{ * @{
...@@ -38,7 +61,7 @@ ...@@ -38,7 +61,7 @@
* a file system. This struct contains a <code>PP_FileSystemType</code> * a file system. This struct contains a <code>PP_FileSystemType</code>
* identifier and a file path string. * identifier and a file path string.
*/ */
struct PPB_FileRef_1_1 { struct PPB_FileRef_1_2 { /* dev */
/** /**
* Create() creates a weak pointer to a file in the given file system. File * Create() creates a weak pointer to a file in the given file system. File
* paths are POSIX style. * paths are POSIX style.
...@@ -110,24 +133,22 @@ struct PPB_FileRef_1_1 { ...@@ -110,24 +133,22 @@ struct PPB_FileRef_1_1 {
*/ */
PP_Resource (*GetParent)(PP_Resource file_ref); PP_Resource (*GetParent)(PP_Resource file_ref);
/** /**
* MakeDirectory() makes a new directory in the file system as well as any * MakeDirectory() makes a new directory in the file system according to the
* parent directories if the <code>make_ancestors</code> argument is * given <code>make_directory_flags</code>, which is a bit-mask of the
* <code>PP_TRUE</code>. It is not valid to make a directory in the external * <code>PP_MakeDirectoryFlags</code> values. It is not valid to make a
* file system. * directory in the external file system.
* *
* @param[in] file_ref A <code>PP_Resource</code> corresponding to a file * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
* reference. * reference.
* @param[in] make_ancestors A <code>PP_Bool</code> set to * @param[in] make_directory_flags A bit-mask of the
* <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code> * <code>PP_MakeDirectoryFlags</code> values.
* if ancestor directories are not needed. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
* completion of MakeDirectory().
* *
* @return An int32_t containing an error code from <code>pp_errors.h</code>. * @return An int32_t containing an error code from <code>pp_errors.h</code>.
* Succeeds if the directory already exists. Fails if ancestor directories
* do not exist and <code>make_ancestors</code> was passed as
* <code>PP_FALSE</code>.
*/ */
int32_t (*MakeDirectory)(PP_Resource directory_ref, int32_t (*MakeDirectory)(PP_Resource directory_ref,
PP_Bool make_ancestors, int32_t make_directory_flags,
struct PP_CompletionCallback callback); struct PP_CompletionCallback callback);
/** /**
* Touch() Updates time stamps for a file. You must have write access to the * Touch() Updates time stamps for a file. You must have write access to the
...@@ -212,8 +233,6 @@ struct PPB_FileRef_1_1 { ...@@ -212,8 +233,6 @@ struct PPB_FileRef_1_1 {
struct PP_CompletionCallback callback); struct PP_CompletionCallback callback);
}; };
typedef struct PPB_FileRef_1_1 PPB_FileRef;
struct PPB_FileRef_1_0 { struct PPB_FileRef_1_0 {
PP_Resource (*Create)(PP_Resource file_system, const char* path); PP_Resource (*Create)(PP_Resource file_system, const char* path);
PP_Bool (*IsFileRef)(PP_Resource resource); PP_Bool (*IsFileRef)(PP_Resource resource);
...@@ -234,6 +253,35 @@ struct PPB_FileRef_1_0 { ...@@ -234,6 +253,35 @@ struct PPB_FileRef_1_0 {
PP_Resource new_file_ref, PP_Resource new_file_ref,
struct PP_CompletionCallback callback); struct PP_CompletionCallback callback);
}; };
struct PPB_FileRef_1_1 {
PP_Resource (*Create)(PP_Resource file_system, const char* path);
PP_Bool (*IsFileRef)(PP_Resource resource);
PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref);
struct PP_Var (*GetName)(PP_Resource file_ref);
struct PP_Var (*GetPath)(PP_Resource file_ref);
PP_Resource (*GetParent)(PP_Resource file_ref);
int32_t (*MakeDirectory)(PP_Resource directory_ref,
PP_Bool make_ancestors,
struct PP_CompletionCallback callback);
int32_t (*Touch)(PP_Resource file_ref,
PP_Time last_access_time,
PP_Time last_modified_time,
struct PP_CompletionCallback callback);
int32_t (*Delete)(PP_Resource file_ref,
struct PP_CompletionCallback callback);
int32_t (*Rename)(PP_Resource file_ref,
PP_Resource new_file_ref,
struct PP_CompletionCallback callback);
int32_t (*Query)(PP_Resource file_ref,
struct PP_FileInfo* info,
struct PP_CompletionCallback callback);
int32_t (*ReadDirectoryEntries)(PP_Resource file_ref,
struct PP_ArrayOutput output,
struct PP_CompletionCallback callback);
};
typedef struct PPB_FileRef_1_1 PPB_FileRef;
/** /**
* @} * @}
*/ */
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ppapi/cpp/file_ref.h" #include "ppapi/cpp/file_ref.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_errors.h"
#include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/directory_entry.h" #include "ppapi/cpp/directory_entry.h"
...@@ -22,6 +23,10 @@ template <> const char* interface_name<PPB_FileRef_1_1>() { ...@@ -22,6 +23,10 @@ template <> const char* interface_name<PPB_FileRef_1_1>() {
return PPB_FILEREF_INTERFACE_1_1; return PPB_FILEREF_INTERFACE_1_1;
} }
template <> const char* interface_name<PPB_FileRef_1_2>() {
return PPB_FILEREF_INTERFACE_1_2;
}
} // namespace } // namespace
FileRef::FileRef(PP_Resource resource) : Resource(resource) { FileRef::FileRef(PP_Resource resource) : Resource(resource) {
...@@ -32,7 +37,10 @@ FileRef::FileRef(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) { ...@@ -32,7 +37,10 @@ FileRef::FileRef(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) {
FileRef::FileRef(const FileSystem& file_system, FileRef::FileRef(const FileSystem& file_system,
const char* path) { const char* path) {
if (has_interface<PPB_FileRef_1_1>()) { if (has_interface<PPB_FileRef_1_2>()) {
PassRefFromConstructor(get_interface<PPB_FileRef_1_2>()->Create(
file_system.pp_resource(), path));
} else if (has_interface<PPB_FileRef_1_1>()) {
PassRefFromConstructor(get_interface<PPB_FileRef_1_1>()->Create( PassRefFromConstructor(get_interface<PPB_FileRef_1_1>()->Create(
file_system.pp_resource(), path)); file_system.pp_resource(), path));
} else if (has_interface<PPB_FileRef_1_0>()) { } else if (has_interface<PPB_FileRef_1_0>()) {
...@@ -46,6 +54,8 @@ FileRef::FileRef(const FileRef& other) ...@@ -46,6 +54,8 @@ FileRef::FileRef(const FileRef& other)
} }
PP_FileSystemType FileRef::GetFileSystemType() const { PP_FileSystemType FileRef::GetFileSystemType() const {
if (has_interface<PPB_FileRef_1_2>())
return get_interface<PPB_FileRef_1_2>()->GetFileSystemType(pp_resource());
if (has_interface<PPB_FileRef_1_1>()) if (has_interface<PPB_FileRef_1_1>())
return get_interface<PPB_FileRef_1_1>()->GetFileSystemType(pp_resource()); return get_interface<PPB_FileRef_1_1>()->GetFileSystemType(pp_resource());
if (has_interface<PPB_FileRef_1_0>()) if (has_interface<PPB_FileRef_1_0>())
...@@ -54,6 +64,10 @@ PP_FileSystemType FileRef::GetFileSystemType() const { ...@@ -54,6 +64,10 @@ PP_FileSystemType FileRef::GetFileSystemType() const {
} }
Var FileRef::GetName() const { Var FileRef::GetName() const {
if (has_interface<PPB_FileRef_1_2>()) {
return Var(PASS_REF,
get_interface<PPB_FileRef_1_2>()->GetName(pp_resource()));
}
if (has_interface<PPB_FileRef_1_1>()) { if (has_interface<PPB_FileRef_1_1>()) {
return Var(PASS_REF, return Var(PASS_REF,
get_interface<PPB_FileRef_1_1>()->GetName(pp_resource())); get_interface<PPB_FileRef_1_1>()->GetName(pp_resource()));
...@@ -66,6 +80,10 @@ Var FileRef::GetName() const { ...@@ -66,6 +80,10 @@ Var FileRef::GetName() const {
} }
Var FileRef::GetPath() const { Var FileRef::GetPath() const {
if (has_interface<PPB_FileRef_1_2>()) {
return Var(PASS_REF,
get_interface<PPB_FileRef_1_2>()->GetPath(pp_resource()));
}
if (has_interface<PPB_FileRef_1_1>()) { if (has_interface<PPB_FileRef_1_1>()) {
return Var(PASS_REF, return Var(PASS_REF,
get_interface<PPB_FileRef_1_1>()->GetPath(pp_resource())); get_interface<PPB_FileRef_1_1>()->GetPath(pp_resource()));
...@@ -78,6 +96,10 @@ Var FileRef::GetPath() const { ...@@ -78,6 +96,10 @@ Var FileRef::GetPath() const {
} }
FileRef FileRef::GetParent() const { FileRef FileRef::GetParent() const {
if (has_interface<PPB_FileRef_1_2>()) {
return FileRef(PASS_REF,
get_interface<PPB_FileRef_1_2>()->GetParent(pp_resource()));
}
if (has_interface<PPB_FileRef_1_1>()) { if (has_interface<PPB_FileRef_1_1>()) {
return FileRef(PASS_REF, return FileRef(PASS_REF,
get_interface<PPB_FileRef_1_1>()->GetParent(pp_resource())); get_interface<PPB_FileRef_1_1>()->GetParent(pp_resource()));
...@@ -89,34 +111,28 @@ FileRef FileRef::GetParent() const { ...@@ -89,34 +111,28 @@ FileRef FileRef::GetParent() const {
return FileRef(); return FileRef();
} }
int32_t FileRef::MakeDirectory(const CompletionCallback& cc) { int32_t FileRef::MakeDirectory(int32_t make_directory_flags,
if (has_interface<PPB_FileRef_1_1>()) { const CompletionCallback& cc) {
return get_interface<PPB_FileRef_1_1>()->MakeDirectory( if (has_interface<PPB_FileRef_1_2>()) {
pp_resource(), return get_interface<PPB_FileRef_1_2>()->MakeDirectory(
PP_FALSE, // make_ancestors
cc.pp_completion_callback());
}
if (has_interface<PPB_FileRef_1_0>()) {
return get_interface<PPB_FileRef_1_0>()->MakeDirectory(
pp_resource(), pp_resource(),
PP_FALSE, // make_ancestors make_directory_flags,
cc.pp_completion_callback()); cc.pp_completion_callback());
} }
return cc.MayForce(PP_ERROR_NOINTERFACE);
}
int32_t FileRef::MakeDirectoryIncludingAncestors(
const CompletionCallback& cc) {
if (has_interface<PPB_FileRef_1_1>()) { if (has_interface<PPB_FileRef_1_1>()) {
if (make_directory_flags & ~PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS)
return cc.MayForce(PP_ERROR_NOTSUPPORTED);
return get_interface<PPB_FileRef_1_1>()->MakeDirectory( return get_interface<PPB_FileRef_1_1>()->MakeDirectory(
pp_resource(), pp_resource(),
PP_TRUE, // make_ancestors PP_FromBool(make_directory_flags & PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS),
cc.pp_completion_callback()); cc.pp_completion_callback());
} }
if (has_interface<PPB_FileRef_1_0>()) { if (has_interface<PPB_FileRef_1_0>()) {
if (make_directory_flags & ~PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS)
return cc.MayForce(PP_ERROR_NOTSUPPORTED);
return get_interface<PPB_FileRef_1_0>()->MakeDirectory( return get_interface<PPB_FileRef_1_0>()->MakeDirectory(
pp_resource(), pp_resource(),
PP_TRUE, // make_ancestors PP_FromBool(make_directory_flags & PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS),
cc.pp_completion_callback()); cc.pp_completion_callback());
} }
return cc.MayForce(PP_ERROR_NOINTERFACE); return cc.MayForce(PP_ERROR_NOINTERFACE);
...@@ -125,6 +141,11 @@ int32_t FileRef::MakeDirectoryIncludingAncestors( ...@@ -125,6 +141,11 @@ int32_t FileRef::MakeDirectoryIncludingAncestors(
int32_t FileRef::Touch(PP_Time last_access_time, int32_t FileRef::Touch(PP_Time last_access_time,
PP_Time last_modified_time, PP_Time last_modified_time,
const CompletionCallback& cc) { const CompletionCallback& cc) {
if (has_interface<PPB_FileRef_1_2>()) {
return get_interface<PPB_FileRef_1_2>()->Touch(
pp_resource(), last_access_time, last_modified_time,
cc.pp_completion_callback());
}
if (has_interface<PPB_FileRef_1_1>()) { if (has_interface<PPB_FileRef_1_1>()) {
return get_interface<PPB_FileRef_1_1>()->Touch( return get_interface<PPB_FileRef_1_1>()->Touch(
pp_resource(), last_access_time, last_modified_time, pp_resource(), last_access_time, last_modified_time,
...@@ -139,6 +160,10 @@ int32_t FileRef::Touch(PP_Time last_access_time, ...@@ -139,6 +160,10 @@ int32_t FileRef::Touch(PP_Time last_access_time,
} }
int32_t FileRef::Delete(const CompletionCallback& cc) { int32_t FileRef::Delete(const CompletionCallback& cc) {
if (has_interface<PPB_FileRef_1_2>()) {
return get_interface<PPB_FileRef_1_2>()->Delete(
pp_resource(), cc.pp_completion_callback());
}
if (has_interface<PPB_FileRef_1_1>()) { if (has_interface<PPB_FileRef_1_1>()) {
return get_interface<PPB_FileRef_1_1>()->Delete( return get_interface<PPB_FileRef_1_1>()->Delete(
pp_resource(), cc.pp_completion_callback()); pp_resource(), cc.pp_completion_callback());
...@@ -152,6 +177,10 @@ int32_t FileRef::Delete(const CompletionCallback& cc) { ...@@ -152,6 +177,10 @@ int32_t FileRef::Delete(const CompletionCallback& cc) {
int32_t FileRef::Rename(const FileRef& new_file_ref, int32_t FileRef::Rename(const FileRef& new_file_ref,
const CompletionCallback& cc) { const CompletionCallback& cc) {
if (has_interface<PPB_FileRef_1_2>()) {
return get_interface<PPB_FileRef_1_2>()->Rename(
pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback());
}
if (has_interface<PPB_FileRef_1_1>()) { if (has_interface<PPB_FileRef_1_1>()) {
return get_interface<PPB_FileRef_1_1>()->Rename( return get_interface<PPB_FileRef_1_1>()->Rename(
pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback()); pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback());
...@@ -164,19 +193,29 @@ int32_t FileRef::Rename(const FileRef& new_file_ref, ...@@ -164,19 +193,29 @@ int32_t FileRef::Rename(const FileRef& new_file_ref,
} }
int32_t FileRef::Query(const CompletionCallbackWithOutput<PP_FileInfo>& cc) { int32_t FileRef::Query(const CompletionCallbackWithOutput<PP_FileInfo>& cc) {
if (!has_interface<PPB_FileRef_1_1>()) if (has_interface<PPB_FileRef_1_2>()) {
return cc.MayForce(PP_ERROR_NOINTERFACE); return get_interface<PPB_FileRef_1_2>()->Query(
return get_interface<PPB_FileRef_1_1>()->Query( pp_resource(), cc.output(), cc.pp_completion_callback());
pp_resource(), cc.output(), cc.pp_completion_callback()); }
if (has_interface<PPB_FileRef_1_1>()) {
return get_interface<PPB_FileRef_1_1>()->Query(
pp_resource(), cc.output(), cc.pp_completion_callback());
}
return cc.MayForce(PP_ERROR_NOINTERFACE);
} }
int32_t FileRef::ReadDirectoryEntries( int32_t FileRef::ReadDirectoryEntries(
const CompletionCallbackWithOutput<std::vector<DirectoryEntry> >& const CompletionCallbackWithOutput<std::vector<DirectoryEntry> >&
callback) { callback) {
if (!has_interface<PPB_FileRef_1_1>()) if (has_interface<PPB_FileRef_1_2>()) {
return callback.MayForce(PP_ERROR_NOINTERFACE); return get_interface<PPB_FileRef_1_2>()->ReadDirectoryEntries(
return get_interface<PPB_FileRef_1_1>()->ReadDirectoryEntries( pp_resource(), callback.output(), callback.pp_completion_callback());
pp_resource(), callback.output(), callback.pp_completion_callback()); }
if (has_interface<PPB_FileRef_1_1>()) {
return get_interface<PPB_FileRef_1_1>()->ReadDirectoryEntries(
pp_resource(), callback.output(), callback.pp_completion_callback());
}
return callback.MayForce(PP_ERROR_NOINTERFACE);
} }
} // namespace pp } // namespace pp
...@@ -90,30 +90,20 @@ class FileRef : public Resource { ...@@ -90,30 +90,20 @@ class FileRef : public Resource {
/// <code>PP_FileSystemType_External</code>. /// <code>PP_FileSystemType_External</code>.
FileRef GetParent() const; FileRef GetParent() const;
/// MakeDirectory() makes a new directory in the file system. It is not /// MakeDirectory() makes a new directory in the file system according to the
/// valid to make a directory in the external file system. /// given <code>make_directory_flags</code>, which is a bit-mask of the
/// <strong>Note:</strong> Use MakeDirectoryIncludingAncestors() to create /// <code>PP_MakeDirectoryFlags</code> values. It is not valid to make a
/// parent directories.
///
/// @param[in] cc A <code>CompletionCallback</code> to be called upon
/// completion of MakeDirectory().
///
/// @return An int32_t containing an error code from <code>pp_errors.h</code>.
/// Succeeds if the directory already exists. Fails if ancestor
/// directortories do not exist (see MakeDirectoryIncludingAncestors for the
/// alternative).
int32_t MakeDirectory(const CompletionCallback& cc);
/// MakeDirectoryIncludingAncestors() makes a new directory in the file
/// system as well as any parent directories. It is not valid to make a
/// directory in the external file system. /// directory in the external file system.
/// ///
/// @param[in] make_directory_flags A bit-mask of the
/// <code>PP_MakeDirectoryFlags</code> values.
/// See <code>ppb_file_ref.h</code> for more details.
/// @param[in] cc A <code>CompletionCallback</code> to be called upon /// @param[in] cc A <code>CompletionCallback</code> to be called upon
/// completion of MakeDirectoryIncludingAncestors(). /// completion of MakeDirectory().
/// ///
/// @return An int32_t containing an error code from <code>pp_errors.h</code>. /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
/// Succeeds if the directory already exists. int32_t MakeDirectory(int32_t make_directory_flags,
int32_t MakeDirectoryIncludingAncestors(const CompletionCallback& cc); const CompletionCallback& cc);
/// Touch() Updates time stamps for a file. You must have write access to the /// Touch() Updates time stamps for a file. You must have write access to the
/// file if it exists in the external filesystem. /// file if it exists in the external filesystem.
......
...@@ -145,6 +145,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_0; ...@@ -145,6 +145,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_1_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_1;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileSystem_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileSystem_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Graphics2D_1_1;
...@@ -531,6 +532,70 @@ static int32_t Pnacl_M28_PPB_FileRef_ReadDirectoryEntries(PP_Resource file_ref, ...@@ -531,6 +532,70 @@ static int32_t Pnacl_M28_PPB_FileRef_ReadDirectoryEntries(PP_Resource file_ref,
/* End wrapper methods for PPB_FileRef_1_1 */ /* End wrapper methods for PPB_FileRef_1_1 */
/* Begin wrapper methods for PPB_FileRef_1_2 */
static PP_Resource Pnacl_M34_PPB_FileRef_Create(PP_Resource file_system, const char* path) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->Create(file_system, path);
}
static PP_Bool Pnacl_M34_PPB_FileRef_IsFileRef(PP_Resource resource) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->IsFileRef(resource);
}
static PP_FileSystemType Pnacl_M34_PPB_FileRef_GetFileSystemType(PP_Resource file_ref) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->GetFileSystemType(file_ref);
}
static void Pnacl_M34_PPB_FileRef_GetName(struct PP_Var* _struct_result, PP_Resource file_ref) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
*_struct_result = iface->GetName(file_ref);
}
static void Pnacl_M34_PPB_FileRef_GetPath(struct PP_Var* _struct_result, PP_Resource file_ref) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
*_struct_result = iface->GetPath(file_ref);
}
static PP_Resource Pnacl_M34_PPB_FileRef_GetParent(PP_Resource file_ref) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->GetParent(file_ref);
}
static int32_t Pnacl_M34_PPB_FileRef_MakeDirectory(PP_Resource directory_ref, int32_t make_directory_flags, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->MakeDirectory(directory_ref, make_directory_flags, *callback);
}
static int32_t Pnacl_M34_PPB_FileRef_Touch(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->Touch(file_ref, last_access_time, last_modified_time, *callback);
}
static int32_t Pnacl_M34_PPB_FileRef_Delete(PP_Resource file_ref, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->Delete(file_ref, *callback);
}
static int32_t Pnacl_M34_PPB_FileRef_Rename(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->Rename(file_ref, new_file_ref, *callback);
}
static int32_t Pnacl_M34_PPB_FileRef_Query(PP_Resource file_ref, struct PP_FileInfo* info, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->Query(file_ref, info, *callback);
}
static int32_t Pnacl_M34_PPB_FileRef_ReadDirectoryEntries(PP_Resource file_ref, struct PP_ArrayOutput* output, struct PP_CompletionCallback* callback) {
const struct PPB_FileRef_1_2 *iface = Pnacl_WrapperInfo_PPB_FileRef_1_2.real_iface;
return iface->ReadDirectoryEntries(file_ref, *output, *callback);
}
/* End wrapper methods for PPB_FileRef_1_2 */
/* Begin wrapper methods for PPB_FileSystem_1_0 */ /* Begin wrapper methods for PPB_FileSystem_1_0 */
static PP_Resource Pnacl_M14_PPB_FileSystem_Create(PP_Instance instance, PP_FileSystemType type) { static PP_Resource Pnacl_M14_PPB_FileSystem_Create(PP_Instance instance, PP_FileSystemType type) {
...@@ -4143,6 +4208,21 @@ static struct PPB_FileRef_1_1 Pnacl_Wrappers_PPB_FileRef_1_1 = { ...@@ -4143,6 +4208,21 @@ static struct PPB_FileRef_1_1 Pnacl_Wrappers_PPB_FileRef_1_1 = {
.ReadDirectoryEntries = (int32_t (*)(PP_Resource file_ref, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileRef_ReadDirectoryEntries .ReadDirectoryEntries = (int32_t (*)(PP_Resource file_ref, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M28_PPB_FileRef_ReadDirectoryEntries
}; };
static struct PPB_FileRef_1_2 Pnacl_Wrappers_PPB_FileRef_1_2 = {
.Create = (PP_Resource (*)(PP_Resource file_system, const char* path))&Pnacl_M34_PPB_FileRef_Create,
.IsFileRef = (PP_Bool (*)(PP_Resource resource))&Pnacl_M34_PPB_FileRef_IsFileRef,
.GetFileSystemType = (PP_FileSystemType (*)(PP_Resource file_ref))&Pnacl_M34_PPB_FileRef_GetFileSystemType,
.GetName = (struct PP_Var (*)(PP_Resource file_ref))&Pnacl_M34_PPB_FileRef_GetName,
.GetPath = (struct PP_Var (*)(PP_Resource file_ref))&Pnacl_M34_PPB_FileRef_GetPath,
.GetParent = (PP_Resource (*)(PP_Resource file_ref))&Pnacl_M34_PPB_FileRef_GetParent,
.MakeDirectory = (int32_t (*)(PP_Resource directory_ref, int32_t make_directory_flags, struct PP_CompletionCallback callback))&Pnacl_M34_PPB_FileRef_MakeDirectory,
.Touch = (int32_t (*)(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback))&Pnacl_M34_PPB_FileRef_Touch,
.Delete = (int32_t (*)(PP_Resource file_ref, struct PP_CompletionCallback callback))&Pnacl_M34_PPB_FileRef_Delete,
.Rename = (int32_t (*)(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback))&Pnacl_M34_PPB_FileRef_Rename,
.Query = (int32_t (*)(PP_Resource file_ref, struct PP_FileInfo* info, struct PP_CompletionCallback callback))&Pnacl_M34_PPB_FileRef_Query,
.ReadDirectoryEntries = (int32_t (*)(PP_Resource file_ref, struct PP_ArrayOutput output, struct PP_CompletionCallback callback))&Pnacl_M34_PPB_FileRef_ReadDirectoryEntries
};
static struct PPB_FileSystem_1_0 Pnacl_Wrappers_PPB_FileSystem_1_0 = { static struct PPB_FileSystem_1_0 Pnacl_Wrappers_PPB_FileSystem_1_0 = {
.Create = (PP_Resource (*)(PP_Instance instance, PP_FileSystemType type))&Pnacl_M14_PPB_FileSystem_Create, .Create = (PP_Resource (*)(PP_Instance instance, PP_FileSystemType type))&Pnacl_M14_PPB_FileSystem_Create,
.IsFileSystem = (PP_Bool (*)(PP_Resource resource))&Pnacl_M14_PPB_FileSystem_IsFileSystem, .IsFileSystem = (PP_Bool (*)(PP_Resource resource))&Pnacl_M14_PPB_FileSystem_IsFileSystem,
...@@ -5175,6 +5255,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_1 = { ...@@ -5175,6 +5255,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_1 = {
.real_iface = NULL .real_iface = NULL
}; };
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRef_1_2 = {
.iface_macro = PPB_FILEREF_INTERFACE_1_2,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileRef_1_2,
.real_iface = NULL
};
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileSystem_1_0 = { static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileSystem_1_0 = {
.iface_macro = PPB_FILESYSTEM_INTERFACE_1_0, .iface_macro = PPB_FILESYSTEM_INTERFACE_1_0,
.wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileSystem_1_0, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_FileSystem_1_0,
...@@ -5752,6 +5838,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { ...@@ -5752,6 +5838,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_FileIO_1_1, &Pnacl_WrapperInfo_PPB_FileIO_1_1,
&Pnacl_WrapperInfo_PPB_FileRef_1_0, &Pnacl_WrapperInfo_PPB_FileRef_1_0,
&Pnacl_WrapperInfo_PPB_FileRef_1_1, &Pnacl_WrapperInfo_PPB_FileRef_1_1,
&Pnacl_WrapperInfo_PPB_FileRef_1_2,
&Pnacl_WrapperInfo_PPB_FileSystem_1_0, &Pnacl_WrapperInfo_PPB_FileSystem_1_0,
&Pnacl_WrapperInfo_PPB_Graphics2D_1_0, &Pnacl_WrapperInfo_PPB_Graphics2D_1_0,
&Pnacl_WrapperInfo_PPB_Graphics2D_1_1, &Pnacl_WrapperInfo_PPB_Graphics2D_1_1,
......
...@@ -129,11 +129,11 @@ PP_Resource FileRefResource::GetParent() { ...@@ -129,11 +129,11 @@ PP_Resource FileRefResource::GetParent() {
} }
int32_t FileRefResource::MakeDirectory( int32_t FileRefResource::MakeDirectory(
PP_Bool make_ancestors, int32_t make_directory_flags,
scoped_refptr<TrackedCallback> callback) { scoped_refptr<TrackedCallback> callback) {
Call<PpapiPluginMsg_FileRef_MakeDirectoryReply>( Call<PpapiPluginMsg_FileRef_MakeDirectoryReply>(
BROWSER, BROWSER,
PpapiHostMsg_FileRef_MakeDirectory(PP_TRUE == make_ancestors), PpapiHostMsg_FileRef_MakeDirectory(make_directory_flags),
base::Bind(&FileRefResource::RunTrackedCallback, this, callback)); base::Bind(&FileRefResource::RunTrackedCallback, this, callback));
return PP_OK_COMPLETIONPENDING; return PP_OK_COMPLETIONPENDING;
} }
......
...@@ -42,8 +42,8 @@ class PPAPI_PROXY_EXPORT FileRefResource ...@@ -42,8 +42,8 @@ class PPAPI_PROXY_EXPORT FileRefResource
virtual PP_Var GetPath() const OVERRIDE; virtual PP_Var GetPath() const OVERRIDE;
virtual PP_Resource GetParent() OVERRIDE; virtual PP_Resource GetParent() OVERRIDE;
virtual int32_t MakeDirectory( virtual int32_t MakeDirectory(
PP_Bool make_ancestors, int32_t make_directory_flags,
scoped_refptr<TrackedCallback> callback) OVERRIDE; scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual int32_t Touch(PP_Time last_access_time, virtual int32_t Touch(PP_Time last_access_time,
PP_Time last_modified_time, PP_Time last_modified_time,
scoped_refptr<TrackedCallback> callback) OVERRIDE; scoped_refptr<TrackedCallback> callback) OVERRIDE;
......
...@@ -194,12 +194,8 @@ InterfaceList::InterfaceList() { ...@@ -194,12 +194,8 @@ InterfaceList::InterfaceList() {
#endif // !defined(OS_NACL) #endif // !defined(OS_NACL)
} }
{ {
// TODO(teravest): These lines should be uncommented when a dev channel Permission current_required_permission = PERMISSION_DEV_CHANNEL;
// interface is added. They're commented right now because they cause an #include "ppapi/thunk/interfaces_ppb_public_dev_channel.h"
// unused variable warning.
//
// Permission current_required_permission = PERMISSION_DEV_CHANNEL;
// #include "ppapi/thunk/interfaces_ppb_public_dev_channel.h"
} }
#undef PROXIED_API #undef PROXIED_API
......
...@@ -1256,7 +1256,7 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileRef_CreateInternal, ...@@ -1256,7 +1256,7 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileRef_CreateInternal,
// Requests that the browser create a directory at the location indicated by // Requests that the browser create a directory at the location indicated by
// the FileRef. // the FileRef.
IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileRef_MakeDirectory, IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileRef_MakeDirectory,
bool /* make_ancestors */) int32_t /* make_directory_flags */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileRef_MakeDirectoryReply) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileRef_MakeDirectoryReply)
// Requests that the browser update the last accessed and last modified times // Requests that the browser update the last accessed and last modified times
......
...@@ -296,7 +296,8 @@ std::string TestFileIO::TestOpenDirectory() { ...@@ -296,7 +296,8 @@ std::string TestFileIO::TestOpenDirectory() {
// Make a directory. // Make a directory.
pp::FileRef dir_ref(file_system, "/test_dir_open_directory"); pp::FileRef dir_ref(file_system, "/test_dir_open_directory");
callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback())); callback.WaitForResult(dir_ref.MakeDirectory(
PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
......
...@@ -298,41 +298,59 @@ std::string TestFileRef::TestMakeDirectory() { ...@@ -298,41 +298,59 @@ std::string TestFileRef::TestMakeDirectory() {
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
// MakeDirectory. // Make a directory.
pp::FileRef dir_ref(file_system, "/test_dir_make_directory"); pp::FileRef dir_ref(file_system, "/dir_make_dir");
callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback())); callback.WaitForResult(
dir_ref.MakeDirectory(PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result());
// Make a directory on the existing path without exclusive flag.
callback.WaitForResult(
dir_ref.MakeDirectory(PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
// MakeDirectory aborted. // Making a directory should be aborted.
int32_t rv = PP_ERROR_FAILED; int32_t rv = PP_ERROR_FAILED;
{ {
rv = pp::FileRef(file_system, "/test_dir_make_abort") rv = pp::FileRef(file_system, "/dir_make_dir_abort")
.MakeDirectory(callback.GetCallback()); .MakeDirectory(PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback());
} }
callback.WaitForAbortResult(rv); callback.WaitForAbortResult(rv);
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
// MakeDirectoryIncludingAncestors. // Make nested directories.
dir_ref = pp::FileRef(file_system, "/dir_make_dir_1/dir_make_dir_2"); dir_ref = pp::FileRef(file_system, "/dir_make_nested_dir_1/dir");
callback.WaitForResult( callback.WaitForResult(
dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback())); dir_ref.MakeDirectory(PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS,
callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
// MakeDirectoryIncludingAncestors aborted. dir_ref = pp::FileRef(file_system, "/dir_make_nested_dir_2/dir");
{ callback.WaitForResult(
rv = pp::FileRef(file_system, "/dir_make_abort_1/dir_make_abort_2") dir_ref.MakeDirectory(PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
.MakeDirectoryIncludingAncestors(callback.GetCallback());
}
callback.WaitForAbortResult(rv);
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_ERROR_FILENOTFOUND, callback.result());
// Ensure there is no directory on the path to test exclusive cases.
dir_ref = pp::FileRef(file_system, "/dir_make_dir_exclusive");
rv = DeleteDirectoryRecursively(&dir_ref);
ASSERT_TRUE(rv == PP_OK || rv == PP_ERROR_FILENOTFOUND);
// Make a directory exclusively.
callback.WaitForResult(
dir_ref.MakeDirectory(PP_MAKEDIRECTORYFLAG_EXCLUSIVE,
callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result());
// MakeDirectory with nested path should fail. callback.WaitForResult(
dir_ref = pp::FileRef(file_system, "/dir_make_dir_3/dir_make_dir_4"); dir_ref.MakeDirectory(PP_MAKEDIRECTORYFLAG_EXCLUSIVE,
callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback())); callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_NE(PP_OK, callback.result()); ASSERT_EQ(PP_ERROR_FILEEXISTS, callback.result());
PASS(); PASS();
} }
...@@ -432,7 +450,8 @@ std::string TestFileRef::TestDeleteFileAndDirectory() { ...@@ -432,7 +450,8 @@ std::string TestFileRef::TestDeleteFileAndDirectory() {
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
pp::FileRef dir_ref(file_system, "/dir_delete"); pp::FileRef dir_ref(file_system, "/dir_delete");
callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback())); callback.WaitForResult(dir_ref.MakeDirectory(
PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
...@@ -442,7 +461,8 @@ std::string TestFileRef::TestDeleteFileAndDirectory() { ...@@ -442,7 +461,8 @@ std::string TestFileRef::TestDeleteFileAndDirectory() {
pp::FileRef nested_dir_ref(file_system, "/dir_delete_1/dir_delete_2"); pp::FileRef nested_dir_ref(file_system, "/dir_delete_1/dir_delete_2");
callback.WaitForResult( callback.WaitForResult(
nested_dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback())); nested_dir_ref.MakeDirectory(PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS,
callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
...@@ -496,7 +516,8 @@ std::string TestFileRef::TestRenameFileAndDirectory() { ...@@ -496,7 +516,8 @@ std::string TestFileRef::TestRenameFileAndDirectory() {
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
pp::FileRef dir_ref(file_system, "/dir_rename"); pp::FileRef dir_ref(file_system, "/dir_rename");
callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback())); callback.WaitForResult(dir_ref.MakeDirectory(
PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
...@@ -508,7 +529,8 @@ std::string TestFileRef::TestRenameFileAndDirectory() { ...@@ -508,7 +529,8 @@ std::string TestFileRef::TestRenameFileAndDirectory() {
pp::FileRef nested_dir_ref(file_system, "/dir_rename_1/dir_rename_2"); pp::FileRef nested_dir_ref(file_system, "/dir_rename_1/dir_rename_2");
callback.WaitForResult( callback.WaitForResult(
nested_dir_ref.MakeDirectoryIncludingAncestors(callback.GetCallback())); nested_dir_ref.MakeDirectory(PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS,
callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
...@@ -615,7 +637,8 @@ std::string TestFileRef::TestFileNameEscaping() { ...@@ -615,7 +637,8 @@ std::string TestFileRef::TestFileNameEscaping() {
std::string test_dir_path = "/dir_for_escaping_test"; std::string test_dir_path = "/dir_for_escaping_test";
// Create a directory in which to test. // Create a directory in which to test.
pp::FileRef test_dir_ref(file_system, test_dir_path.c_str()); pp::FileRef test_dir_ref(file_system, test_dir_path.c_str());
callback.WaitForResult(test_dir_ref.MakeDirectory(callback.GetCallback())); callback.WaitForResult(test_dir_ref.MakeDirectory(
PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
...@@ -663,7 +686,8 @@ std::string TestFileRef::TestReadDirectoryEntries() { ...@@ -663,7 +686,8 @@ std::string TestFileRef::TestReadDirectoryEntries() {
int32_t rv = DeleteDirectoryRecursively(&test_dir); int32_t rv = DeleteDirectoryRecursively(&test_dir);
ASSERT_TRUE(rv == PP_OK || rv == PP_ERROR_FILENOTFOUND); ASSERT_TRUE(rv == PP_OK || rv == PP_ERROR_FILENOTFOUND);
callback.WaitForResult(test_dir.MakeDirectory(callback.GetCallback())); callback.WaitForResult(test_dir.MakeDirectory(
PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
...@@ -690,7 +714,8 @@ std::string TestFileRef::TestReadDirectoryEntries() { ...@@ -690,7 +714,8 @@ std::string TestFileRef::TestReadDirectoryEntries() {
buffer << test_dir_name << '/' << dir_prefix << i; buffer << test_dir_name << '/' << dir_prefix << i;
pp::FileRef file_ref(file_system, buffer.str().c_str()); pp::FileRef file_ref(file_system, buffer.str().c_str());
callback.WaitForResult(file_ref.MakeDirectory(callback.GetCallback())); callback.WaitForResult(file_ref.MakeDirectory(
PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
CHECK_CALLBACK_BEHAVIOR(callback); CHECK_CALLBACK_BEHAVIOR(callback);
ASSERT_EQ(PP_OK, callback.result()); ASSERT_EQ(PP_OK, callback.result());
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ppapi/thunk/interfaces_preamble.h" #include "ppapi/thunk/interfaces_preamble.h"
// Interfaces go here. // Interfaces go here.
PROXIED_IFACE(PPB_FILEREF_INTERFACE_1_2, PPB_FileRef_1_2)
PROXIED_IFACE(PPB_MEDIASTREAMVIDEOTRACK_INTERFACE_0_1, PROXIED_IFACE(PPB_MEDIASTREAMVIDEOTRACK_INTERFACE_0_1,
PPB_MediaStreamVideoTrack_0_1) PPB_MediaStreamVideoTrack_0_1)
PROXIED_IFACE(PPB_VIDEOFRAME_INTERFACE_0_1, PPB_VideoFrame_0_1) PROXIED_IFACE(PPB_VIDEOFRAME_INTERFACE_0_1, PPB_VideoFrame_0_1)
......
...@@ -28,7 +28,7 @@ class PPAPI_THUNK_EXPORT PPB_FileRef_API { ...@@ -28,7 +28,7 @@ class PPAPI_THUNK_EXPORT PPB_FileRef_API {
virtual PP_Var GetName() const = 0; virtual PP_Var GetName() const = 0;
virtual PP_Var GetPath() const = 0; virtual PP_Var GetPath() const = 0;
virtual PP_Resource GetParent() = 0; virtual PP_Resource GetParent() = 0;
virtual int32_t MakeDirectory(PP_Bool make_ancestors, virtual int32_t MakeDirectory(int32_t make_directory_flags,
scoped_refptr<TrackedCallback> callback) = 0; scoped_refptr<TrackedCallback> callback) = 0;
virtual int32_t Touch(PP_Time last_access_time, virtual int32_t Touch(PP_Time last_access_time,
PP_Time last_modified_time, PP_Time last_modified_time,
......
...@@ -87,8 +87,21 @@ int32_t MakeDirectory(PP_Resource directory_ref, ...@@ -87,8 +87,21 @@ int32_t MakeDirectory(PP_Resource directory_ref,
EnterFileRef enter(directory_ref, callback, true); EnterFileRef enter(directory_ref, callback, true);
if (enter.failed()) if (enter.failed())
return enter.retval(); return enter.retval();
return enter.SetResult(enter.object()->MakeDirectory(make_ancestors, int32_t flag = make_ancestors ? PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS
enter.callback())); : PP_MAKEDIRECTORYFLAG_NONE;
return enter.SetResult(enter.object()->MakeDirectory(
flag, enter.callback()));
}
int32_t MakeDirectory_1_2(PP_Resource directory_ref,
int32_t make_directory_flags,
PP_CompletionCallback callback) {
VLOG(4) << "PPB_FileRef::MakeDirectory()";
EnterFileRef enter(directory_ref, callback, true);
if (enter.failed())
return enter.retval();
return enter.SetResult(enter.object()->MakeDirectory(
make_directory_flags, enter.callback()));
} }
int32_t Touch(PP_Resource file_ref, int32_t Touch(PP_Resource file_ref,
...@@ -180,6 +193,21 @@ const PPB_FileRef_1_1 g_ppb_file_ref_thunk_1_1 = { ...@@ -180,6 +193,21 @@ const PPB_FileRef_1_1 g_ppb_file_ref_thunk_1_1 = {
&ReadDirectoryEntries &ReadDirectoryEntries
}; };
const PPB_FileRef_1_2 g_ppb_file_ref_thunk_1_2 = {
&Create,
&IsFileRef,
&GetFileSystemType,
&GetName,
&GetPath,
&GetParent,
&MakeDirectory_1_2,
&Touch,
&Delete,
&Rename,
&Query,
&ReadDirectoryEntries
};
const PPB_FileRefPrivate g_ppb_file_ref_private_thunk = { const PPB_FileRefPrivate g_ppb_file_ref_private_thunk = {
&GetAbsolutePath &GetAbsolutePath
}; };
...@@ -194,6 +222,10 @@ const PPB_FileRef_1_1* GetPPB_FileRef_1_1_Thunk() { ...@@ -194,6 +222,10 @@ const PPB_FileRef_1_1* GetPPB_FileRef_1_1_Thunk() {
return &g_ppb_file_ref_thunk_1_1; return &g_ppb_file_ref_thunk_1_1;
} }
const PPB_FileRef_1_2* GetPPB_FileRef_1_2_Thunk() {
return &g_ppb_file_ref_thunk_1_2;
}
const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() { const PPB_FileRefPrivate_0_1* GetPPB_FileRefPrivate_0_1_Thunk() {
return &g_ppb_file_ref_private_thunk; return &g_ppb_file_ref_private_thunk;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "ppapi/thunk/interfaces_ppb_private_flash.h" #include "ppapi/thunk/interfaces_ppb_private_flash.h"
#include "ppapi/thunk/interfaces_ppb_public_stable.h" #include "ppapi/thunk/interfaces_ppb_public_stable.h"
#include "ppapi/thunk/interfaces_ppb_public_dev.h" #include "ppapi/thunk/interfaces_ppb_public_dev.h"
#include "ppapi/thunk/interfaces_ppb_public_dev_channel.h"
#undef UNPROXIED_IFACE #undef UNPROXIED_IFACE
#undef PROXIED_IFACE #undef PROXIED_IFACE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment