1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
6 /* From ppb_file_system.idl modified Thu Jun 13 14:30:40 2013. */
8 #ifndef PPAPI_C_PPB_FILE_SYSTEM_H_
9 #define PPAPI_C_PPB_FILE_SYSTEM_H_
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_file_info.h"
14 #include "ppapi/c/pp_instance.h"
15 #include "ppapi/c/pp_macros.h"
16 #include "ppapi/c/pp_resource.h"
17 #include "ppapi/c/pp_stdint.h"
19 #define PPB_FILESYSTEM_INTERFACE_1_0 "PPB_FileSystem;1.0"
20 #define PPB_FILESYSTEM_INTERFACE PPB_FILESYSTEM_INTERFACE_1_0
24 * This file defines the API to create a file system associated with a file.
29 * @addtogroup Interfaces
33 * The <code>PPB_FileSystem</code> struct identifies the file system type
34 * associated with a file.
36 struct PPB_FileSystem_1_0
{
37 /** Create() creates a file system object of the given type.
39 * @param[in] instance A <code>PP_Instance</code> identifying the instance
41 * @param[in] type A file system type as defined by
42 * <code>PP_FileSystemType</code> enum (except PP_FILESYSTEMTYPE_ISOLATED,
43 * which is currently not supported).
44 * @return A <code>PP_Resource</code> corresponding to a file system if
47 PP_Resource (*Create
)(PP_Instance instance
, PP_FileSystemType type
);
49 * IsFileSystem() determines if the provided resource is a file system.
51 * @param[in] resource A <code>PP_Resource</code> corresponding to a file
54 * @return <code>PP_TRUE</code> if the resource is a
55 * <code>PPB_FileSystem</code>, <code>PP_FALSE</code> if the resource is
56 * invalid or some type other than <code>PPB_FileSystem</code>.
58 PP_Bool (*IsFileSystem
)(PP_Resource resource
);
60 * Open() opens the file system. A file system must be opened before running
61 * any other operation on it.
63 * @param[in] file_system A <code>PP_Resource</code> corresponding to a file
66 * @param[in] expected_size The expected size of the file system. Note that
67 * this does not request quota; to do that, you must either invoke
68 * requestQuota from JavaScript:
69 * http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-requesting-quota
70 * or set the unlimitedStorage permission for Chrome Web Store apps:
71 * http://code.google.com/chrome/extensions/manifest.html#permissions
73 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
74 * completion of Open().
76 * @return An int32_t containing an error code from <code>pp_errors.h</code>.
78 int32_t (*Open
)(PP_Resource file_system
,
79 int64_t expected_size
,
80 struct PP_CompletionCallback callback
);
82 * GetType() returns the type of the provided file system.
84 * @param[in] file_system A <code>PP_Resource</code> corresponding to a file
87 * @return A <code>PP_FileSystemType</code> with the file system type if
88 * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource
89 * is not a valid file system. It is valid to call this function even before
92 PP_FileSystemType (*GetType
)(PP_Resource file_system
);
95 typedef struct PPB_FileSystem_1_0 PPB_FileSystem
;
100 #endif /* PPAPI_C_PPB_FILE_SYSTEM_H_ */