| Index: ppapi/c/dev/ppb_filesystemprovider_dev.h
|
| diff --git a/ppapi/c/dev/ppb_filesystemprovider_dev.h b/ppapi/c/dev/ppb_filesystemprovider_dev.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7740ab2ace69ef90579eead6a6906943823d0f5f
|
| --- /dev/null
|
| +++ b/ppapi/c/dev/ppb_filesystemprovider_dev.h
|
| @@ -0,0 +1,351 @@
|
| +/* Copyright 2015 The Chromium Authors. All rights reserved.
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| + */
|
| +
|
| +/* From dev/ppb_filesystemprovider_dev.idl modified Tue Jun 30 16:40:40 2015. */
|
| +
|
| +#ifndef PPAPI_C_DEV_PPB_FILESYSTEMPROVIDER_DEV_H_
|
| +#define PPAPI_C_DEV_PPB_FILESYSTEMPROVIDER_DEV_H_
|
| +
|
| +#include "ppapi/c/pp_bool.h"
|
| +#include "ppapi/c/pp_completion_callback.h"
|
| +#include "ppapi/c/pp_instance.h"
|
| +#include "ppapi/c/pp_macros.h"
|
| +#include "ppapi/c/pp_resource.h"
|
| +#include "ppapi/c/pp_stdint.h"
|
| +#include "ppapi/c/pp_var.h"
|
| +
|
| +#define PPB_FILESYSTEMPROVIDER_DEV_INTERFACE_0_1 \
|
| + "PPB_FilesystemProvider(Dev);0.1"
|
| +#define PPB_FILESYSTEMPROVIDER_DEV_INTERFACE \
|
| + PPB_FILESYSTEMPROVIDER_DEV_INTERFACE_0_1
|
| +
|
| +/**
|
| + * @file
|
| + * This file defines the <code>PPB_FilesystemProvider</code> interface.
|
| + */
|
| +
|
| +
|
| +/**
|
| + * @addtogroup Enums
|
| + * @{
|
| + */
|
| +typedef enum {
|
| + PP_OperationType_NONE,
|
| + PP_OperationType_UNMOUNT,
|
| + PP_OperationType_GETMETADATA,
|
| + PP_OperationType_READDIRECTORY,
|
| + PP_OperationType_OPENFILE,
|
| + PP_OperationType_CLOSEFILE,
|
| + PP_OperationType_READFILE,
|
| + PP_OperationType_CREATEDIRECTORY,
|
| + PP_OperationType_DELETEENTRY,
|
| + PP_OperationType_CREATEFILE,
|
| + PP_OperationType_COPYENTRY,
|
| + PP_OperationType_MOVEENTRY,
|
| + PP_OperationType_TRUNCATEENTRY,
|
| + PP_OperationType_WRITEFILE,
|
| + PP_OperationType_ABORT,
|
| + PP_OperationType_ADDWATCHER,
|
| + PP_OperationType_REMOVEWATCHER
|
| +} PP_OperationType_Dev;
|
| +
|
| +typedef enum {
|
| + PP_OpenFileMode_READ,
|
| + PP_OpenFileMode_WRITE,
|
| + PP_OpenFileMode_NONE
|
| +} PP_OpenFileMode_Dev;
|
| +
|
| +typedef enum {
|
| + PP_ChangeType_CHANGED,
|
| + PP_ChangeType_DELETED
|
| +} PP_ChangeType_Dev;
|
| +/**
|
| + * @}
|
| + */
|
| +
|
| +/**
|
| + * @addtogroup Structs
|
| + * @{
|
| + */
|
| +struct PP_FilesystemRequestUnmount {
|
| +
|
| +};
|
| +
|
| +struct PP_FilesystemRequestMetadata {
|
| + const char* entry_path;
|
| + PP_Bool thumbnail;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestReadDirectory {
|
| + const char* directory_path;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestOpenFile {
|
| + const char* file_path;
|
| + PP_OpenFileMode_Dev mode;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestCloseFile {
|
| + int32_t open_request_id;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestReadFile {
|
| + int32_t open_request_id;
|
| + uint64_t offset;
|
| + uint64_t length;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestCreateDirectory {
|
| + const char* directory_path;
|
| + PP_Bool recursive;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestDeleteEntry {
|
| + const char* entry_path;
|
| + PP_Bool recursive;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestCreateFile {
|
| + const char* file_path;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestCopyEntry {
|
| + const char* source_path;
|
| + const char* target_path;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestMoveEntry {
|
| + const char* source_path;
|
| + const char* target_path;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestTruncate {
|
| + const char* file_path;
|
| + int32_t length;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestWrite {
|
| + int32_t open_request_id;
|
| + uint64_t offset;
|
| + uint64_t data_size;
|
| + void* data;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestAbort {
|
| + int32_t operation_request_id;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestAddWatcher {
|
| + const char* entry_path;
|
| + PP_Bool recursive;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestRemoveWatcher {
|
| + const char* entry_path;
|
| + PP_Bool recursive;
|
| +};
|
| +
|
| +/**
|
| + * The request format
|
| + */
|
| +union PP_FilesystemRequestValue {
|
| + struct PP_FilesystemRequestUnmount as_unmount;
|
| + struct PP_FilesystemRequestMetadata as_metadata;
|
| + struct PP_FilesystemRequestReadDirectory as_read_directory;
|
| + struct PP_FilesystemRequestOpenFile as_open_file;
|
| + struct PP_FilesystemRequestCloseFile as_close_file;
|
| + struct PP_FilesystemRequestReadFile as_read_file;
|
| + struct PP_FilesystemRequestCreateDirectory as_create_directory;
|
| + struct PP_FilesystemRequestDeleteEntry as_delete_entry;
|
| + struct PP_FilesystemRequestCreateFile as_create_file;
|
| + struct PP_FilesystemRequestCopyEntry as_copy_entry;
|
| + struct PP_FilesystemRequestMoveEntry as_move_entry;
|
| + struct PP_FilesystemRequestTruncate as_truncate;
|
| + struct PP_FilesystemRequestWrite as_write_file;
|
| + struct PP_FilesystemRequestAbort as_abort;
|
| + struct PP_FilesystemRequestAddWatcher as_add_watcher;
|
| + struct PP_FilesystemRequestRemoveWatcher as_remove_watcher;
|
| +};
|
| +
|
| +struct PP_FilesystemRequest {
|
| + PP_OperationType_Dev operation_type;
|
| + int32_t request_id;
|
| + union PP_FilesystemRequestValue value;
|
| +};
|
| +/**
|
| + * @}
|
| + */
|
| +
|
| +/**
|
| + * @addtogroup Interfaces
|
| + * @{
|
| + */
|
| +/**
|
| + * File system provider interface.
|
| + * Typical usage:
|
| + * - Use Create() to create a new <code>PPB_FilesystemProvider_Dev resource
|
| + * - Call Mount() to register the new filesystem with the browser
|
| + * This will create an entry in the file manager Chrome OS UI. The user
|
| + * can select among the listed filesystem and issue file system operations
|
| + * - Call Unmount() to unregister the filesystem
|
| + * This will remove the entry from the file manager Chrome OS UI.
|
| + * - Register callback for the <code>PP_FilesystemRequest</code> messages that
|
| + * are sent from the browser with <code>GetNextRequest</code>
|
| + * - When a request is received and the processing results in a succcess:
|
| + * - call <code>SendSuccessResponse</code> for requests DIFFERENT from
|
| + * <code>PP_FilesystemRequestMetadata</code>,
|
| + * <code>PP_FilesystemRequestReadDirectory</code>,
|
| + * <code>PP_FilesystemRequestReadFile</code>
|
| + * - call <code>SendMetadataSuccessResponse</code> for
|
| + * <code>PP_FilesystemRequestMetadata</code> request
|
| + * - call <code>SendReadFileSuccessResponse</code> for
|
| + * <code>PP_FilesystemRequestReadFile</code> request
|
| + * - call <code>SendReadDirectorySuccessResponse</code> for
|
| + * <code>PP_FilesystemRequestReadDirectory</code> request
|
| + * - When a request is received and the processing results in an error:
|
| + * - call <code>SendErrorResponse</code> for ALL requests
|
| + * - If a PP_FilesystemRequestWrite is received a subsequent call to
|
| + * <code>FreeWriteRequestBuffer</code>
|
| + */
|
| +struct PPB_FilesystemProvider_Dev_0_1 {
|
| + PP_Resource (*Create)(PP_Instance instance);
|
| + PP_Bool (*IsFilesystemProvider)(PP_Resource resource);
|
| + /**
|
| + * Mount() registers the file system
|
| + * @param[in] filesystem_id A <code>PP_VARTYPE_STRING</code>
|
| + * @param[in] display_name A <code> PP_VARTYPE_STRING</code>
|
| + * @param[in] writable A <code> PP_VARTYPE_BOOL </code>
|
| + * @param[in] opened_files_limit A <code>int32_t</code>
|
| + * @param[out] error A <code>int32_t</code>
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> called when
|
| + * the operation completes asynchronously.
|
| + */
|
| + int32_t (*Mount)(PP_Resource filesystem_prov,
|
| + struct PP_Var filesystem_id,
|
| + struct PP_Var display_name,
|
| + PP_Bool writable,
|
| + int32_t opened_files_limit,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * Unmount() unregister the file system
|
| + * @param[in] filesystem_id A <code>PP_VARTYPE_STRING</code>
|
| + * @param[out] error A <code>int32_t</code>
|
| + * @param[in] callback <code>PP_CompletionCallback</code> called when the
|
| + * operation completes asynchronously.
|
| + */
|
| + int32_t (*Unmount)(PP_Resource filesystem_prov,
|
| + struct PP_Var filesystem_id,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * Notify() notify of changes within the watched directories
|
| + * @param[in] notify_options A <code>PP_VARTYPE_DICTIONARY</code>
|
| + * @param[in] request_id A <code>int32_t</code> the id of the request
|
| + * - "observedPath" : <code>PP_VARTYPE_STRING</code>
|
| + * - "recursive" : <code>PP_VARTYPE_BOOL</code>
|
| + * - "changeType" : <code> PP_ChangeType_Dev </code>
|
| + * - "changes" : <code> PP_VARTYPE_ARRAY </code>
|
| + * - <code> PP_VARTYPE_DICTIONARY </code>
|
| + * - "entryPath": <code> PP_VARTYPE_STRING </code>
|
| + * - "changeType": <code> PP_ChangeType_Dev </code>
|
| + * - "tag" : <code> PP_VARTYPE_STRING </code>
|
| + */
|
| + int32_t (*Notify)(PP_Resource filesystem_prov, struct PP_Var notify_options);
|
| + /**
|
| + * Most of the operation will rely on the bellow 2 function calls to
|
| + * to report status to the browser.
|
| + * SendSuccessResponse() acknowledges the successful completion of the
|
| + * requested file system operation.
|
| + * @param[in] operation_type A <code>PP_OperationType_Dev</code>
|
| + * @param[in] request_id A <code>int32_t</code> the id of the request
|
| + */
|
| + int32_t (*SendSuccessResponse)(PP_Resource filesystem_prov,
|
| + PP_OperationType_Dev operation_type,
|
| + int32_t request_id);
|
| + /**
|
| + * SendErrorResponse() notifies the browser that the request failed.
|
| + * @param[in] operation_type A <code>PP_OperationType_Dev</code>
|
| + * @param[in] errpr A <code>int32_t</code>
|
| + * @param[in] request_id A <code>int32_t</code>
|
| + */
|
| + int32_t (*SendErrorResponse)(PP_Resource filesystem_prov,
|
| + PP_OperationType_Dev operation_type,
|
| + int32_t error,
|
| + int32_t request_id);
|
| + /**
|
| + * Special functions that don't follow the above template
|
| + * for browser responses.
|
| + * SendMetadataSuccessResponse() acknowledges the successful retrieval of the
|
| + * metadata information
|
| + * @param[in] metadata A <code>PP_VARTYPE_DICTIONARY</code>
|
| + * - "isDirectory" : <code>PP_VARTYPE_BOOL</code>
|
| + * - "name" : <code>PP_VARTYPE_STRING(mandatory)</code>
|
| + * - "size" : <code>PP_VARTYPE_DOUBLE</code>
|
| + * - "modificationTime" : <code>PP_VARTYPE_STRING</code>
|
| + * - "mimeType" : <code>PP_VARTYPE_STRING</code>
|
| + * - "thumbnail" : <code>PP_VARTYPE_STRING</code>
|
| + * @param[in] request_id <code>int32_t</code>
|
| + */
|
| + int32_t (*SendMetadataSuccessResponse)(PP_Resource filesystem_prov,
|
| + struct PP_Var metadata,
|
| + int32_t request_id);
|
| + /**
|
| + * SendReadDirectorySuccessResponse acknowledges the successful retrieval of
|
| + * metadatas information for directories and files
|
| + * @param[in] array_size A <code>uint32_t</code>
|
| + * @param[in] entries <code>PP_VARTYPE_ARRAY</code>
|
| + * - an array of <code>PP_VARTYPE_DICTIONARY</code>
|
| + * - "isDirectory" : <code>PP_VARTYPE_BOOL</code>
|
| + * - "name" : <code>PP_VARTYPE_STRING(mandatory)</code>
|
| + * - "size" : <code>PP_VARTYPE_DOUBLE</code>
|
| + * - "modificationTime" : <code>PP_VARTYPE_STRING</code>
|
| + * - "mimeType" : <code>PP_VARTYPE_STRING</code>
|
| + * - "thumbnail" : <code>PP_VARTYPE_STRING</code>
|
| + * @param[in] has_more A <code>PP_VARTYPE_BOOL</code>
|
| + * @param[in] request_id A <code>int32_t</code>
|
| + */
|
| + int32_t (*SendReadDirectorySuccessResponse)(PP_Resource filesystem_prov,
|
| + struct PP_Var entries,
|
| + PP_Bool has_more,
|
| + int32_t request_id);
|
| + /**
|
| + * SendReadFileSuccessResponse() acknowledges the successful completion of a
|
| + * read request.
|
| + * @param[in] data_size A <code>uint32_t</code>
|
| + * @param[in] data A pointer to the begining of the file chunk read from file
|
| + * @param[in] has_more A <code>PP_VARTYPE_BOOL</code>
|
| + * @param[in] request_id A <code>int32_t</code>
|
| + */
|
| + int32_t (*SendReadFileSuccessResponse)(PP_Resource filesystem_prov,
|
| + uint32_t data_size,
|
| + const void* data,
|
| + PP_Bool has_more,
|
| + int32_t request_id);
|
| + /**
|
| + * GetNextRequest() registers a callback for any pending requests.
|
| + * @param[out] request A <code>PP_FilesystemRequest</code> this contains the
|
| + * request for a file system operation
|
| + * @param[in] callback A <code>PP_CompletionCallback</code> that is called
|
| + when
|
| + * a request becomes available.
|
| + */
|
| + int32_t (*GetNextRequest)(PP_Resource filesystem_prov,
|
| + struct PP_FilesystemRequest* request,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * FreeWriteRequestBuffer frees resource buffer. This MUST be called after the
|
| + * request is processed
|
| + * @param[in] buffer A pointer to the start of the file chunk in memory
|
| + */
|
| + int32_t (*ReleaseRequestBuffer)(PP_Resource filesystem_prov,
|
| + int32_t request_id);
|
| +};
|
| +
|
| +typedef struct PPB_FilesystemProvider_Dev_0_1 PPB_FilesystemProvider_Dev;
|
| +/**
|
| + * @}
|
| + */
|
| +
|
| +#endif /* PPAPI_C_DEV_PPB_FILESYSTEMPROVIDER_DEV_H_ */
|
| +
|
|
|