OLD | NEW |
1 <h2 id="manifest">Manifest</h2> | 1 <h2 id="manifest">Manifest</h2> |
2 <p>You must declare the "fileSystemProvider" permission | 2 <p>You must declare the "fileSystemProvider" permission |
3 in the <a href="manifest">extension manifest</a> | 3 in the <a href="manifest">extension manifest</a> |
4 to use the File System Provider API. | 4 to use the File System Provider API. |
5 For example:</p> | 5 For example:</p> |
6 <pre data-filename="manifest.json"> | 6 <pre data-filename="manifest.json"> |
7 { | 7 { |
8 "name": "My extension", | 8 "name": "My extension", |
9 ... | 9 ... |
10 <b>"permissions": [ | 10 <b>"permissions": [ |
11 "fileSystemProvider" | 11 "fileSystemProvider" |
12 ]</b>, | 12 ]</b>, |
13 ... | 13 ... |
14 } | 14 } |
15 </pre> | 15 </pre> |
16 | 16 |
17 <h2 id="overview">Overview</h2> | 17 <h2 id="overview">Overview</h2> |
18 <p> | 18 <p> |
19 File System Provider API allows extensions to support virtual file systems, | 19 File System Provider API allows extensions to support virtual file systems, |
20 which are available in the file manager on Chrome OS. | 20 which are available in the file manager on Chrome OS. |
21 Use cases include decompressing archives and accessing files in a cloud | 21 Use cases include decompressing archives and accessing files in a cloud |
22 service other than Drive. | 22 service other than Drive. |
23 </p> | 23 </p> |
24 | 24 |
25 <h2 id="archives">File handlers</h2> | 25 <h2 id="archives">Mounting file systems</h2> |
26 <p> | 26 <p> |
27 Provided file systems can either provide file system contents from an external | 27 Providing extensions can either provide file system contents from an external |
28 source (such as a remote server), or using a local file (such as an archive) as | 28 source (such as a remote server or a USB device), or using a local file (such as |
29 its input. | 29 an archive) as its input. |
30 </p> | 30 </p> |
31 <p> | 31 <p> |
32 In the second case, the providing extension should have a | 32 For file handlers, the providing extension should have a |
33 <a href="manifest/file_handlers">file_handlers</a> manifest entry in order | 33 <a href="manifest/file_handlers">file_handlers</a> manifest entry in order |
34 to be launched when the file is selected in the file manager. | 34 to be launched when the file is selected in the file manager. |
35 When the extension is executed with a file to be handled, it has to mount a | 35 When the extension is executed with a file to be handled, it has to mount a |
36 file system and start serving contents from the provided file. | 36 file system and start serving contents from the provided file. |
37 </p> | 37 </p> |
| 38 <p> |
| 39 If the source is network or a device, then the file system should be mounted |
| 40 when <a href="#event-onMountRequested">onMountDialogRequested</a> event is |
| 41 called. |
| 42 </p> |
| 43 <p> |
| 44 <table> |
| 45 <tr> |
| 46 <th> |
| 47 <a href="#property-options-source">Source</a> of the file system data |
| 48 </th> |
| 49 <th>Entry point</th> |
| 50 </tr> |
| 51 <tr> |
| 52 <td> |
| 53 <code>"FILE"</code> |
| 54 </td> |
| 55 <td> |
| 56 <a href="apps/app_runtime#event-onLaunched">onLaunched</a> |
| 57 </td> |
| 58 </tr> |
| 59 <tr> |
| 60 <td> |
| 61 <code>"DEVICE"</code>, <code>"NETWORK"</code> |
| 62 </td> |
| 63 <td> |
| 64 <a href="#event-onMountRequested">onMountRequested</a> |
| 65 </td> |
| 66 </tr> |
| 67 </table> |
| 68 </p> |
| 69 |
| 70 <h2 id="archives">Configuring file systems</h2> |
| 71 <p> |
| 72 Provided file systems once mounted can be configured via the |
| 73 <a href="#event-onConfigureRequested">onConfigureRequested</a> event. |
| 74 It's especially useful for file systems which provide contents via network in |
| 75 order to set proper credentials. Handling this event is optional. |
| 76 </p> |
38 | 77 |
39 <h2 id="archives">Life cycle</h2> | 78 <h2 id="archives">Life cycle</h2> |
40 <p> | 79 <p> |
41 Provided file systems once mounted are remembered by Chrome and remounted | 80 Provided file systems once mounted are remembered by Chrome and remounted |
42 automatically after reboot or restart. Hence, once a file system is | 81 automatically after reboot or restart. Hence, once a file system is |
43 <a href="method-mount">mounted</a> by a providing extension, it will stay until | 82 <a href="#method-mount">mounted</a> by a providing extension, it will stay until |
44 either the extension is unloaded, or the extension calls the | 83 either the extension is unloaded, or the extension calls the |
45 <a href="#method-unmount"> unmount</a> method. | 84 <a href="#method-unmount"> unmount</a> method. |
46 </p> | 85 </p> |
47 <p> | 86 <p> |
48 In case of acting as a file handler, the handled file may need to be stored | 87 In case of acting as a file handler, the handled file may need to be stored |
49 to access it after either a reboot, or suspending and resuming an event page | 88 to access it after either a reboot, or suspending and resuming an event page |
50 of the providing extension. In such case | 89 of the providing extension. In such case |
51 <a href="fileSystem#method-retainEntry">chrome.fileSystem.retainEntry</a> and | 90 <a href="fileSystem#method-retainEntry">chrome.fileSystem.retainEntry</a> and |
52 <a href="fileSystem#method-restoreEntry">chrome.fileSystem.restoreEntry</a> | 91 <a href="fileSystem#method-restoreEntry">chrome.fileSystem.restoreEntry</a> |
53 should be used. | 92 should be used. |
54 </p> | 93 </p> |
OLD | NEW |