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
......@@ -172,7 +172,7 @@
{
"id": "FileSystemProviderSource",
"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"]
},
{
......
<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>
to use the File System Provider API.
For example:</p>
<pre data-filename="manifest.json">
{
"name": "My extension",
"name": "My {{platform}}",
...
<b>"permissions": [
"permissions": [
"fileSystemProvider"
]</b>,
],
...
"file_system_provider_capabilities": [
"configurable": true,
"multiple_mounts": true,
<span id="manifest-source">"source": "network"</span>
],
...
}
</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>
<p>
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
service other than Drive.
</p>
<h2 id="archives">File handlers</h2>
<h2 id="archives">Mounting file systems</h2>
<p>
Provided file systems 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
its input.
Providing extensions can either provide file system contents from an external
source (such as a remote server or a USB device), or using a local file (such as
an archive) as its input.
</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
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
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>
<h2 id="archives">Life cycle</h2>
<p>
Provided file systems once mounted are remembered by Chrome and remounted
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
either the extension is unloaded, or the extension calls the
<a href="#method-unmount"> unmount</a> method.
$(ref:mount mounted) by a providing extension, it will stay until either the
extension is unloaded, or the extension calls the $(ref:unmount) method.
</p>
{{?is_apps}}
<p>
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
of the providing extension. In such case
<a href="fileSystem#method-retainEntry">chrome.fileSystem.retainEntry</a> and
<a href="fileSystem#method-restoreEntry">chrome.fileSystem.restoreEntry</a>
should be used.
of the providing extension. In such case $(ref:fileSystem.retainEntry) and
$(ref:fileSystem.restoreEntry) should be used.
</p>
{{/is_apps}}
......@@ -88,6 +88,14 @@
"documentation": "manifest/file_handlers",
"example": {}
},
"file_system_provider_capabilities": {
"documentation": "manifest/file_system_provider",
"example": {
"configurable": true,
"multiple_mounts": true,
"source": "network"
}
},
"homepage_url": {
"documentation": "manifest/homepage_url",
"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