Avi Drissman | db497b3 | 2022-09-15 19:47:28 | [diff] [blame] | 1 | /* Copyright 2012 The Chromium Authors |
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 2 | * Use of this source code is governed by a BSD-style license that can be |
3 | * found in the LICENSE file. | ||||
4 | */ | ||||
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 5 | |
[email protected] | 56de903 | 2013-09-09 22:35:47 | [diff] [blame] | 6 | /* From ppb_file_system.idl modified Thu Jun 13 14:30:40 2013. */ |
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 7 | |
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 8 | #ifndef PPAPI_C_PPB_FILE_SYSTEM_H_ |
9 | #define PPAPI_C_PPB_FILE_SYSTEM_H_ | ||||
10 | |||||
11 | #include "ppapi/c/pp_bool.h" | ||||
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 12 | #include "ppapi/c/pp_completion_callback.h" |
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 13 | #include "ppapi/c/pp_file_info.h" |
14 | #include "ppapi/c/pp_instance.h" | ||||
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 15 | #include "ppapi/c/pp_macros.h" |
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 16 | #include "ppapi/c/pp_resource.h" |
17 | #include "ppapi/c/pp_stdint.h" | ||||
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 18 | |
[email protected] | 49aa1387 | 2011-08-17 20:45:57 | [diff] [blame] | 19 | #define PPB_FILESYSTEM_INTERFACE_1_0 "PPB_FileSystem;1.0" |
20 | #define PPB_FILESYSTEM_INTERFACE PPB_FILESYSTEM_INTERFACE_1_0 | ||||
21 | |||||
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 22 | /** |
23 | * @file | ||||
24 | * This file defines the API to create a file system associated with a file. | ||||
25 | */ | ||||
26 | |||||
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 27 | |
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 28 | /** |
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 29 | * @addtogroup Interfaces |
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 30 | * @{ |
31 | */ | ||||
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 32 | /** |
33 | * The <code>PPB_FileSystem</code> struct identifies the file system type | ||||
34 | * associated with a file. | ||||
35 | */ | ||||
[email protected] | 25651387 | 2012-01-05 15:41:52 | [diff] [blame] | 36 | struct PPB_FileSystem_1_0 { |
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 37 | /** Create() creates a file system object of the given type. |
38 | * | ||||
[email protected] | e12a6a1 | 2011-08-31 16:07:59 | [diff] [blame] | 39 | * @param[in] instance A <code>PP_Instance</code> identifying the instance |
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 40 | * with the file. |
41 | * @param[in] type A file system type as defined by | ||||
[email protected] | d196ccaf | 2013-05-08 18:04:58 | [diff] [blame] | 42 | * <code>PP_FileSystemType</code> enum (except PP_FILESYSTEMTYPE_ISOLATED, |
43 | * which is currently not supported). | ||||
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 44 | * @return A <code>PP_Resource</code> corresponding to a file system if |
45 | * successful. | ||||
46 | */ | ||||
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 47 | PP_Resource (*Create)(PP_Instance instance, PP_FileSystemType type); |
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 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 | */ | ||||
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 58 | PP_Bool (*IsFileSystem)(PP_Resource resource); |
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 59 | /** |
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 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. | ||||
[email protected] | 391b3275 | 2012-07-11 03:45:43 | [diff] [blame] | 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: | ||||
[email protected] | 56de903 | 2013-09-09 22:35:47 | [diff] [blame] | 69 | * http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-requesting-quota |
[email protected] | 391b3275 | 2012-07-11 03:45:43 | [diff] [blame] | 70 | * or set the unlimitedStorage permission for Chrome Web Store apps: |
71 | * http://code.google.com/chrome/extensions/manifest.html#permissions | ||||
72 | * | ||||
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 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>. | ||||
[email protected] | f1a0afd | 2012-02-16 19:33:07 | [diff] [blame] | 77 | */ |
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 78 | int32_t (*Open)(PP_Resource file_system, |
79 | int64_t expected_size, | ||||
80 | struct PP_CompletionCallback callback); | ||||
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 81 | /** |
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 82 | * GetType() returns the type of the provided file system. |
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 83 | * |
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 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. | ||||
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 91 | */ |
92 | PP_FileSystemType (*GetType)(PP_Resource file_system); | ||||
93 | }; | ||||
[email protected] | 25651387 | 2012-01-05 15:41:52 | [diff] [blame] | 94 | |
95 | typedef struct PPB_FileSystem_1_0 PPB_FileSystem; | ||||
[email protected] | 5c8875752 | 2011-07-07 21:15:22 | [diff] [blame] | 96 | /** |
97 | * @} | ||||
98 | */ | ||||
[email protected] | 126f4fb | 2011-06-27 20:18:59 | [diff] [blame] | 99 | |
100 | #endif /* PPAPI_C_PPB_FILE_SYSTEM_H_ */ | ||||
[email protected] | 9b37f480 | 2011-07-19 00:09:28 | [diff] [blame] | 101 |