summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk
diff options
context:
space:
mode:
authornhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-10 11:34:12 +0000
committernhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-10 11:34:12 +0000
commit491af3c6d9727468104785d3df5b0583025f7420 (patch)
tree09e29b9e6d59220c7c22db94bbd869c9ddd62dd5 /ppapi/thunk
parent021b50df6cc6fa48432c664cdb04219edde01cac (diff)
downloadchromium_src-491af3c6d9727468104785d3df5b0583025f7420.zip
chromium_src-491af3c6d9727468104785d3df5b0583025f7420.tar.gz
chromium_src-491af3c6d9727468104785d3df5b0583025f7420.tar.bz2
[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
Diffstat (limited to 'ppapi/thunk')
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev_channel.h1
-rw-r--r--ppapi/thunk/ppb_file_ref_api.h2
-rw-r--r--ppapi/thunk/ppb_file_ref_thunk.cc36
-rw-r--r--ppapi/thunk/thunk.h1
4 files changed, 37 insertions, 3 deletions
diff --git a/ppapi/thunk/interfaces_ppb_public_dev_channel.h b/ppapi/thunk/interfaces_ppb_public_dev_channel.h
index 1f5861d..2d2519e 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev_channel.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev_channel.h
@@ -8,6 +8,7 @@
#include "ppapi/thunk/interfaces_preamble.h"
// Interfaces go here.
+PROXIED_IFACE(PPB_FILEREF_INTERFACE_1_2, PPB_FileRef_1_2)
PROXIED_IFACE(PPB_MEDIASTREAMVIDEOTRACK_INTERFACE_0_1,
PPB_MediaStreamVideoTrack_0_1)
PROXIED_IFACE(PPB_VIDEOFRAME_INTERFACE_0_1, PPB_VideoFrame_0_1)
diff --git a/ppapi/thunk/ppb_file_ref_api.h b/ppapi/thunk/ppb_file_ref_api.h
index b473ae2..2a27af5e8 100644
--- a/ppapi/thunk/ppb_file_ref_api.h
+++ b/ppapi/thunk/ppb_file_ref_api.h
@@ -28,7 +28,7 @@ class PPAPI_THUNK_EXPORT PPB_FileRef_API {
virtual PP_Var GetName() const = 0;
virtual PP_Var GetPath() const = 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;
virtual int32_t Touch(PP_Time last_access_time,
PP_Time last_modified_time,
diff --git a/ppapi/thunk/ppb_file_ref_thunk.cc b/ppapi/thunk/ppb_file_ref_thunk.cc
index 64c90b5..ef31e922 100644
--- a/ppapi/thunk/ppb_file_ref_thunk.cc
+++ b/ppapi/thunk/ppb_file_ref_thunk.cc
@@ -87,8 +87,21 @@ int32_t MakeDirectory(PP_Resource directory_ref,
EnterFileRef enter(directory_ref, callback, true);
if (enter.failed())
return enter.retval();
- return enter.SetResult(enter.object()->MakeDirectory(make_ancestors,
- enter.callback()));
+ int32_t flag = make_ancestors ? PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS
+ : 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,
@@ -180,6 +193,21 @@ const PPB_FileRef_1_1 g_ppb_file_ref_thunk_1_1 = {
&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 = {
&GetAbsolutePath
};
@@ -194,6 +222,10 @@ const PPB_FileRef_1_1* GetPPB_FileRef_1_1_Thunk() {
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() {
return &g_ppb_file_ref_private_thunk;
}
diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h
index 86a328f..a85ce77 100644
--- a/ppapi/thunk/thunk.h
+++ b/ppapi/thunk/thunk.h
@@ -25,6 +25,7 @@
#include "ppapi/thunk/interfaces_ppb_private_flash.h"
#include "ppapi/thunk/interfaces_ppb_public_stable.h"
#include "ppapi/thunk/interfaces_ppb_public_dev.h"
+#include "ppapi/thunk/interfaces_ppb_public_dev_channel.h"
#undef UNPROXIED_IFACE
#undef PROXIED_IFACE