OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use the <code>chrome.fileSystemProvider</code> API to create file systems, | 5 // Use the <code>chrome.fileSystemProvider</code> API to create file systems, |
6 // that can be accessible from the file manager on Chrome OS. | 6 // that can be accessible from the file manager on Chrome OS. |
7 [implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_sy stem_provider_api.h"] | 7 [implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_sy stem_provider_api.h"] |
8 namespace fileSystemProvider { | 8 namespace fileSystemProvider { |
9 // Error codes used by providing extensions in response to requests as well | 9 // Error codes used by providing extensions in response to requests as well |
10 // as in case of errors when calling methods of the API. For success, <code> | 10 // as in case of errors when calling methods of the API. For success, <code> |
(...skipping 23 matching lines...) Expand all Loading... | |
34 READ, | 34 READ, |
35 WRITE | 35 WRITE |
36 }; | 36 }; |
37 | 37 |
38 // Type of a change detected on the observed directory. | 38 // Type of a change detected on the observed directory. |
39 enum ChangeType { | 39 enum ChangeType { |
40 CHANGED, | 40 CHANGED, |
41 DELETED | 41 DELETED |
42 }; | 42 }; |
43 | 43 |
44 // Source of the file system data. | |
45 enum FileSystemSource { | |
46 // The file system is handling a file, eg. an archive file obtained via the | |
47 // <code>OnLaunched</code> event and the <code>file_handlers</code> manifest | |
48 // entry. | |
49 FILE, | |
50 | |
51 // The file system contents are fetched from an external device, such as a | |
52 // USB device, but not via <code>file_handlers</code>. | |
53 DEVICE, | |
54 | |
55 // The file system is network based. The contents are obtained from another | |
56 // server or local network. Eg. cloud services. | |
57 NETWORK | |
58 }; | |
59 | |
44 // Represents metadata of a file or a directory. | 60 // Represents metadata of a file or a directory. |
45 dictionary EntryMetadata { | 61 dictionary EntryMetadata { |
46 // True if it is a directory. | 62 // True if it is a directory. |
47 boolean isDirectory; | 63 boolean isDirectory; |
48 | 64 |
49 // Name of this entry (not full path name). Must not contain '/'. For root | 65 // Name of this entry (not full path name). Must not contain '/'. For root |
50 // it must be empty. | 66 // it must be empty. |
51 DOMString name; | 67 DOMString name; |
52 | 68 |
53 // File size in bytes. | 69 // File size in bytes. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 // of the file system (such as creating, deleting or writing to files). | 118 // of the file system (such as creating, deleting or writing to files). |
103 boolean writable; | 119 boolean writable; |
104 | 120 |
105 // The maximum number of files that can be opened at once. If 0, then not | 121 // The maximum number of files that can be opened at once. If 0, then not |
106 // limited. | 122 // limited. |
107 long openedFilesLimit; | 123 long openedFilesLimit; |
108 | 124 |
109 // List of currently opened files. | 125 // List of currently opened files. |
110 OpenedFile[] openedFiles; | 126 OpenedFile[] openedFiles; |
111 | 127 |
128 // Source of the file system data. | |
129 FileSystemSource? source; | |
130 | |
112 // Whether the file system supports the <code>tag</code> field for observing | 131 // Whether the file system supports the <code>tag</code> field for observing |
113 // directories. | 132 // directories. |
114 [nodoc] boolean? supportsNotifyTag; | 133 [nodoc] boolean? supportsNotifyTag; |
115 | 134 |
116 // List of watchers. | 135 // List of watchers. |
117 [nodoc] Watcher[] watchers; | 136 [nodoc] Watcher[] watchers; |
118 }; | 137 }; |
119 | 138 |
120 // Options for the <code>mount()</code> method. | 139 // Options for the <code>mount()</code> method. |
121 dictionary MountOptions { | 140 dictionary MountOptions { |
122 // The string indentifier of the file system. Must be unique per each | 141 // The string indentifier of the file system. Must be unique per each |
123 // extension. | 142 // extension. |
124 DOMString fileSystemId; | 143 DOMString fileSystemId; |
125 | 144 |
126 // A human-readable name for the file system. | 145 // A human-readable name for the file system. |
127 DOMString displayName; | 146 DOMString displayName; |
128 | 147 |
129 // Whether the file system supports operations which may change contents | 148 // Whether the file system supports operations which may change contents |
130 // of the file system (such as creating, deleting or writing to files). | 149 // of the file system (such as creating, deleting or writing to files). |
131 boolean? writable; | 150 boolean? writable; |
132 | 151 |
133 // The maximum number of files that can be opened at once. If not specified, | 152 // The maximum number of files that can be opened at once. If not specified, |
134 // or 0, then not limited. | 153 // or 0, then not limited. |
135 long? openedFilesLimit; | 154 long? openedFilesLimit; |
136 | 155 |
156 // Source of the file system data. | |
157 FileSystemSource? source; | |
158 | |
137 // Whether the file system supports the <code>tag</code> field for observed | 159 // Whether the file system supports the <code>tag</code> field for observed |
138 // directories. Required in order to enable the internal cache. | 160 // directories. Required in order to enable the internal cache. |
139 [nodoc] boolean? supportsNotifyTag; | 161 [nodoc] boolean? supportsNotifyTag; |
140 }; | 162 }; |
141 | 163 |
142 // Options for the <code>unmount()</code> method. | 164 // Options for the <code>unmount()</code> method. |
143 dictionary UnmountOptions { | 165 dictionary UnmountOptions { |
144 // The identifier of the file system to be unmounted. | 166 // The identifier of the file system to be unmounted. |
145 DOMString fileSystemId; | 167 DOMString fileSystemId; |
146 }; | 168 }; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 callback ResultCallback = void(); | 466 callback ResultCallback = void(); |
445 | 467 |
446 interface Functions { | 468 interface Functions { |
447 // Mounts a file system with the given <code>fileSystemId</code> and <code> | 469 // Mounts a file system with the given <code>fileSystemId</code> and <code> |
448 // displayName</code>. <code>displayName</code> will be shown in the left | 470 // displayName</code>. <code>displayName</code> will be shown in the left |
449 // panel of Files.app. <code>displayName</code> can contain any characters | 471 // panel of Files.app. <code>displayName</code> can contain any characters |
450 // including '/', but cannot be an empty string. <code>displayName</code> | 472 // including '/', but cannot be an empty string. <code>displayName</code> |
451 // must be descriptive but doesn't have to be unique. The <code>fileSystemId | 473 // must be descriptive but doesn't have to be unique. The <code>fileSystemId |
452 // </code> must not be an empty string. | 474 // </code> must not be an empty string. |
453 // | 475 // |
476 // Depending on the type of the file system being mounted, the <code>source | |
477 // </code> option must be set apprioprietly. | |
benwells
2015/04/09 07:32:12
Nit: Spelling of appropriately.
mtomasz
2015/04/09 12:42:36
Done.
| |
478 // | |
454 // In case of an error, <code>chrome.runtime.lastError</code> will be set | 479 // In case of an error, <code>chrome.runtime.lastError</code> will be set |
455 // will a corresponding error code. | 480 // will a corresponding error code. |
456 static void mount(MountOptions options, | 481 static void mount(MountOptions options, |
457 optional ResultCallback callback); | 482 optional ResultCallback callback); |
458 | 483 |
459 // Unmounts a file system with the given <code>fileSystemId</code>. It | 484 // Unmounts a file system with the given <code>fileSystemId</code>. It |
460 // must be called after <code>onUnmountRequested</code> is invoked. Also, | 485 // must be called after <code>onUnmountRequested</code> is invoked. Also, |
461 // the providing extension can decide to perform unmounting if not requested | 486 // the providing extension can decide to perform unmounting if not requested |
462 // (eg. in case of lost connection, or a file error). | 487 // (eg. in case of lost connection, or a file error). |
463 // | 488 // |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
631 | 656 |
632 // Raised when the watcher should be removed. If an error occurs, then | 657 // Raised when the watcher should be removed. If an error occurs, then |
633 // <code>errorCallback</code> must be called. | 658 // <code>errorCallback</code> must be called. |
634 [maxListeners=1, nodoc] static void onRemoveWatcherRequested( | 659 [maxListeners=1, nodoc] static void onRemoveWatcherRequested( |
635 RemoveWatcherRequestedOptions options, | 660 RemoveWatcherRequestedOptions options, |
636 ProviderSuccessCallback successCallback, | 661 ProviderSuccessCallback successCallback, |
637 ProviderErrorCallback errorCallback); | 662 ProviderErrorCallback errorCallback); |
638 }; | 663 }; |
639 }; | 664 }; |
640 | 665 |
OLD | NEW |