• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4  */
5 
6 /* From ppb_file_system.idl modified Thu Jun 13 14:30:40 2013. */
7 
8 #ifndef PPAPI_C_PPB_FILE_SYSTEM_H_
9 #define PPAPI_C_PPB_FILE_SYSTEM_H_
10 
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"
18 
19 #define PPB_FILESYSTEM_INTERFACE_1_0 "PPB_FileSystem;1.0"
20 #define PPB_FILESYSTEM_INTERFACE PPB_FILESYSTEM_INTERFACE_1_0
21 
22 /**
23  * @file
24  * This file defines the API to create a file system associated with a file.
25  */
26 
27 
28 /**
29  * @addtogroup Interfaces
30  * @{
31  */
32 /**
33  * The <code>PPB_FileSystem</code> struct identifies the file system type
34  * associated with a file.
35  */
36 struct PPB_FileSystem_1_0 {
37   /** Create() creates a file system object of the given type.
38    *
39    * @param[in] instance A <code>PP_Instance</code> identifying the instance
40    * with the file.
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
45    * successful.
46    */
47   PP_Resource (*Create)(PP_Instance instance, PP_FileSystemType type);
48   /**
49    * IsFileSystem() determines if the provided resource is a file system.
50    *
51    * @param[in] resource A <code>PP_Resource</code> corresponding to a file
52    * system.
53    *
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>.
57    */
58   PP_Bool (*IsFileSystem)(PP_Resource resource);
59   /**
60    * Open() opens the file system. A file system must be opened before running
61    * any other operation on it.
62    *
63    * @param[in] file_system A <code>PP_Resource</code> corresponding to a file
64    * system.
65    *
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
72    *
73    * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
74    * completion of Open().
75    *
76    * @return An int32_t containing an error code from <code>pp_errors.h</code>.
77    */
78   int32_t (*Open)(PP_Resource file_system,
79                   int64_t expected_size,
80                   struct PP_CompletionCallback callback);
81   /**
82    * GetType() returns the type of the provided file system.
83    *
84    * @param[in] file_system A <code>PP_Resource</code> corresponding to a file
85    * system.
86    *
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
90    * Open() completes.
91    */
92   PP_FileSystemType (*GetType)(PP_Resource file_system);
93 };
94 
95 typedef struct PPB_FileSystem_1_0 PPB_FileSystem;
96 /**
97  * @}
98  */
99 
100 #endif  /* PPAPI_C_PPB_FILE_SYSTEM_H_ */
101 
102