[email protected] | 25651387 | 2012-01-05 15:41:52 | [diff] [blame] | 1 | /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [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 | */ |
| 5 | |
| 6 | /** |
| 7 | * This file defines the API to create a file system associated with a file. |
| 8 | */ |
| 9 | |
[email protected] | 8f2a08d5 | 2012-12-08 00:10:50 | [diff] [blame] | 10 | [generate_thunk] |
| 11 | |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 12 | label Chrome { |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 13 | M14 = 1.0 |
| 14 | }; |
| 15 | |
| 16 | /** |
| 17 | * The <code>PPB_FileSystem</code> struct identifies the file system type |
| 18 | * associated with a file. |
| 19 | */ |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 20 | interface PPB_FileSystem { |
| 21 | /** Create() creates a file system object of the given type. |
| 22 | * |
[email protected] | e12a6a1 | 2011-08-31 16:07:59 | [diff] [blame] | 23 | * @param[in] instance A <code>PP_Instance</code> identifying the instance |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 24 | * with the file. |
| 25 | * @param[in] type A file system type as defined by |
[email protected] | d196ccaf | 2013-05-08 18:04:58 | [diff] [blame] | 26 | * <code>PP_FileSystemType</code> enum (except PP_FILESYSTEMTYPE_ISOLATED, |
| 27 | * which is currently not supported). |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 28 | * @return A <code>PP_Resource</code> corresponding to a file system if |
| 29 | * successful. |
| 30 | */ |
| 31 | PP_Resource Create([in] PP_Instance instance, [in] PP_FileSystemType type); |
| 32 | |
| 33 | /** |
| 34 | * IsFileSystem() determines if the provided resource is a file system. |
| 35 | * |
| 36 | * @param[in] resource A <code>PP_Resource</code> corresponding to a file |
| 37 | * system. |
| 38 | * |
| 39 | * @return <code>PP_TRUE</code> if the resource is a |
| 40 | * <code>PPB_FileSystem</code>, <code>PP_FALSE</code> if the resource is |
| 41 | * invalid or some type other than <code>PPB_FileSystem</code>. |
| 42 | */ |
| 43 | PP_Bool IsFileSystem([in] PP_Resource resource); |
| 44 | |
| 45 | /** |
| 46 | * Open() opens the file system. A file system must be opened before running |
| 47 | * any other operation on it. |
| 48 | * |
| 49 | * @param[in] file_system A <code>PP_Resource</code> corresponding to a file |
| 50 | * system. |
[email protected] | 391b3275 | 2012-07-11 03:45:43 | [diff] [blame] | 51 | * |
| 52 | * @param[in] expected_size The expected size of the file system. Note that |
| 53 | * this does not request quota; to do that, you must either invoke |
| 54 | * requestQuota from JavaScript: |
| 55 | * http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-requesting-quota |
| 56 | * or set the unlimitedStorage permission for Chrome Web Store apps: |
| 57 | * http://code.google.com/chrome/extensions/manifest.html#permissions |
| 58 | * |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 59 | * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 60 | * completion of Open(). |
| 61 | * |
| 62 | * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 63 | */ |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 64 | int32_t Open([in] PP_Resource file_system, |
| 65 | [in] int64_t expected_size, |
| 66 | [in] PP_CompletionCallback callback); |
| 67 | |
| 68 | /** |
| 69 | * GetType() returns the type of the provided file system. |
| 70 | * |
| 71 | * @param[in] file_system A <code>PP_Resource</code> corresponding to a file |
| 72 | * system. |
| 73 | * |
| 74 | * @return A <code>PP_FileSystemType</code> with the file system type if |
| 75 | * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource |
| 76 | * is not a valid file system. It is valid to call this function even before |
| 77 | * Open() completes. |
| 78 | */ |
[email protected] | 8f2a08d5 | 2012-12-08 00:10:50 | [diff] [blame] | 79 | [on_failure=PP_FILESYSTEMTYPE_INVALID] |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 80 | PP_FileSystemType GetType([in] PP_Resource file_system); |
| 81 | }; |
| 82 | |