| Index: ppapi/api/dev/ppb_filesystemprovider_dev.idl
|
| diff --git a/ppapi/api/dev/ppb_filesystemprovider_dev.idl b/ppapi/api/dev/ppb_filesystemprovider_dev.idl
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f349e4925106be3aba7046d309046d56165bc8fd
|
| --- /dev/null
|
| +++ b/ppapi/api/dev/ppb_filesystemprovider_dev.idl
|
| @@ -0,0 +1,326 @@
|
| +/* 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.
|
| + */
|
| +
|
| +/**
|
| + * This file defines the <code>PPB_FilesystemProvider</code> interface.
|
| + */
|
| +
|
| +label Chrome {
|
| + M40 = 0.1
|
| +};
|
| +enum PP_OperationType_Dev{
|
| + 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
|
| +};
|
| +
|
| +enum PP_OpenFileMode_Dev {
|
| + PP_OpenFileMode_READ,
|
| + PP_OpenFileMode_WRITE,
|
| + PP_OpenFileMode_NONE
|
| +};
|
| +
|
| +enum PP_ChangeType_Dev {
|
| + PP_ChangeType_CHANGED,
|
| + PP_ChangeType_DELETED
|
| +};
|
| +
|
| +struct PP_FilesystemRequestUnmount{
|
| +};
|
| +
|
| +struct PP_FilesystemRequestMetadata{
|
| + cstr_t entry_path;
|
| + PP_Bool thumbnail;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestReadDirectory{
|
| + cstr_t directory_path;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestOpenFile{
|
| + cstr_t 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{
|
| + cstr_t directory_path;
|
| + PP_Bool recursive;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestDeleteEntry{
|
| + cstr_t entry_path;
|
| + PP_Bool recursive;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestCreateFile{
|
| + cstr_t file_path;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestCopyEntry{
|
| + cstr_t source_path;
|
| + cstr_t target_path;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestMoveEntry{
|
| + cstr_t source_path;
|
| + cstr_t target_path;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestTruncate{
|
| + cstr_t file_path;
|
| + int32_t length;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestWrite{
|
| + int32_t open_request_id;
|
| + uint64_t offset;
|
| + uint64_t data_size;
|
| + mem_t data;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestAbort{
|
| + int32_t operation_request_id;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestAddWatcher{
|
| + cstr_t entry_path;
|
| + PP_Bool recursive;
|
| +};
|
| +
|
| +struct PP_FilesystemRequestRemoveWatcher{
|
| + cstr_t entry_path;
|
| + PP_Bool recursive;
|
| +};
|
| +/**
|
| +* The request format
|
| +*/
|
| +[union] struct PP_FilesystemRequestValue {
|
| + PP_FilesystemRequestUnmount as_unmount;
|
| + PP_FilesystemRequestMetadata as_metadata;
|
| + PP_FilesystemRequestReadDirectory as_read_directory;
|
| + PP_FilesystemRequestOpenFile as_open_file;
|
| + PP_FilesystemRequestCloseFile as_close_file;
|
| + PP_FilesystemRequestReadFile as_read_file;
|
| + PP_FilesystemRequestCreateDirectory as_create_directory;
|
| + PP_FilesystemRequestDeleteEntry as_delete_entry;
|
| + PP_FilesystemRequestCreateFile as_create_file;
|
| + PP_FilesystemRequestCopyEntry as_copy_entry;
|
| + PP_FilesystemRequestMoveEntry as_move_entry;
|
| + PP_FilesystemRequestTruncate as_truncate;
|
| + PP_FilesystemRequestWrite as_write_file;
|
| + PP_FilesystemRequestAbort as_abort;
|
| + PP_FilesystemRequestAddWatcher as_add_watcher;
|
| + PP_FilesystemRequestRemoveWatcher as_remove_watcher;
|
| +};
|
| +
|
| +struct PP_FilesystemRequest{
|
| + PP_OperationType_Dev operation_type;
|
| + int32_t request_id;
|
| + PP_FilesystemRequestValue value;
|
| +};
|
| +/**
|
| +* 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>
|
| +*/
|
| +
|
| +interface PPB_FilesystemProvider_Dev {
|
| +
|
| +PP_Resource Create(
|
| + [in] PP_Instance instance );
|
| +
|
| +PP_Bool IsFilesystemProvider(
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [in] PP_Var filesystem_id,
|
| + [in] PP_Var display_name,
|
| + [in] PP_Bool writable,
|
| + [in] int32_t opened_files_limit,
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [in] PP_Var filesystem_id,
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [in] PP_OperationType_Dev operation_type,
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [in] PP_OperationType_Dev operation_type,
|
| + [in] int32_t error,
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [in] PP_Var metadata,
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [in] PP_Var entries,
|
| + [in] PP_Bool has_more,
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [in] uint32_t data_size,
|
| + [in, size_is(data_size)] mem_t data,
|
| + [in] PP_Bool has_more,
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [out] PP_FilesystemRequest request,
|
| + [in] 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(
|
| + [in] PP_Resource filesystem_prov,
|
| + [in] int32_t request_id);
|
| +};
|
| +
|
|
|