Commit 16659538 authored by mtomasz's avatar mtomasz Committed by Commit bot

Update documentation for "file_system_provider" manifest section.

TEST=Checked manually with a test server.
BUG=None

Review URL: https://codereview.chromium.org/1127273004

Cr-Commit-Position: refs/heads/master@{#329582}
parent 7fc55d02
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
[implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h"] [implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h"]
namespace fileSystemProvider { namespace fileSystemProvider {
// Error codes used by providing extensions in response to requests as well // Error codes used by providing extensions in response to requests as well
// as in case of errors when calling methods of the API. For success, <code> // as in case of errors when calling methods of the API. For success,
// OK</code> must be used. // <code>OK</code> must be used.
enum ProviderError { enum ProviderError {
OK, OK,
FAILED, FAILED,
...@@ -29,7 +29,7 @@ namespace fileSystemProvider { ...@@ -29,7 +29,7 @@ namespace fileSystemProvider {
IO IO
}; };
// Mode of opening a file. Used by <code>onOpenFileRequested</code>. // Mode of opening a file. Used by $(ref:onOpenFileRequested).
enum OpenFileMode { enum OpenFileMode {
READ, READ,
WRITE WRITE
...@@ -61,7 +61,7 @@ namespace fileSystemProvider { ...@@ -61,7 +61,7 @@ namespace fileSystemProvider {
// Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most // Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most
// 32 KB in size. Optional, but can be provided only when explicitly // 32 KB in size. Optional, but can be provided only when explicitly
// requested by the <code>onGetMetadataRequested</code> event. // requested by the $(ref:onGetMetadataRequested) event.
DOMString? thumbnail; DOMString? thumbnail;
}; };
...@@ -117,7 +117,7 @@ namespace fileSystemProvider { ...@@ -117,7 +117,7 @@ namespace fileSystemProvider {
[nodoc] Watcher[] watchers; [nodoc] Watcher[] watchers;
}; };
// Options for the <code>mount()</code> method. // Options for the $(ref:mount) method.
dictionary MountOptions { dictionary MountOptions {
// The string indentifier of the file system. Must be unique per each // The string indentifier of the file system. Must be unique per each
// extension. // extension.
...@@ -139,13 +139,13 @@ namespace fileSystemProvider { ...@@ -139,13 +139,13 @@ namespace fileSystemProvider {
[nodoc] boolean? supportsNotifyTag; [nodoc] boolean? supportsNotifyTag;
}; };
// Options for the <code>unmount()</code> method. // Options for the $(ref:unmount) method.
dictionary UnmountOptions { dictionary UnmountOptions {
// The identifier of the file system to be unmounted. // The identifier of the file system to be unmounted.
DOMString fileSystemId; DOMString fileSystemId;
}; };
// Options for the <code>onUnmountRequested()</code> event. // Options for the $(ref:onUnmountRequested) event.
dictionary UnmountRequestedOptions { dictionary UnmountRequestedOptions {
// The identifier of the file system to be unmounted. // The identifier of the file system to be unmounted.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -154,7 +154,7 @@ namespace fileSystemProvider { ...@@ -154,7 +154,7 @@ namespace fileSystemProvider {
long requestId; long requestId;
}; };
// Options for the <code>onGetMetadataRequested()</code> event. // Options for the $(ref:onGetMetadataRequested) event.
dictionary GetMetadataRequestedOptions { dictionary GetMetadataRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -169,7 +169,7 @@ namespace fileSystemProvider { ...@@ -169,7 +169,7 @@ namespace fileSystemProvider {
boolean thumbnail; boolean thumbnail;
}; };
// Options for the <code>onReadDirectoryRequested()</code> event. // Options for the $(ref:onReadDirectoryRequested) event.
dictionary ReadDirectoryRequestedOptions { dictionary ReadDirectoryRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -181,7 +181,7 @@ namespace fileSystemProvider { ...@@ -181,7 +181,7 @@ namespace fileSystemProvider {
DOMString directoryPath; DOMString directoryPath;
}; };
// Options for the <code>onOpenFileRequested()</code> event. // Options for the $(ref:onOpenFileRequested) event.
dictionary OpenFileRequestedOptions { dictionary OpenFileRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -197,7 +197,7 @@ namespace fileSystemProvider { ...@@ -197,7 +197,7 @@ namespace fileSystemProvider {
OpenFileMode mode; OpenFileMode mode;
}; };
// Options for the <code>onCloseFileRequested()</code> event. // Options for the $(ref:onCloseFileRequested) event.
dictionary CloseFileRequestedOptions { dictionary CloseFileRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -209,7 +209,7 @@ namespace fileSystemProvider { ...@@ -209,7 +209,7 @@ namespace fileSystemProvider {
long openRequestId; long openRequestId;
}; };
// Options for the <code>onReadFileRequested()</code> event. // Options for the $(ref:onReadFileRequested) event.
dictionary ReadFileRequestedOptions { dictionary ReadFileRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -227,7 +227,7 @@ namespace fileSystemProvider { ...@@ -227,7 +227,7 @@ namespace fileSystemProvider {
double length; double length;
}; };
// Options for the <code>onCreateDirectoryRequested()</code> event. // Options for the $(ref:onCreateDirectoryRequested) event.
dictionary CreateDirectoryRequestedOptions { dictionary CreateDirectoryRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -242,7 +242,7 @@ namespace fileSystemProvider { ...@@ -242,7 +242,7 @@ namespace fileSystemProvider {
boolean recursive; boolean recursive;
}; };
// Options for the <code>onDeleteEntryRequested()</code> event. // Options for the $(ref:onDeleteEntryRequested) event.
dictionary DeleteEntryRequestedOptions { dictionary DeleteEntryRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -257,7 +257,7 @@ namespace fileSystemProvider { ...@@ -257,7 +257,7 @@ namespace fileSystemProvider {
boolean recursive; boolean recursive;
}; };
// Options for the <code>onCreateFileRequested()</code> event. // Options for the $(ref:onCreateFileRequested) event.
dictionary CreateFileRequestedOptions { dictionary CreateFileRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -269,7 +269,7 @@ namespace fileSystemProvider { ...@@ -269,7 +269,7 @@ namespace fileSystemProvider {
DOMString filePath; DOMString filePath;
}; };
// Options for the <code>onCopyEntryRequested()</code> event. // Options for the $(ref:onCopyEntryRequested) event.
dictionary CopyEntryRequestedOptions { dictionary CopyEntryRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -284,7 +284,7 @@ namespace fileSystemProvider { ...@@ -284,7 +284,7 @@ namespace fileSystemProvider {
DOMString targetPath; DOMString targetPath;
}; };
// Options for the <code>onMoveEntryRequested()</code> event. // Options for the $(ref:onMoveEntryRequested) event.
dictionary MoveEntryRequestedOptions { dictionary MoveEntryRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -299,7 +299,7 @@ namespace fileSystemProvider { ...@@ -299,7 +299,7 @@ namespace fileSystemProvider {
DOMString targetPath; DOMString targetPath;
}; };
// Options for the <code>onTruncateRequested()</code> event. // Options for the $(ref:onTruncateRequested) event.
dictionary TruncateRequestedOptions { dictionary TruncateRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -314,7 +314,7 @@ namespace fileSystemProvider { ...@@ -314,7 +314,7 @@ namespace fileSystemProvider {
double length; double length;
}; };
// Options for the <code>onWriteFileRequested()</code> event. // Options for the $(ref:onWriteFileRequested) event.
dictionary WriteFileRequestedOptions { dictionary WriteFileRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -332,7 +332,7 @@ namespace fileSystemProvider { ...@@ -332,7 +332,7 @@ namespace fileSystemProvider {
ArrayBuffer data; ArrayBuffer data;
}; };
// Options for the <code>onAbortRequested()</code> event. // Options for the $(ref:onAbortRequested) event.
dictionary AbortRequestedOptions { dictionary AbortRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -344,7 +344,7 @@ namespace fileSystemProvider { ...@@ -344,7 +344,7 @@ namespace fileSystemProvider {
long operationRequestId; long operationRequestId;
}; };
// Options for the <code>onAddWatcherRequested()</code> event. // Options for the $(ref:onAddWatcherRequested) event.
dictionary AddWatcherRequestedOptions { dictionary AddWatcherRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -360,7 +360,7 @@ namespace fileSystemProvider { ...@@ -360,7 +360,7 @@ namespace fileSystemProvider {
boolean recursive; boolean recursive;
}; };
// Options for the <code>onRemoveWatcherRequested()</code> event. // Options for the $(ref:onRemoveWatcherRequested) event.
dictionary RemoveWatcherRequestedOptions { dictionary RemoveWatcherRequestedOptions {
// The identifier of the file system related to this operation. // The identifier of the file system related to this operation.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -385,7 +385,7 @@ namespace fileSystemProvider { ...@@ -385,7 +385,7 @@ namespace fileSystemProvider {
ChangeType changeType; ChangeType changeType;
}; };
// Options for the <code>Notify()</code> method. // Options for the $(ref:notify) method.
dictionary NotifyOptions { dictionary NotifyOptions {
// The identifier of the file system related to this change. // The identifier of the file system related to this change.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -412,8 +412,8 @@ namespace fileSystemProvider { ...@@ -412,8 +412,8 @@ namespace fileSystemProvider {
DOMString? tag; DOMString? tag;
}; };
// Options for the <code>onConfigureRequested()</code> event. // Options for the $(ref:onConfigureRequested) event.
[nodoc] dictionary ConfigureRequestedOptions { dictionary ConfigureRequestedOptions {
// The identifier of the file system to be configured. // The identifier of the file system to be configured.
DOMString fileSystemId; DOMString fileSystemId;
...@@ -421,10 +421,10 @@ namespace fileSystemProvider { ...@@ -421,10 +421,10 @@ namespace fileSystemProvider {
long requestId; long requestId;
}; };
// Callback to receive the result of getAll() function. // Callback to receive the result of $(ref:getAll) function.
callback GetAllCallback = void(FileSystemInfo[] fileSystems); callback GetAllCallback = void(FileSystemInfo[] fileSystems);
// Callback to receive the result of get() function. // Callback to receive the result of $(ref:get) function.
callback GetCallback = void(FileSystemInfo fileSystem); callback GetCallback = void(FileSystemInfo fileSystem);
// Callback to be called by the providing extension in case of a success. // Callback to be called by the providing extension in case of a success.
...@@ -433,18 +433,18 @@ namespace fileSystemProvider { ...@@ -433,18 +433,18 @@ namespace fileSystemProvider {
// Callback to be called by the providing extension in case of an error. // Callback to be called by the providing extension in case of an error.
[nocompile] callback ProviderErrorCallback = void(ProviderError error); [nocompile] callback ProviderErrorCallback = void(ProviderError error);
// Success callback for the <code>onGetMetadataRequested</code> event. // Success callback for the $(ref:onGetMetadataRequested) event.
[nocompile] callback MetadataCallback = void( [nocompile] callback MetadataCallback = void(
EntryMetadata metadata); EntryMetadata metadata);
// Success callback for the <code>onReadDirectoryRequested</code> event. If // Success callback for the $(ref:onReadDirectoryRequested) event. If more
// more entries will be returned, then <code>hasMore</code> must be true, and // entries will be returned, then <code>hasMore</code> must be true, and it
// it has to be called again with additional entries. If no more entries are // has to be called again with additional entries. If no more entries are
// available, then <code>hasMore</code> must be set to false. // available, then <code>hasMore</code> must be set to false.
[nocompile] callback EntriesCallback = void( [nocompile] callback EntriesCallback = void(
EntryMetadata[] entries, boolean hasMore); EntryMetadata[] entries, boolean hasMore);
// Success callback for the <code>onReadFileRequested</code> event. If more // Success callback for the $(ref:onReadFileRequested) event. If more
// data will be returned, then <code>hasMore</code> must be true, and it // data will be returned, then <code>hasMore</code> must be true, and it
// has to be called again with additional entries. If no more data is // has to be called again with additional entries. If no more data is
// available, then <code>hasMore</code> must be set to false. // available, then <code>hasMore</code> must be set to false.
...@@ -455,52 +455,52 @@ namespace fileSystemProvider { ...@@ -455,52 +455,52 @@ namespace fileSystemProvider {
callback ResultCallback = void(); callback ResultCallback = void();
interface Functions { interface Functions {
// Mounts a file system with the given <code>fileSystemId</code> and <code> // Mounts a file system with the given <code>fileSystemId</code> and
// displayName</code>. <code>displayName</code> will be shown in the left // <code>displayName</code>. <code>displayName</code> will be shown in the
// panel of Files.app. <code>displayName</code> can contain any characters // left panel of Files.app. <code>displayName</code> can contain any
// including '/', but cannot be an empty string. <code>displayName</code> // characters including '/', but cannot be an empty string.
// must be descriptive but doesn't have to be unique. The <code>fileSystemId // <code>displayName</code> must be descriptive but doesn't have to be
// </code> must not be an empty string. // unique. The <code>fileSystemId</code> must not be an empty string.
// //
// Depending on the type of the file system being mounted, the <code>source // Depending on the type of the file system being mounted, the
// </code> option must be set appropriately. // <code>source</code> option must be set appropriately.
// //
// In case of an error, <code>chrome.runtime.lastError</code> will be set // In case of an error, $(ref:runtime.lastError) will be set with a
// will a corresponding error code. // corresponding error code.
static void mount(MountOptions options, static void mount(MountOptions options,
optional ResultCallback callback); optional ResultCallback callback);
// Unmounts a file system with the given <code>fileSystemId</code>. It // Unmounts a file system with the given <code>fileSystemId</code>. It
// must be called after <code>onUnmountRequested</code> is invoked. Also, // must be called after $(ref:onUnmountRequested) is invoked. Also,
// the providing extension can decide to perform unmounting if not requested // the providing extension can decide to perform unmounting if not requested
// (eg. in case of lost connection, or a file error). // (eg. in case of lost connection, or a file error).
// //
// In case of an error, <code>chrome.runtime.lastError</code> will be set // In case of an error, $(ref:runtime.lastError) will be set with a
// will a corresponding error code. // corresponding error code.
static void unmount(UnmountOptions options, static void unmount(UnmountOptions options,
optional ResultCallback callback); optional ResultCallback callback);
// Returns all file systems mounted by the extension. // Returns all file systems mounted by the extension.
static void getAll(GetAllCallback callback); static void getAll(GetAllCallback callback);
// Returns information about a file system with the passed <code> // Returns information about a file system with the passed
// fileSystemId</code>. // <code>fileSystemId</code>.
static void get(DOMString fileSystemId, GetCallback callback); static void get(DOMString fileSystemId, GetCallback callback);
// Notifies about changes in the watched directory at <code> // Notifies about changes in the watched directory at
// observedPath</code> in <code>recursive</code mode. If the file system is // <code>observedPath</code> in <code>recursive</code> mode. If the file
// mounted with <code>supportsNofityTag</code>, then <code>tag</code> must // system is mounted with <code>supportsNofityTag</code>, then
// be provided, and all changes since the last notification always reported, // <code>tag</code> must be provided, and all changes since the last
// even if the system was shutdown. The last tag can be obtained with <code> // notification always reported, even if the system was shutdown. The last
// getAll()</code>. Note, that <code>tag</code> is required in order to // tag can be obtained with $(ref:getAll). Note, that <code>tag</code> is
// enable the internal cache. // required in order to enable the internal cache.
// //
// Value of <code>tag</code> can be any string which is unique per call, // Value of <code>tag</code> can be any string which is unique per call,
// so it's possible to identify the last registered notification. Eg. if // so it's possible to identify the last registered notification. Eg. if
// the providing extension starts after a reboot, and the last registered // the providing extension starts after a reboot, and the last registered
// notification's tag is equal to "123", then it should call notify() for // notification's tag is equal to "123", then it should call $(ref:notify)
// all changes which happened since the change tagged as "123". It cannot // for all changes which happened since the change tagged as "123". It
// be an empty string. // cannot be an empty string.
// //
// Not all providers are able to provide a tag, but if the file system has // Not all providers are able to provide a tag, but if the file system has
// a changelog, then the tag can be eg. a change number, or a revision // a changelog, then the tag can be eg. a change number, or a revision
...@@ -512,36 +512,36 @@ namespace fileSystemProvider { ...@@ -512,36 +512,36 @@ namespace fileSystemProvider {
// entries are in fact removed, as there is no entry under their original // entries are in fact removed, as there is no entry under their original
// paths anymore. // paths anymore.
// //
// In case of an error, <code>chrome.runtime.lastError</code> will be set // In case of an error, $(ref:chrome.runtime.lastError) will be set
// will a corresponding error code. // will a corresponding error code.
[nodoc] static void notify(NotifyOptions options, [nodoc] static void notify(NotifyOptions options,
optional ResultCallback callback); optional ResultCallback callback);
}; };
interface Events { interface Events {
// Raised when unmounting for the file system with the <code>fileSystemId // Raised when unmounting for the file system with the
// </code> identifier is requested. In the response, the <code>unmount // <code>fileSystemId</code> identifier is requested. In the response, the
// </code> API method must be called together with <code>successCallback // $(ref:unmount) API method must be called together with
// </code>. If unmounting is not possible (eg. due to a pending operation), // <code>successCallback</code>. If unmounting is not possible (eg. due to
// then <code>errorCallback</code> must be called. // a pending operation), then <code>errorCallback</code> must be called.
[maxListeners=1] static void onUnmountRequested( [maxListeners=1] static void onUnmountRequested(
UnmountRequestedOptions options, UnmountRequestedOptions options,
ProviderSuccessCallback successCallback, ProviderSuccessCallback successCallback,
ProviderErrorCallback errorCallback); ProviderErrorCallback errorCallback);
// Raised when metadata of a file or a directory at <code>entryPath</code> // Raised when metadata of a file or a directory at <code>entryPath</code>
// is requested. The metadata must be returned with the <code> // is requested. The metadata must be returned with the
// successCallback</code> call. In case of an error, <code>errorCallback // <code>successCallback</code> call. In case of an error,
// </code> must be called. // <code>errorCallback</code> must be called.
[maxListeners=1] static void onGetMetadataRequested( [maxListeners=1] static void onGetMetadataRequested(
GetMetadataRequestedOptions options, GetMetadataRequestedOptions options,
MetadataCallback successCallback, MetadataCallback successCallback,
ProviderErrorCallback errorCallback); ProviderErrorCallback errorCallback);
// Raised when contents of a directory at <code>directoryPath</code> are // Raised when contents of a directory at <code>directoryPath</code> are
// requested. The results must be returned in chunks by calling the <code> // requested. The results must be returned in chunks by calling the
// successCallback</code> several times. In case of an error, <code> // <code>successCallback</code> several times. In case of an error,
// errorCallback</code> must be called. // <code>errorCallback</code> must be called.
[maxListeners=1] static void onReadDirectoryRequested( [maxListeners=1] static void onReadDirectoryRequested(
ReadDirectoryRequestedOptions options, ReadDirectoryRequestedOptions options,
EntriesCallback successCallback, EntriesCallback successCallback,
...@@ -555,15 +555,15 @@ namespace fileSystemProvider { ...@@ -555,15 +555,15 @@ namespace fileSystemProvider {
ProviderSuccessCallback successCallback, ProviderSuccessCallback successCallback,
ProviderErrorCallback errorCallback); ProviderErrorCallback errorCallback);
// Raised when opening a file previously opened with <code>openRequestId // Raised when opening a file previously opened with
// </code> is requested to be closed. // <code>openRequestId</code> is requested to be closed.
[maxListeners=1] static void onCloseFileRequested( [maxListeners=1] static void onCloseFileRequested(
CloseFileRequestedOptions options, CloseFileRequestedOptions options,
ProviderSuccessCallback successCallback, ProviderSuccessCallback successCallback,
ProviderErrorCallback errorCallback); ProviderErrorCallback errorCallback);
// Raised when reading contents of a file opened previously with <code> // Raised when reading contents of a file opened previously with
// openRequestId</code> is requested. The results must be returned in // <code>openRequestId</code> is requested. The results must be returned in
// chunks by calling <code>successCallback</code> several times. In case of // chunks by calling <code>successCallback</code> several times. In case of
// an error, <code>errorCallback</code> must be called. // an error, <code>errorCallback</code> must be called.
[maxListeners=1] static void onReadFileRequested( [maxListeners=1] static void onReadFileRequested(
...@@ -589,8 +589,8 @@ namespace fileSystemProvider { ...@@ -589,8 +589,8 @@ namespace fileSystemProvider {
ProviderErrorCallback errorCallback); ProviderErrorCallback errorCallback);
// Raised when creating a file is requested. If the file already exists, // Raised when creating a file is requested. If the file already exists,
// then <code>errorCallback</code> must be called with the <code>EXISTS // then <code>errorCallback</code> must be called with the
// </code> error code. // <code>"EXISTS"</code> error code.
[maxListeners=1] static void onCreateFileRequested( [maxListeners=1] static void onCreateFileRequested(
CreateFileRequestedOptions options, CreateFileRequestedOptions options,
ProviderSuccessCallback successCallback, ProviderSuccessCallback successCallback,
...@@ -617,8 +617,8 @@ namespace fileSystemProvider { ...@@ -617,8 +617,8 @@ namespace fileSystemProvider {
ProviderSuccessCallback successCallback, ProviderSuccessCallback successCallback,
ProviderErrorCallback errorCallback); ProviderErrorCallback errorCallback);
// Raised when writing contents to a file opened previously with <code> // Raised when writing contents to a file opened previously with
// openRequestId</code> is requested. // <code>openRequestId</code> is requested.
[maxListeners=1] static void onWriteFileRequested( [maxListeners=1] static void onWriteFileRequested(
WriteFileRequestedOptions options, WriteFileRequestedOptions options,
ProviderSuccessCallback successCallback, ProviderSuccessCallback successCallback,
...@@ -627,27 +627,31 @@ namespace fileSystemProvider { ...@@ -627,27 +627,31 @@ namespace fileSystemProvider {
// Raised when aborting an operation with <code>operationRequestId</code> // Raised when aborting an operation with <code>operationRequestId</code>
// is requested. The operation executed with <code>operationRequestId</code> // is requested. The operation executed with <code>operationRequestId</code>
// must be immediately stopped and <code>successCallback</code> of this // must be immediately stopped and <code>successCallback</code> of this
// abort request executed. If aborting fails, then <code>errorCallback // abort request executed. If aborting fails, then
// </code> must be called. Note, that callbacks of the aborted operation // <code>errorCallback</code> must be called. Note, that callbacks of the
// must not be called, as they will be ignored. Despite calling <code> // aborted operation must not be called, as they will be ignored. Despite
// errorCallback</code>, the request may be forcibly aborted. // calling <code>errorCallback</code>, the request may be forcibly aborted.
[maxListeners=1] static void onAbortRequested( [maxListeners=1] static void onAbortRequested(
AbortRequestedOptions options, AbortRequestedOptions options,
ProviderSuccessCallback successCallback, ProviderSuccessCallback successCallback,
ProviderErrorCallback errorCallback); ProviderErrorCallback errorCallback);
// Raised when showing a configuration dialog for <code>fileSystemId</code> // Raised when showing a configuration dialog for <code>fileSystemId</code>
// is requested. If it's not supported, then this event must not be handled. // is requested. If it's handled, the
[maxListeners=1, nodoc] static void onConfigureRequested( // <code>file_system_provider.configurable</code> manfiest option must be
// set to true.
[maxListeners=1] static void onConfigureRequested(
ConfigureRequestedOptions options, ConfigureRequestedOptions options,
ProviderSuccessCallback successCallback, ProviderSuccessCallback successCallback,
ProviderErrorCallback errorCallback); ProviderErrorCallback errorCallback);
// Raised when showing a dialog for mounting a new file system is requested. // Raised when showing a dialog for mounting a new file system is requested.
// If the extension/app is a file handler, then this event shouldn't be // If the extension/app is a file handler, then this event shouldn't be
// handled. Instead <code>onLaunched</code> should be handled in order to // handled. Instead <code>app.runtime.onLaunched</code> should be handled in
// mount new file systems when a file is opened. // order to mount new file systems when a file is opened. For multiple
[maxListeners=1, nodoc] static void onMountRequested( // mounts, the <code>file_system_provider.multiple_mounts</code> manifest
// option must be set to true.
[maxListeners=1] static void onMountRequested(
ProviderSuccessCallback successCallback, ProviderSuccessCallback successCallback,
ProviderErrorCallback errorCallback); ProviderErrorCallback errorCallback);
......
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
{ {
"id": "FileSystemProviderSource", "id": "FileSystemProviderSource",
"type": "string", "type": "string",
"description": "For <code>file</code> the source is a file passed via <code>onLaunched</code> event. For <code>device</code> contents are fetched from an external device (eg. plugged via USB), without using <code>file_handlers</code>. Finally, for <code>device</code> source, contents should be fetched via network.", "description": "For <code>\"file\"</code> the source is a file passed via <code>onLaunched</code> event. For <code>\"device\"</code> contents are fetched from an external device (eg. plugged via USB), without using <code>file_handlers</code>. Finally, for <code>\"network\"</code> source, contents should be fetched via network.",
"enum": ["file", "device", "network"] "enum": ["file", "device", "network"]
}, },
{ {
......
<h2 id="manifest">Manifest</h2> <h2 id="manifest">Manifest</h2>
<p>You must declare the "fileSystemProvider" permission <p>You must declare the "fileSystemProvider" permission and section
in the <a href="manifest">extension manifest</a> in the <a href="manifest">extension manifest</a>
to use the File System Provider API. to use the File System Provider API.
For example:</p> For example:</p>
<pre data-filename="manifest.json"> <pre data-filename="manifest.json">
{ {
"name": "My extension", "name": "My {{platform}}",
... ...
<b>"permissions": [ "permissions": [
"fileSystemProvider" "fileSystemProvider"
]</b>, ],
...
"file_system_provider_capabilities": [
"configurable": true,
"multiple_mounts": true,
<span id="manifest-source">"source": "network"</span>
],
... ...
} }
</pre> </pre>
<p class="api_reference">
The <code>file_system_provider</code> section must be declared as follows:
{{+partials.manifest_type
type:apis.extensions.manifestTypes.byName.FileSystemProviderCapabilities /}}
</p>
<p>
Files app uses above information in order to render related UI elements
approprietly. For example, if <code>configurable</code> is set to
</code>true</code>, then a menu item for configuring volumes will be rendered.
Similarly, if <code>multiple_mounts</code> is set to <code>true</code>, then
Files app will allow to add more than one mount points from the UI.
</p>
<h2 id="overview">Overview</h2> <h2 id="overview">Overview</h2>
<p> <p>
File System Provider API allows extensions to support virtual file systems, File System Provider API allows extensions to support virtual file systems,
...@@ -22,33 +41,81 @@ Use cases include decompressing archives and accessing files in a cloud ...@@ -22,33 +41,81 @@ Use cases include decompressing archives and accessing files in a cloud
service other than Drive. service other than Drive.
</p> </p>
<h2 id="archives">File handlers</h2> <h2 id="archives">Mounting file systems</h2>
<p> <p>
Provided file systems can either provide file system contents from an external Providing extensions can either provide file system contents from an external
source (such as a remote server), or using a local file (such as an archive) as source (such as a remote server or a USB device), or using a local file (such as
its input. an archive) as its input.
</p> </p>
<p> <p>
In the second case, the providing extension should have a {{?is_apps}}
For file handlers, the providing extension should have a
<a href="manifest/file_handlers">file_handlers</a> manifest entry in order <a href="manifest/file_handlers">file_handlers</a> manifest entry in order
to be launched when the file is selected in the file manager. to be launched when the file is selected in the file manager.
When the extension is executed with a file to be handled, it has to mount a When the extension is executed with a file to be handled, it has to mount a
file system and start serving contents from the provided file. file system and start serving contents from the provided file.
{{:is_apps}}
In order to write file systems which are file handlers (source is
<code>"file"</code>) the provider must be a packaged app, as the
<code>onLaunched</code>event is not available to extensions.
{{/is_apps}}
</p>
<p>
If the source is network or a device, then the file system should be mounted
when $(ref:onMountRequested) event is called.
</p>
<p>
<table id="source-table">
<tr>
<th>
<a href="#manifest-source">Source</a> of the file system data
</th>
<th>Entry point</th>
</tr>
<tr>
<td>
<code>"file"</code>
</td>
<td>
{{?is_apps}}
$(ref:app.runtime.onLaunched)
{{:is_apps}}
Available to <a href="/apps/fileSystemProvider#source-table">packaged
apps</a> only.
{{/is_apps}}
</td>
</tr>
<tr>
<td>
<code>"device"</code> or <code>"network"</code>
</td>
<td>
$(ref:onMountRequested)
</td>
</tr>
</table>
</p>
<h2 id="archives">Configuring file systems</h2>
<p>
Provided file systems once mounted can be configured via the
$(ref:onConfigureRequested) event. It's especially useful for file systems which
provide contents via network in order to set proper credentials. Handling this
event is optional.
</p> </p>
<h2 id="archives">Life cycle</h2> <h2 id="archives">Life cycle</h2>
<p> <p>
Provided file systems once mounted are remembered by Chrome and remounted Provided file systems once mounted are remembered by Chrome and remounted
automatically after reboot or restart. Hence, once a file system is automatically after reboot or restart. Hence, once a file system is
<a href="method-mount">mounted</a> by a providing extension, it will stay until $(ref:mount mounted) by a providing extension, it will stay until either the
either the extension is unloaded, or the extension calls the extension is unloaded, or the extension calls the $(ref:unmount) method.
<a href="#method-unmount"> unmount</a> method.
</p> </p>
{{?is_apps}}
<p> <p>
In case of acting as a file handler, the handled file may need to be stored In case of acting as a file handler, the handled file may need to be stored
to access it after either a reboot, or suspending and resuming an event page to access it after either a reboot, or suspending and resuming an event page
of the providing extension. In such case of the providing extension. In such case $(ref:fileSystem.retainEntry) and
<a href="fileSystem#method-retainEntry">chrome.fileSystem.retainEntry</a> and $(ref:fileSystem.restoreEntry) should be used.
<a href="fileSystem#method-restoreEntry">chrome.fileSystem.restoreEntry</a>
should be used.
</p> </p>
{{/is_apps}}
...@@ -88,6 +88,14 @@ ...@@ -88,6 +88,14 @@
"documentation": "manifest/file_handlers", "documentation": "manifest/file_handlers",
"example": {} "example": {}
}, },
"file_system_provider_capabilities": {
"documentation": "manifest/file_system_provider",
"example": {
"configurable": true,
"multiple_mounts": true,
"source": "network"
}
},
"homepage_url": { "homepage_url": {
"documentation": "manifest/homepage_url", "documentation": "manifest/homepage_url",
"example": "http://path/to/homepage" "example": "http://path/to/homepage"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment