summaryrefslogtreecommitdiffstats
path: root/ppapi/c/ppb_file_ref.h
diff options
context:
space:
mode:
authorsanga@chromium.org <sanga@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-27 20:18:59 +0000
committersanga@chromium.org <sanga@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-27 20:18:59 +0000
commit126f4fbdf4245f4b98b85afc3d9d769d024e55e8 (patch)
treea305c4fa18b66be5e5429c1abfde328269fb6d4f /ppapi/c/ppb_file_ref.h
parent4522aace33817d513e3906ea0e2b668d90709840 (diff)
downloadchromium_src-126f4fbdf4245f4b98b85afc3d9d769d024e55e8.zip
chromium_src-126f4fbdf4245f4b98b85afc3d9d769d024e55e8.tar.gz
chromium_src-126f4fbdf4245f4b98b85afc3d9d769d024e55e8.tar.bz2
This CL is oringialy http://codereview.chromium.org/7210027
I moved to write access repository. Review URL: http://codereview.chromium.org/7261004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/ppb_file_ref.h')
-rw-r--r--ppapi/c/ppb_file_ref.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/ppapi/c/ppb_file_ref.h b/ppapi/c/ppb_file_ref.h
new file mode 100644
index 0000000..3f6faf7
--- /dev/null
+++ b/ppapi/c/ppb_file_ref.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef PPAPI_C_PPB_FILE_REF_H_
+#define PPAPI_C_PPB_FILE_REF_H_
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_file_info.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/pp_var.h"
+
+struct PP_CompletionCallback;
+
+#define PPB_FILEREF_INTERFACE_0_8 "PPB_FileRef;0.8"
+#define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_0_8
+
+// A FileRef is a "weak pointer" to a file in a file system. It contains a
+// PP_FileSystemType identifier and a file path string.
+struct PPB_FileRef {
+ // Creates a weak pointer to a file in the given filesystem. File paths are
+ // POSIX style. Returns 0 if the path is malformed.
+ PP_Resource (*Create)(PP_Resource file_system, const char* path);
+
+ // Returns PP_TRUE if the given resource is a FileRef. Returns PP_FALSE if the
+ // resource is invalid or some type other than a FileRef.
+ PP_Bool (*IsFileRef)(PP_Resource resource);
+
+ // Returns the file system identifier of this file, or
+ // PP_FILESYSTEMTYPE_INVALID if the file ref is invalid.
+ PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref);
+
+ // Returns the name of the file. The value returned by this function does not
+ // include any path component (such as the name of the parent directory, for
+ // example). It is just the name of the file. To get the full file path, use
+ // the GetPath() function.
+ struct PP_Var (*GetName)(PP_Resource file_ref);
+
+ // Returns the absolute path of the file. This method fails if the file
+ // system type is PP_FileSystemType_External.
+ struct PP_Var (*GetPath)(PP_Resource file_ref);
+
+ // Returns the parent directory of this file. If file_ref points to the root
+ // of the filesystem, then the root is returned. This method fails if the
+ // file system type is PP_FileSystemType_External.
+ PP_Resource (*GetParent)(PP_Resource file_ref);
+
+ // Makes a new directory in the filesystem as well as any parent directories
+ // if the make_ancestors parameter is PP_TRUE. It is not valid to make a
+ // directory in the external filesystem. Fails if the directory already
+ // exists or if ancestor directories do not exist and make_ancestors was not
+ // passed as PP_TRUE.
+ int32_t (*MakeDirectory)(PP_Resource directory_ref,
+ PP_Bool make_ancestors,
+ struct PP_CompletionCallback callback);
+
+ // Updates timestamps for a file. You must have write access to the file if
+ // it exists in the external filesystem.
+ int32_t (*Touch)(PP_Resource file_ref,
+ PP_Time last_access_time,
+ PP_Time last_modified_time,
+ struct PP_CompletionCallback callback);
+
+ // Delete a file or directory. If file_ref refers to a directory, then the
+ // directory must be empty. It is an error to delete a file or directory
+ // that is in use. It is not valid to delete a file in the external
+ // filesystem.
+ int32_t (*Delete)(PP_Resource file_ref,
+ struct PP_CompletionCallback callback);
+
+ // Rename a file or directory. file_ref and new_file_ref must both refer to
+ // files in the same filesystem. It is an error to rename a file or
+ // directory that is in use. It is not valid to rename a file in the
+ // external filesystem.
+ int32_t (*Rename)(PP_Resource file_ref,
+ PP_Resource new_file_ref,
+ struct PP_CompletionCallback callback);
+};
+
+#endif /* PPAPI_C_PPB_FILE_REF_H_ */