[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 | |
| 10 | label Chrome { |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 11 | M14 = 1.0 |
| 12 | }; |
| 13 | |
| 14 | /** |
| 15 | * The <code>PPB_FileSystem</code> struct identifies the file system type |
| 16 | * associated with a file. |
| 17 | */ |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 18 | interface PPB_FileSystem { |
| 19 | /** Create() creates a file system object of the given type. |
| 20 | * |
[email protected] | e12a6a1 | 2011-08-31 16:07:59 | [diff] [blame] | 21 | * @param[in] instance A <code>PP_Instance</code> identifying the instance |
[email protected] | 745b0d4 | 2011-07-16 23:53:22 | [diff] [blame] | 22 | * with the file. |
| 23 | * @param[in] type A file system type as defined by |
| 24 | * <code>PP_FileSystemType</code> enum. |
| 25 | * |
| 26 | * @return A <code>PP_Resource</code> corresponding to a file system if |
| 27 | * successful. |
| 28 | */ |
| 29 | PP_Resource Create([in] PP_Instance instance, [in] PP_FileSystemType type); |
| 30 | |
| 31 | /** |
| 32 | * IsFileSystem() determines if the provided resource is a file system. |
| 33 | * |
| 34 | * @param[in] resource A <code>PP_Resource</code> corresponding to a file |
| 35 | * system. |
| 36 | * |
| 37 | * @return <code>PP_TRUE</code> if the resource is a |
| 38 | * <code>PPB_FileSystem</code>, <code>PP_FALSE</code> if the resource is |
| 39 | * invalid or some type other than <code>PPB_FileSystem</code>. |
| 40 | */ |
| 41 | PP_Bool IsFileSystem([in] PP_Resource resource); |
| 42 | |
| 43 | /** |
| 44 | * Open() opens the file system. A file system must be opened before running |
| 45 | * any other operation on it. |
| 46 | * |
| 47 | * @param[in] file_system A <code>PP_Resource</code> corresponding to a file |
| 48 | * system. |
| 49 | * @param[in] expected_size The expected size of the file system. |
| 50 | * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 51 | * completion of Open(). |
| 52 | * |
| 53 | * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 54 | * |
| 55 | * TODO(brettw) clarify whether this must have completed before a file can |
| 56 | * be opened in it. Clarify what it means to be "completed." |
| 57 | */ |
| 58 | int32_t Open([in] PP_Resource file_system, |
| 59 | [in] int64_t expected_size, |
| 60 | [in] PP_CompletionCallback callback); |
| 61 | |
| 62 | /** |
| 63 | * GetType() returns the type of the provided file system. |
| 64 | * |
| 65 | * @param[in] file_system A <code>PP_Resource</code> corresponding to a file |
| 66 | * system. |
| 67 | * |
| 68 | * @return A <code>PP_FileSystemType</code> with the file system type if |
| 69 | * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource |
| 70 | * is not a valid file system. It is valid to call this function even before |
| 71 | * Open() completes. |
| 72 | */ |
| 73 | PP_FileSystemType GetType([in] PP_Resource file_system); |
| 74 | }; |
| 75 | |