| 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..a50f58840ba56663d585eca6613a684940df417a
|
| --- /dev/null
|
| +++ b/ppapi/c/dev/ppb_filesystemprovider_dev.h
|
| @@ -0,0 +1,349 @@
|
| +/* 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 Fri May 29 13:16:12 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_ProviderError_NONE,
|
| + PP_ProviderError_OK,
|
| + PP_ProviderError_FAILED,
|
| + PP_ProviderError_IN_USE,
|
| + PP_ProviderError_EXISTS,
|
| + PP_ProviderError_NOT_FOUND,
|
| + PP_ProviderError_ACCESS_DENIED,
|
| + PP_ProviderError_TOO_MANY_OPENED,
|
| + PP_ProviderError_NO_MEMORY,
|
| + PP_ProviderError_NO_SPACE,
|
| + PP_ProviderError_NOT_A_DIRECTORY,
|
| + PP_ProviderError_INVALID_OPERATION,
|
| + PP_ProviderError_SECURITY,
|
| + PP_ProviderError_ABORT,
|
| + PP_ProviderError_NOT_A_FILE,
|
| + PP_ProviderError_NOT_EMPTY,
|
| + PP_ProviderError_INVALID_URL,
|
| + PP_ProviderError_IO
|
| +} PP_ProviderError_Dev;
|
| +
|
| +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_Dev;
|
| +
|
| +typedef enum {
|
| + PP_OpenFileMode_NONE,
|
| + PP_OpenFileMode_READ,
|
| + PP_OpenFileMode_WRITE
|
| +} PP_OpenFileMode_Dev;
|
| +
|
| +typedef enum {
|
| + PP_ChangeType_NONE,
|
| + PP_ChangeType_CHANGED,
|
| + PP_ChangeType_DELETED
|
| +} PP_ChangeType_Dev;
|
| +/**
|
| + * @}
|
| + */
|
| +
|
| +/**
|
| + * @addtogroup Structs
|
| + * @{
|
| + */
|
| +/**
|
| + * Used by SendMetadataSuccessResponse and
|
| + * SendReadDirectorySuccessResponse to describe an entry/entries.
|
| + */
|
| +struct PP_EntryMetadata_Dev {
|
| + PP_Bool is_directory;
|
| + char name[128];
|
| + uint64_t size;
|
| + char modification_time[64];
|
| + char mime_type[128];
|
| + char thumbnail[512];
|
| +};
|
| +
|
| +struct PP_FilesystemRequestUnmount {
|
| +
|
| +};
|
| +
|
| +struct PP_FilesystemRequestMetadata {
|
| + char entry_path[256];
|
| + PP_Bool thumbnail;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestReadDirectory {
|
| + char directory_path[256];
|
| +};
|
| +
|
| +struct PP_FilesystemRequestOpenFile {
|
| + char file_path[256];
|
| + 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 {
|
| + char directory_path[256];
|
| + PP_Bool recursive;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestDeleteEntry {
|
| + char entry_path[256];
|
| + PP_Bool recursive;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestCreateFile {
|
| + char file_path[256];
|
| +};
|
| +
|
| +struct PP_FilesystemRequestCopyEntry {
|
| + char source_path[256];
|
| + char target_path[256];
|
| +};
|
| +
|
| +struct PP_FilesystemRequestMoveEntry {
|
| + char source_path[256];
|
| + char target_path[256];
|
| +};
|
| +
|
| +struct PP_FilesystemRequestTruncate {
|
| + char file_path[256];
|
| + 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;
|
| +};
|
| +
|
| +/**
|
| + * 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_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 <PP_ProviderError_Dev</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,
|
| + PP_ProviderError_Dev* error,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * Unmount() unregister the file system
|
| + * @param[in] filesystem_id A <code>PP_VARTYPE_STRING</code>
|
| + * @param[out] error A <code>PP_ProviderError</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,
|
| + PP_ProviderError_Dev* error,
|
| + struct PP_CompletionCallback callback);
|
| + /**
|
| + * Most of the operation will rely on the bellow 2 function calls to
|
| + * to report status to the browser.
|
| + * SendSuccessResponse() sends 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] operationType A <code>PP_ProviderError</code>
|
| + * @param[in] request_id A <code>int32_t</code>
|
| + */
|
| + int32_t (*SendErrorResponse)(PP_Resource filesystem_prov,
|
| + PP_OperationType_Dev operation_type,
|
| + PP_ProviderError_Dev 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_EntryMetadata_Dev</code>
|
| + * @param[in] request_id <code>int32_t</code>
|
| + */
|
| + int32_t (*SendMetadataSuccessResponse)(
|
| + PP_Resource filesystem_prov,
|
| + const struct PP_EntryMetadata_Dev* 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 several <code>PP_EntryMetadata_Dev</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,
|
| + uint32_t array_size,
|
| + const struct PP_EntryMetadata_Dev 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 (*FreeWriteRequestBuffer)(PP_Resource filesystem_prov,
|
| + const void* buffer);
|
| +};
|
| +
|
| +typedef struct PPB_FilesystemProvider_Dev_0_1 PPB_FilesystemProvider_Dev;
|
| +/**
|
| + * @}
|
| + */
|
| +
|
| +#endif /* PPAPI_C_DEV_PPB_FILESYSTEMPROVIDER_DEV_H_ */
|
| +
|
|
|