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, |
11 // OK</code> must be used. | 11 // <code>OK</code> must be used. |
12 enum ProviderError { | 12 enum ProviderError { |
13 OK, | 13 OK, |
14 FAILED, | 14 FAILED, |
15 IN_USE, | 15 IN_USE, |
16 EXISTS, | 16 EXISTS, |
17 NOT_FOUND, | 17 NOT_FOUND, |
18 ACCESS_DENIED, | 18 ACCESS_DENIED, |
19 TOO_MANY_OPENED, | 19 TOO_MANY_OPENED, |
20 NO_MEMORY, | 20 NO_MEMORY, |
21 NO_SPACE, | 21 NO_SPACE, |
22 NOT_A_DIRECTORY, | 22 NOT_A_DIRECTORY, |
23 INVALID_OPERATION, | 23 INVALID_OPERATION, |
24 SECURITY, | 24 SECURITY, |
25 ABORT, | 25 ABORT, |
26 NOT_A_FILE, | 26 NOT_A_FILE, |
27 NOT_EMPTY, | 27 NOT_EMPTY, |
28 INVALID_URL, | 28 INVALID_URL, |
29 IO | 29 IO |
30 }; | 30 }; |
31 | 31 |
32 // Mode of opening a file. Used by <code>onOpenFileRequested</code>. | 32 // Mode of opening a file. Used by $(ref:onOpenFileRequested). |
33 enum OpenFileMode { | 33 enum OpenFileMode { |
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 }; |
(...skipping 11 matching lines...) Expand all Loading... |
54 double size; | 54 double size; |
55 | 55 |
56 // The last modified time of this entry. | 56 // The last modified time of this entry. |
57 [instanceOf=Date] object modificationTime; | 57 [instanceOf=Date] object modificationTime; |
58 | 58 |
59 // Mime type for the entry. | 59 // Mime type for the entry. |
60 DOMString? mimeType; | 60 DOMString? mimeType; |
61 | 61 |
62 // Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most | 62 // Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most |
63 // 32 KB in size. Optional, but can be provided only when explicitly | 63 // 32 KB in size. Optional, but can be provided only when explicitly |
64 // requested by the <code>onGetMetadataRequested</code> event. | 64 // requested by the $(ref:onGetMetadataRequested) event. |
65 DOMString? thumbnail; | 65 DOMString? thumbnail; |
66 }; | 66 }; |
67 | 67 |
68 // Represents a watcher. | 68 // Represents a watcher. |
69 dictionary Watcher { | 69 dictionary Watcher { |
70 // The path of the entry being observed. | 70 // The path of the entry being observed. |
71 DOMString entryPath; | 71 DOMString entryPath; |
72 | 72 |
73 // Whether watching should include all child entries recursively. It can be | 73 // Whether watching should include all child entries recursively. It can be |
74 // true for directories only. | 74 // true for directories only. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 OpenedFile[] openedFiles; | 110 OpenedFile[] openedFiles; |
111 | 111 |
112 // Whether the file system supports the <code>tag</code> field for observing | 112 // Whether the file system supports the <code>tag</code> field for observing |
113 // directories. | 113 // directories. |
114 [nodoc] boolean? supportsNotifyTag; | 114 [nodoc] boolean? supportsNotifyTag; |
115 | 115 |
116 // List of watchers. | 116 // List of watchers. |
117 [nodoc] Watcher[] watchers; | 117 [nodoc] Watcher[] watchers; |
118 }; | 118 }; |
119 | 119 |
120 // Options for the <code>mount()</code> method. | 120 // Options for the $(ref:mount) method. |
121 dictionary MountOptions { | 121 dictionary MountOptions { |
122 // The string indentifier of the file system. Must be unique per each | 122 // The string indentifier of the file system. Must be unique per each |
123 // extension. | 123 // extension. |
124 DOMString fileSystemId; | 124 DOMString fileSystemId; |
125 | 125 |
126 // A human-readable name for the file system. | 126 // A human-readable name for the file system. |
127 DOMString displayName; | 127 DOMString displayName; |
128 | 128 |
129 // Whether the file system supports operations which may change contents | 129 // Whether the file system supports operations which may change contents |
130 // of the file system (such as creating, deleting or writing to files). | 130 // of the file system (such as creating, deleting or writing to files). |
131 boolean? writable; | 131 boolean? writable; |
132 | 132 |
133 // The maximum number of files that can be opened at once. If not specified, | 133 // The maximum number of files that can be opened at once. If not specified, |
134 // or 0, then not limited. | 134 // or 0, then not limited. |
135 long? openedFilesLimit; | 135 long? openedFilesLimit; |
136 | 136 |
137 // Whether the file system supports the <code>tag</code> field for observed | 137 // Whether the file system supports the <code>tag</code> field for observed |
138 // directories. Required in order to enable the internal cache. | 138 // directories. Required in order to enable the internal cache. |
139 [nodoc] boolean? supportsNotifyTag; | 139 [nodoc] boolean? supportsNotifyTag; |
140 }; | 140 }; |
141 | 141 |
142 // Options for the <code>unmount()</code> method. | 142 // Options for the $(ref:unmount) method. |
143 dictionary UnmountOptions { | 143 dictionary UnmountOptions { |
144 // The identifier of the file system to be unmounted. | 144 // The identifier of the file system to be unmounted. |
145 DOMString fileSystemId; | 145 DOMString fileSystemId; |
146 }; | 146 }; |
147 | 147 |
148 // Options for the <code>onUnmountRequested()</code> event. | 148 // Options for the $(ref:onUnmountRequested) event. |
149 dictionary UnmountRequestedOptions { | 149 dictionary UnmountRequestedOptions { |
150 // The identifier of the file system to be unmounted. | 150 // The identifier of the file system to be unmounted. |
151 DOMString fileSystemId; | 151 DOMString fileSystemId; |
152 | 152 |
153 // The unique identifier of this request. | 153 // The unique identifier of this request. |
154 long requestId; | 154 long requestId; |
155 }; | 155 }; |
156 | 156 |
157 // Options for the <code>onGetMetadataRequested()</code> event. | 157 // Options for the $(ref:onGetMetadataRequested) event. |
158 dictionary GetMetadataRequestedOptions { | 158 dictionary GetMetadataRequestedOptions { |
159 // The identifier of the file system related to this operation. | 159 // The identifier of the file system related to this operation. |
160 DOMString fileSystemId; | 160 DOMString fileSystemId; |
161 | 161 |
162 // The unique identifier of this request. | 162 // The unique identifier of this request. |
163 long requestId; | 163 long requestId; |
164 | 164 |
165 // The path of the entry to fetch metadata about. | 165 // The path of the entry to fetch metadata about. |
166 DOMString entryPath; | 166 DOMString entryPath; |
167 | 167 |
168 // Set to <code>true</code> if the thumbnail is requested. | 168 // Set to <code>true</code> if the thumbnail is requested. |
169 boolean thumbnail; | 169 boolean thumbnail; |
170 }; | 170 }; |
171 | 171 |
172 // Options for the <code>onReadDirectoryRequested()</code> event. | 172 // Options for the $(ref:onReadDirectoryRequested) event. |
173 dictionary ReadDirectoryRequestedOptions { | 173 dictionary ReadDirectoryRequestedOptions { |
174 // The identifier of the file system related to this operation. | 174 // The identifier of the file system related to this operation. |
175 DOMString fileSystemId; | 175 DOMString fileSystemId; |
176 | 176 |
177 // The unique identifier of this request. | 177 // The unique identifier of this request. |
178 long requestId; | 178 long requestId; |
179 | 179 |
180 // The path of the directory which contents are requested. | 180 // The path of the directory which contents are requested. |
181 DOMString directoryPath; | 181 DOMString directoryPath; |
182 }; | 182 }; |
183 | 183 |
184 // Options for the <code>onOpenFileRequested()</code> event. | 184 // Options for the $(ref:onOpenFileRequested) event. |
185 dictionary OpenFileRequestedOptions { | 185 dictionary OpenFileRequestedOptions { |
186 // The identifier of the file system related to this operation. | 186 // The identifier of the file system related to this operation. |
187 DOMString fileSystemId; | 187 DOMString fileSystemId; |
188 | 188 |
189 // A request ID which will be used by consecutive read/write and close | 189 // A request ID which will be used by consecutive read/write and close |
190 // requests. | 190 // requests. |
191 long requestId; | 191 long requestId; |
192 | 192 |
193 // The path of the file to be opened. | 193 // The path of the file to be opened. |
194 DOMString filePath; | 194 DOMString filePath; |
195 | 195 |
196 // Whether the file will be used for reading or writing. | 196 // Whether the file will be used for reading or writing. |
197 OpenFileMode mode; | 197 OpenFileMode mode; |
198 }; | 198 }; |
199 | 199 |
200 // Options for the <code>onCloseFileRequested()</code> event. | 200 // Options for the $(ref:onCloseFileRequested) event. |
201 dictionary CloseFileRequestedOptions { | 201 dictionary CloseFileRequestedOptions { |
202 // The identifier of the file system related to this operation. | 202 // The identifier of the file system related to this operation. |
203 DOMString fileSystemId; | 203 DOMString fileSystemId; |
204 | 204 |
205 // The unique identifier of this request. | 205 // The unique identifier of this request. |
206 long requestId; | 206 long requestId; |
207 | 207 |
208 // A request ID used to open the file. | 208 // A request ID used to open the file. |
209 long openRequestId; | 209 long openRequestId; |
210 }; | 210 }; |
211 | 211 |
212 // Options for the <code>onReadFileRequested()</code> event. | 212 // Options for the $(ref:onReadFileRequested) event. |
213 dictionary ReadFileRequestedOptions { | 213 dictionary ReadFileRequestedOptions { |
214 // The identifier of the file system related to this operation. | 214 // The identifier of the file system related to this operation. |
215 DOMString fileSystemId; | 215 DOMString fileSystemId; |
216 | 216 |
217 // The unique identifier of this request. | 217 // The unique identifier of this request. |
218 long requestId; | 218 long requestId; |
219 | 219 |
220 // A request ID used to open the file. | 220 // A request ID used to open the file. |
221 long openRequestId; | 221 long openRequestId; |
222 | 222 |
223 // Position in the file (in bytes) to start reading from. | 223 // Position in the file (in bytes) to start reading from. |
224 double offset; | 224 double offset; |
225 | 225 |
226 // Number of bytes to be returned. | 226 // Number of bytes to be returned. |
227 double length; | 227 double length; |
228 }; | 228 }; |
229 | 229 |
230 // Options for the <code>onCreateDirectoryRequested()</code> event. | 230 // Options for the $(ref:onCreateDirectoryRequested) event. |
231 dictionary CreateDirectoryRequestedOptions { | 231 dictionary CreateDirectoryRequestedOptions { |
232 // The identifier of the file system related to this operation. | 232 // The identifier of the file system related to this operation. |
233 DOMString fileSystemId; | 233 DOMString fileSystemId; |
234 | 234 |
235 // The unique identifier of this request. | 235 // The unique identifier of this request. |
236 long requestId; | 236 long requestId; |
237 | 237 |
238 // The path of the directory to be created. | 238 // The path of the directory to be created. |
239 DOMString directoryPath; | 239 DOMString directoryPath; |
240 | 240 |
241 // Whether the operation is recursive (for directories only). | 241 // Whether the operation is recursive (for directories only). |
242 boolean recursive; | 242 boolean recursive; |
243 }; | 243 }; |
244 | 244 |
245 // Options for the <code>onDeleteEntryRequested()</code> event. | 245 // Options for the $(ref:onDeleteEntryRequested) event. |
246 dictionary DeleteEntryRequestedOptions { | 246 dictionary DeleteEntryRequestedOptions { |
247 // The identifier of the file system related to this operation. | 247 // The identifier of the file system related to this operation. |
248 DOMString fileSystemId; | 248 DOMString fileSystemId; |
249 | 249 |
250 // The unique identifier of this request. | 250 // The unique identifier of this request. |
251 long requestId; | 251 long requestId; |
252 | 252 |
253 // The path of the entry to be deleted. | 253 // The path of the entry to be deleted. |
254 DOMString entryPath; | 254 DOMString entryPath; |
255 | 255 |
256 // Whether the operation is recursive (for directories only). | 256 // Whether the operation is recursive (for directories only). |
257 boolean recursive; | 257 boolean recursive; |
258 }; | 258 }; |
259 | 259 |
260 // Options for the <code>onCreateFileRequested()</code> event. | 260 // Options for the $(ref:onCreateFileRequested) event. |
261 dictionary CreateFileRequestedOptions { | 261 dictionary CreateFileRequestedOptions { |
262 // The identifier of the file system related to this operation. | 262 // The identifier of the file system related to this operation. |
263 DOMString fileSystemId; | 263 DOMString fileSystemId; |
264 | 264 |
265 // The unique identifier of this request. | 265 // The unique identifier of this request. |
266 long requestId; | 266 long requestId; |
267 | 267 |
268 // The path of the file to be created. | 268 // The path of the file to be created. |
269 DOMString filePath; | 269 DOMString filePath; |
270 }; | 270 }; |
271 | 271 |
272 // Options for the <code>onCopyEntryRequested()</code> event. | 272 // Options for the $(ref:onCopyEntryRequested) event. |
273 dictionary CopyEntryRequestedOptions { | 273 dictionary CopyEntryRequestedOptions { |
274 // The identifier of the file system related to this operation. | 274 // The identifier of the file system related to this operation. |
275 DOMString fileSystemId; | 275 DOMString fileSystemId; |
276 | 276 |
277 // The unique identifier of this request. | 277 // The unique identifier of this request. |
278 long requestId; | 278 long requestId; |
279 | 279 |
280 // The source path of the entry to be copied. | 280 // The source path of the entry to be copied. |
281 DOMString sourcePath; | 281 DOMString sourcePath; |
282 | 282 |
283 // The destination path for the copy operation. | 283 // The destination path for the copy operation. |
284 DOMString targetPath; | 284 DOMString targetPath; |
285 }; | 285 }; |
286 | 286 |
287 // Options for the <code>onMoveEntryRequested()</code> event. | 287 // Options for the $(ref:onMoveEntryRequested) event. |
288 dictionary MoveEntryRequestedOptions { | 288 dictionary MoveEntryRequestedOptions { |
289 // The identifier of the file system related to this operation. | 289 // The identifier of the file system related to this operation. |
290 DOMString fileSystemId; | 290 DOMString fileSystemId; |
291 | 291 |
292 // The unique identifier of this request. | 292 // The unique identifier of this request. |
293 long requestId; | 293 long requestId; |
294 | 294 |
295 // The source path of the entry to be moved into a new place. | 295 // The source path of the entry to be moved into a new place. |
296 DOMString sourcePath; | 296 DOMString sourcePath; |
297 | 297 |
298 // The destination path for the copy operation. | 298 // The destination path for the copy operation. |
299 DOMString targetPath; | 299 DOMString targetPath; |
300 }; | 300 }; |
301 | 301 |
302 // Options for the <code>onTruncateRequested()</code> event. | 302 // Options for the $(ref:onTruncateRequested) event. |
303 dictionary TruncateRequestedOptions { | 303 dictionary TruncateRequestedOptions { |
304 // The identifier of the file system related to this operation. | 304 // The identifier of the file system related to this operation. |
305 DOMString fileSystemId; | 305 DOMString fileSystemId; |
306 | 306 |
307 // The unique identifier of this request. | 307 // The unique identifier of this request. |
308 long requestId; | 308 long requestId; |
309 | 309 |
310 // The path of the file to be truncated. | 310 // The path of the file to be truncated. |
311 DOMString filePath; | 311 DOMString filePath; |
312 | 312 |
313 // Number of bytes to be retained after the operation completes. | 313 // Number of bytes to be retained after the operation completes. |
314 double length; | 314 double length; |
315 }; | 315 }; |
316 | 316 |
317 // Options for the <code>onWriteFileRequested()</code> event. | 317 // Options for the $(ref:onWriteFileRequested) event. |
318 dictionary WriteFileRequestedOptions { | 318 dictionary WriteFileRequestedOptions { |
319 // The identifier of the file system related to this operation. | 319 // The identifier of the file system related to this operation. |
320 DOMString fileSystemId; | 320 DOMString fileSystemId; |
321 | 321 |
322 // The unique identifier of this request. | 322 // The unique identifier of this request. |
323 long requestId; | 323 long requestId; |
324 | 324 |
325 // A request ID used to open the file. | 325 // A request ID used to open the file. |
326 long openRequestId; | 326 long openRequestId; |
327 | 327 |
328 // Position in the file (in bytes) to start writing the bytes from. | 328 // Position in the file (in bytes) to start writing the bytes from. |
329 double offset; | 329 double offset; |
330 | 330 |
331 // Buffer of bytes to be written to the file. | 331 // Buffer of bytes to be written to the file. |
332 ArrayBuffer data; | 332 ArrayBuffer data; |
333 }; | 333 }; |
334 | 334 |
335 // Options for the <code>onAbortRequested()</code> event. | 335 // Options for the $(ref:onAbortRequested) event. |
336 dictionary AbortRequestedOptions { | 336 dictionary AbortRequestedOptions { |
337 // The identifier of the file system related to this operation. | 337 // The identifier of the file system related to this operation. |
338 DOMString fileSystemId; | 338 DOMString fileSystemId; |
339 | 339 |
340 // The unique identifier of this request. | 340 // The unique identifier of this request. |
341 long requestId; | 341 long requestId; |
342 | 342 |
343 // An ID of the request to be aborted. | 343 // An ID of the request to be aborted. |
344 long operationRequestId; | 344 long operationRequestId; |
345 }; | 345 }; |
346 | 346 |
347 // Options for the <code>onAddWatcherRequested()</code> event. | 347 // Options for the $(ref:onAddWatcherRequested) event. |
348 dictionary AddWatcherRequestedOptions { | 348 dictionary AddWatcherRequestedOptions { |
349 // The identifier of the file system related to this operation. | 349 // The identifier of the file system related to this operation. |
350 DOMString fileSystemId; | 350 DOMString fileSystemId; |
351 | 351 |
352 // The unique identifier of this request. | 352 // The unique identifier of this request. |
353 long requestId; | 353 long requestId; |
354 | 354 |
355 // The path of the entry to be observed. | 355 // The path of the entry to be observed. |
356 DOMString entryPath; | 356 DOMString entryPath; |
357 | 357 |
358 // Whether observing should include all child entries recursively. It can be | 358 // Whether observing should include all child entries recursively. It can be |
359 // true for directories only. | 359 // true for directories only. |
360 boolean recursive; | 360 boolean recursive; |
361 }; | 361 }; |
362 | 362 |
363 // Options for the <code>onRemoveWatcherRequested()</code> event. | 363 // Options for the $(ref:onRemoveWatcherRequested) event. |
364 dictionary RemoveWatcherRequestedOptions { | 364 dictionary RemoveWatcherRequestedOptions { |
365 // The identifier of the file system related to this operation. | 365 // The identifier of the file system related to this operation. |
366 DOMString fileSystemId; | 366 DOMString fileSystemId; |
367 | 367 |
368 // The unique identifier of this request. | 368 // The unique identifier of this request. |
369 long requestId; | 369 long requestId; |
370 | 370 |
371 // The path of the watched entry. | 371 // The path of the watched entry. |
372 DOMString entryPath; | 372 DOMString entryPath; |
373 | 373 |
374 // Mode of the watcher. | 374 // Mode of the watcher. |
375 boolean recursive; | 375 boolean recursive; |
376 }; | 376 }; |
377 | 377 |
378 // Information about a change happened to an entry within the observed | 378 // Information about a change happened to an entry within the observed |
379 // directory (including the entry itself). | 379 // directory (including the entry itself). |
380 dictionary Change { | 380 dictionary Change { |
381 // The path of the changed entry. | 381 // The path of the changed entry. |
382 DOMString entryPath; | 382 DOMString entryPath; |
383 | 383 |
384 // The type of the change which happened to the entry. | 384 // The type of the change which happened to the entry. |
385 ChangeType changeType; | 385 ChangeType changeType; |
386 }; | 386 }; |
387 | 387 |
388 // Options for the <code>Notify()</code> method. | 388 // Options for the $(ref:notify) method. |
389 dictionary NotifyOptions { | 389 dictionary NotifyOptions { |
390 // The identifier of the file system related to this change. | 390 // The identifier of the file system related to this change. |
391 DOMString fileSystemId; | 391 DOMString fileSystemId; |
392 | 392 |
393 // The path of the observed entry. | 393 // The path of the observed entry. |
394 DOMString observedPath; | 394 DOMString observedPath; |
395 | 395 |
396 // Mode of the observed entry. | 396 // Mode of the observed entry. |
397 boolean recursive; | 397 boolean recursive; |
398 | 398 |
399 // The type of the change which happened to the observed entry. If it is | 399 // The type of the change which happened to the observed entry. If it is |
400 // DELETED, then the observed entry will be automatically removed from the | 400 // DELETED, then the observed entry will be automatically removed from the |
401 // list of observed entries. | 401 // list of observed entries. |
402 ChangeType changeType; | 402 ChangeType changeType; |
403 | 403 |
404 // List of changes to entries within the observed directory (including the | 404 // List of changes to entries within the observed directory (including the |
405 // entry itself) | 405 // entry itself) |
406 Change[]? changes; | 406 Change[]? changes; |
407 | 407 |
408 // Tag for the notification. Required if the file system was mounted with | 408 // Tag for the notification. Required if the file system was mounted with |
409 // the <code>supportsNotifyTag</code> option. Note, that this flag is | 409 // the <code>supportsNotifyTag</code> option. Note, that this flag is |
410 // necessary to provide notifications about changes which changed even | 410 // necessary to provide notifications about changes which changed even |
411 // when the system was shutdown. | 411 // when the system was shutdown. |
412 DOMString? tag; | 412 DOMString? tag; |
413 }; | 413 }; |
414 | 414 |
415 // Options for the <code>onConfigureRequested()</code> event. | 415 // Options for the $(ref:onConfigureRequested) event. |
416 [nodoc] dictionary ConfigureRequestedOptions { | 416 dictionary ConfigureRequestedOptions { |
417 // The identifier of the file system to be configured. | 417 // The identifier of the file system to be configured. |
418 DOMString fileSystemId; | 418 DOMString fileSystemId; |
419 | 419 |
420 // The unique identifier of this request. | 420 // The unique identifier of this request. |
421 long requestId; | 421 long requestId; |
422 }; | 422 }; |
423 | 423 |
424 // Callback to receive the result of getAll() function. | 424 // Callback to receive the result of $(ref:getAll) function. |
425 callback GetAllCallback = void(FileSystemInfo[] fileSystems); | 425 callback GetAllCallback = void(FileSystemInfo[] fileSystems); |
426 | 426 |
427 // Callback to receive the result of get() function. | 427 // Callback to receive the result of $(ref:get) function. |
428 callback GetCallback = void(FileSystemInfo fileSystem); | 428 callback GetCallback = void(FileSystemInfo fileSystem); |
429 | 429 |
430 // Callback to be called by the providing extension in case of a success. | 430 // Callback to be called by the providing extension in case of a success. |
431 [nocompile] callback ProviderSuccessCallback = void(); | 431 [nocompile] callback ProviderSuccessCallback = void(); |
432 | 432 |
433 // Callback to be called by the providing extension in case of an error. | 433 // Callback to be called by the providing extension in case of an error. |
434 [nocompile] callback ProviderErrorCallback = void(ProviderError error); | 434 [nocompile] callback ProviderErrorCallback = void(ProviderError error); |
435 | 435 |
436 // Success callback for the <code>onGetMetadataRequested</code> event. | 436 // Success callback for the $(ref:onGetMetadataRequested) event. |
437 [nocompile] callback MetadataCallback = void( | 437 [nocompile] callback MetadataCallback = void( |
438 EntryMetadata metadata); | 438 EntryMetadata metadata); |
439 | 439 |
440 // Success callback for the <code>onReadDirectoryRequested</code> event. If | 440 // Success callback for the $(ref:onReadDirectoryRequested) event. If more |
441 // more entries will be returned, then <code>hasMore</code> must be true, and | 441 // entries will be returned, then <code>hasMore</code> must be true, and it |
442 // it has to be called again with additional entries. If no more entries are | 442 // has to be called again with additional entries. If no more entries are |
443 // available, then <code>hasMore</code> must be set to false. | 443 // available, then <code>hasMore</code> must be set to false. |
444 [nocompile] callback EntriesCallback = void( | 444 [nocompile] callback EntriesCallback = void( |
445 EntryMetadata[] entries, boolean hasMore); | 445 EntryMetadata[] entries, boolean hasMore); |
446 | 446 |
447 // Success callback for the <code>onReadFileRequested</code> event. If more | 447 // Success callback for the $(ref:onReadFileRequested) event. If more |
448 // data will be returned, then <code>hasMore</code> must be true, and it | 448 // data will be returned, then <code>hasMore</code> must be true, and it |
449 // has to be called again with additional entries. If no more data is | 449 // has to be called again with additional entries. If no more data is |
450 // available, then <code>hasMore</code> must be set to false. | 450 // available, then <code>hasMore</code> must be set to false. |
451 [nocompile] callback FileDataCallback = void( | 451 [nocompile] callback FileDataCallback = void( |
452 ArrayBuffer data, boolean hasMore); | 452 ArrayBuffer data, boolean hasMore); |
453 | 453 |
454 // A generic result callback to indicate success or failure. | 454 // A generic result callback to indicate success or failure. |
455 callback ResultCallback = void(); | 455 callback ResultCallback = void(); |
456 | 456 |
457 interface Functions { | 457 interface Functions { |
458 // Mounts a file system with the given <code>fileSystemId</code> and <code> | 458 // Mounts a file system with the given <code>fileSystemId</code> and |
459 // displayName</code>. <code>displayName</code> will be shown in the left | 459 // <code>displayName</code>. <code>displayName</code> will be shown in the |
460 // panel of Files.app. <code>displayName</code> can contain any characters | 460 // left panel of Files.app. <code>displayName</code> can contain any |
461 // including '/', but cannot be an empty string. <code>displayName</code> | 461 // characters including '/', but cannot be an empty string. |
462 // must be descriptive but doesn't have to be unique. The <code>fileSystemId | 462 // <code>displayName</code> must be descriptive but doesn't have to be |
463 // </code> must not be an empty string. | 463 // unique. The <code>fileSystemId</code> must not be an empty string. |
464 // | 464 // |
465 // Depending on the type of the file system being mounted, the <code>source | 465 // Depending on the type of the file system being mounted, the |
466 // </code> option must be set appropriately. | 466 // <code>source</code> option must be set appropriately. |
467 // | 467 // |
468 // In case of an error, <code>chrome.runtime.lastError</code> will be set | 468 // In case of an error, $(ref:runtime.lastError) will be set with a |
469 // will a corresponding error code. | 469 // corresponding error code. |
470 static void mount(MountOptions options, | 470 static void mount(MountOptions options, |
471 optional ResultCallback callback); | 471 optional ResultCallback callback); |
472 | 472 |
473 // Unmounts a file system with the given <code>fileSystemId</code>. It | 473 // Unmounts a file system with the given <code>fileSystemId</code>. It |
474 // must be called after <code>onUnmountRequested</code> is invoked. Also, | 474 // must be called after $(ref:onUnmountRequested) is invoked. Also, |
475 // the providing extension can decide to perform unmounting if not requested | 475 // the providing extension can decide to perform unmounting if not requested |
476 // (eg. in case of lost connection, or a file error). | 476 // (eg. in case of lost connection, or a file error). |
477 // | 477 // |
478 // In case of an error, <code>chrome.runtime.lastError</code> will be set | 478 // In case of an error, $(ref:runtime.lastError) will be set with a |
479 // will a corresponding error code. | 479 // corresponding error code. |
480 static void unmount(UnmountOptions options, | 480 static void unmount(UnmountOptions options, |
481 optional ResultCallback callback); | 481 optional ResultCallback callback); |
482 | 482 |
483 // Returns all file systems mounted by the extension. | 483 // Returns all file systems mounted by the extension. |
484 static void getAll(GetAllCallback callback); | 484 static void getAll(GetAllCallback callback); |
485 | 485 |
486 // Returns information about a file system with the passed <code> | 486 // Returns information about a file system with the passed |
487 // fileSystemId</code>. | 487 // <code>fileSystemId</code>. |
488 static void get(DOMString fileSystemId, GetCallback callback); | 488 static void get(DOMString fileSystemId, GetCallback callback); |
489 | 489 |
490 // Notifies about changes in the watched directory at <code> | 490 // Notifies about changes in the watched directory at |
491 // observedPath</code> in <code>recursive</code mode. If the file system is | 491 // <code>observedPath</code> in <code>recursive</code> mode. If the file |
492 // mounted with <code>supportsNofityTag</code>, then <code>tag</code> must | 492 // system is mounted with <code>supportsNofityTag</code>, then |
493 // be provided, and all changes since the last notification always reported, | 493 // <code>tag</code> must be provided, and all changes since the last |
494 // even if the system was shutdown. The last tag can be obtained with <code> | 494 // notification always reported, even if the system was shutdown. The last |
495 // getAll()</code>. Note, that <code>tag</code> is required in order to | 495 // tag can be obtained with $(ref:getAll). Note, that <code>tag</code> is |
496 // enable the internal cache. | 496 // required in order to enable the internal cache. |
497 // | 497 // |
498 // Value of <code>tag</code> can be any string which is unique per call, | 498 // Value of <code>tag</code> can be any string which is unique per call, |
499 // so it's possible to identify the last registered notification. Eg. if | 499 // so it's possible to identify the last registered notification. Eg. if |
500 // the providing extension starts after a reboot, and the last registered | 500 // the providing extension starts after a reboot, and the last registered |
501 // notification's tag is equal to "123", then it should call notify() for | 501 // notification's tag is equal to "123", then it should call $(ref:notify) |
502 // all changes which happened since the change tagged as "123". It cannot | 502 // for all changes which happened since the change tagged as "123". It |
503 // be an empty string. | 503 // cannot be an empty string. |
504 // | 504 // |
505 // Not all providers are able to provide a tag, but if the file system has | 505 // Not all providers are able to provide a tag, but if the file system has |
506 // a changelog, then the tag can be eg. a change number, or a revision | 506 // a changelog, then the tag can be eg. a change number, or a revision |
507 // number. | 507 // number. |
508 // | 508 // |
509 // Note that if a parent directory is removed, then all descendant entries | 509 // Note that if a parent directory is removed, then all descendant entries |
510 // are also removed, and if they are watched, then the API must be notified | 510 // are also removed, and if they are watched, then the API must be notified |
511 // about the fact. Also, if a directory is renamed, then all descendant | 511 // about the fact. Also, if a directory is renamed, then all descendant |
512 // entries are in fact removed, as there is no entry under their original | 512 // entries are in fact removed, as there is no entry under their original |
513 // paths anymore. | 513 // paths anymore. |
514 // | 514 // |
515 // In case of an error, <code>chrome.runtime.lastError</code> will be set | 515 // In case of an error, $(ref:chrome.runtime.lastError) will be set |
516 // will a corresponding error code. | 516 // will a corresponding error code. |
517 [nodoc] static void notify(NotifyOptions options, | 517 [nodoc] static void notify(NotifyOptions options, |
518 optional ResultCallback callback); | 518 optional ResultCallback callback); |
519 }; | 519 }; |
520 | 520 |
521 interface Events { | 521 interface Events { |
522 // Raised when unmounting for the file system with the <code>fileSystemId | 522 // Raised when unmounting for the file system with the |
523 // </code> identifier is requested. In the response, the <code>unmount | 523 // <code>fileSystemId</code> identifier is requested. In the response, the |
524 // </code> API method must be called together with <code>successCallback | 524 // $(ref:unmount) API method must be called together with |
525 // </code>. If unmounting is not possible (eg. due to a pending operation), | 525 // <code>successCallback</code>. If unmounting is not possible (eg. due to |
526 // then <code>errorCallback</code> must be called. | 526 // a pending operation), then <code>errorCallback</code> must be called. |
527 [maxListeners=1] static void onUnmountRequested( | 527 [maxListeners=1] static void onUnmountRequested( |
528 UnmountRequestedOptions options, | 528 UnmountRequestedOptions options, |
529 ProviderSuccessCallback successCallback, | 529 ProviderSuccessCallback successCallback, |
530 ProviderErrorCallback errorCallback); | 530 ProviderErrorCallback errorCallback); |
531 | 531 |
532 // Raised when metadata of a file or a directory at <code>entryPath</code> | 532 // Raised when metadata of a file or a directory at <code>entryPath</code> |
533 // is requested. The metadata must be returned with the <code> | 533 // is requested. The metadata must be returned with the |
534 // successCallback</code> call. In case of an error, <code>errorCallback | 534 // <code>successCallback</code> call. In case of an error, |
535 // </code> must be called. | 535 // <code>errorCallback</code> must be called. |
536 [maxListeners=1] static void onGetMetadataRequested( | 536 [maxListeners=1] static void onGetMetadataRequested( |
537 GetMetadataRequestedOptions options, | 537 GetMetadataRequestedOptions options, |
538 MetadataCallback successCallback, | 538 MetadataCallback successCallback, |
539 ProviderErrorCallback errorCallback); | 539 ProviderErrorCallback errorCallback); |
540 | 540 |
541 // Raised when contents of a directory at <code>directoryPath</code> are | 541 // Raised when contents of a directory at <code>directoryPath</code> are |
542 // requested. The results must be returned in chunks by calling the <code> | 542 // requested. The results must be returned in chunks by calling the |
543 // successCallback</code> several times. In case of an error, <code> | 543 // <code>successCallback</code> several times. In case of an error, |
544 // errorCallback</code> must be called. | 544 // <code>errorCallback</code> must be called. |
545 [maxListeners=1] static void onReadDirectoryRequested( | 545 [maxListeners=1] static void onReadDirectoryRequested( |
546 ReadDirectoryRequestedOptions options, | 546 ReadDirectoryRequestedOptions options, |
547 EntriesCallback successCallback, | 547 EntriesCallback successCallback, |
548 ProviderErrorCallback errorCallback); | 548 ProviderErrorCallback errorCallback); |
549 | 549 |
550 // Raised when opening a file at <code>filePath</code> is requested. If the | 550 // Raised when opening a file at <code>filePath</code> is requested. If the |
551 // file does not exist, then the operation must fail. Maximum number of | 551 // file does not exist, then the operation must fail. Maximum number of |
552 // files opened at once can be specified with <code>MountOptions</code>. | 552 // files opened at once can be specified with <code>MountOptions</code>. |
553 [maxListeners=1] static void onOpenFileRequested( | 553 [maxListeners=1] static void onOpenFileRequested( |
554 OpenFileRequestedOptions options, | 554 OpenFileRequestedOptions options, |
555 ProviderSuccessCallback successCallback, | 555 ProviderSuccessCallback successCallback, |
556 ProviderErrorCallback errorCallback); | 556 ProviderErrorCallback errorCallback); |
557 | 557 |
558 // Raised when opening a file previously opened with <code>openRequestId | 558 // Raised when opening a file previously opened with |
559 // </code> is requested to be closed. | 559 // <code>openRequestId</code> is requested to be closed. |
560 [maxListeners=1] static void onCloseFileRequested( | 560 [maxListeners=1] static void onCloseFileRequested( |
561 CloseFileRequestedOptions options, | 561 CloseFileRequestedOptions options, |
562 ProviderSuccessCallback successCallback, | 562 ProviderSuccessCallback successCallback, |
563 ProviderErrorCallback errorCallback); | 563 ProviderErrorCallback errorCallback); |
564 | 564 |
565 // Raised when reading contents of a file opened previously with <code> | 565 // Raised when reading contents of a file opened previously with |
566 // openRequestId</code> is requested. The results must be returned in | 566 // <code>openRequestId</code> is requested. The results must be returned in |
567 // chunks by calling <code>successCallback</code> several times. In case of | 567 // chunks by calling <code>successCallback</code> several times. In case of |
568 // an error, <code>errorCallback</code> must be called. | 568 // an error, <code>errorCallback</code> must be called. |
569 [maxListeners=1] static void onReadFileRequested( | 569 [maxListeners=1] static void onReadFileRequested( |
570 ReadFileRequestedOptions options, | 570 ReadFileRequestedOptions options, |
571 FileDataCallback successCallback, | 571 FileDataCallback successCallback, |
572 ProviderErrorCallback errorCallback); | 572 ProviderErrorCallback errorCallback); |
573 | 573 |
574 // Raised when creating a directory is requested. The operation must fail | 574 // Raised when creating a directory is requested. The operation must fail |
575 // with the EXISTS error if the target directory already exists. | 575 // with the EXISTS error if the target directory already exists. |
576 // If <code>recursive</code> is true, then all of the missing directories | 576 // If <code>recursive</code> is true, then all of the missing directories |
577 // on the directory path must be created. | 577 // on the directory path must be created. |
578 [maxListeners=1] static void onCreateDirectoryRequested( | 578 [maxListeners=1] static void onCreateDirectoryRequested( |
579 CreateDirectoryRequestedOptions options, | 579 CreateDirectoryRequestedOptions options, |
580 ProviderSuccessCallback successCallback, | 580 ProviderSuccessCallback successCallback, |
581 ProviderErrorCallback errorCallback); | 581 ProviderErrorCallback errorCallback); |
582 | 582 |
583 // Raised when deleting an entry is requested. If <code>recursive</code> is | 583 // Raised when deleting an entry is requested. If <code>recursive</code> is |
584 // true, and the entry is a directory, then all of the entries inside | 584 // true, and the entry is a directory, then all of the entries inside |
585 // must be recursively deleted as well. | 585 // must be recursively deleted as well. |
586 [maxListeners=1] static void onDeleteEntryRequested( | 586 [maxListeners=1] static void onDeleteEntryRequested( |
587 DeleteEntryRequestedOptions options, | 587 DeleteEntryRequestedOptions options, |
588 ProviderSuccessCallback successCallback, | 588 ProviderSuccessCallback successCallback, |
589 ProviderErrorCallback errorCallback); | 589 ProviderErrorCallback errorCallback); |
590 | 590 |
591 // Raised when creating a file is requested. If the file already exists, | 591 // Raised when creating a file is requested. If the file already exists, |
592 // then <code>errorCallback</code> must be called with the <code>EXISTS | 592 // then <code>errorCallback</code> must be called with the |
593 // </code> error code. | 593 // <code>"EXISTS"</code> error code. |
594 [maxListeners=1] static void onCreateFileRequested( | 594 [maxListeners=1] static void onCreateFileRequested( |
595 CreateFileRequestedOptions options, | 595 CreateFileRequestedOptions options, |
596 ProviderSuccessCallback successCallback, | 596 ProviderSuccessCallback successCallback, |
597 ProviderErrorCallback errorCallback); | 597 ProviderErrorCallback errorCallback); |
598 | 598 |
599 // Raised when copying an entry (recursively if a directory) is requested. | 599 // Raised when copying an entry (recursively if a directory) is requested. |
600 // If an error occurs, then <code>errorCallback</code> must be called. | 600 // If an error occurs, then <code>errorCallback</code> must be called. |
601 [maxListeners=1] static void onCopyEntryRequested( | 601 [maxListeners=1] static void onCopyEntryRequested( |
602 CopyEntryRequestedOptions options, | 602 CopyEntryRequestedOptions options, |
603 ProviderSuccessCallback successCallback, | 603 ProviderSuccessCallback successCallback, |
604 ProviderErrorCallback errorCallback); | 604 ProviderErrorCallback errorCallback); |
605 | 605 |
606 // Raised when moving an entry (recursively if a directory) is requested. | 606 // Raised when moving an entry (recursively if a directory) is requested. |
607 // If an error occurs, then <code>errorCallback</code> must be called. | 607 // If an error occurs, then <code>errorCallback</code> must be called. |
608 [maxListeners=1] static void onMoveEntryRequested( | 608 [maxListeners=1] static void onMoveEntryRequested( |
609 MoveEntryRequestedOptions options, | 609 MoveEntryRequestedOptions options, |
610 ProviderSuccessCallback successCallback, | 610 ProviderSuccessCallback successCallback, |
611 ProviderErrorCallback errorCallback); | 611 ProviderErrorCallback errorCallback); |
612 | 612 |
613 // Raised when truncating a file to a desired length is requested. | 613 // Raised when truncating a file to a desired length is requested. |
614 // If an error occurs, then <code>errorCallback</code> must be called. | 614 // If an error occurs, then <code>errorCallback</code> must be called. |
615 [maxListeners=1] static void onTruncateRequested( | 615 [maxListeners=1] static void onTruncateRequested( |
616 TruncateRequestedOptions options, | 616 TruncateRequestedOptions options, |
617 ProviderSuccessCallback successCallback, | 617 ProviderSuccessCallback successCallback, |
618 ProviderErrorCallback errorCallback); | 618 ProviderErrorCallback errorCallback); |
619 | 619 |
620 // Raised when writing contents to a file opened previously with <code> | 620 // Raised when writing contents to a file opened previously with |
621 // openRequestId</code> is requested. | 621 // <code>openRequestId</code> is requested. |
622 [maxListeners=1] static void onWriteFileRequested( | 622 [maxListeners=1] static void onWriteFileRequested( |
623 WriteFileRequestedOptions options, | 623 WriteFileRequestedOptions options, |
624 ProviderSuccessCallback successCallback, | 624 ProviderSuccessCallback successCallback, |
625 ProviderErrorCallback errorCallback); | 625 ProviderErrorCallback errorCallback); |
626 | 626 |
627 // Raised when aborting an operation with <code>operationRequestId</code> | 627 // Raised when aborting an operation with <code>operationRequestId</code> |
628 // is requested. The operation executed with <code>operationRequestId</code> | 628 // is requested. The operation executed with <code>operationRequestId</code> |
629 // must be immediately stopped and <code>successCallback</code> of this | 629 // must be immediately stopped and <code>successCallback</code> of this |
630 // abort request executed. If aborting fails, then <code>errorCallback | 630 // abort request executed. If aborting fails, then |
631 // </code> must be called. Note, that callbacks of the aborted operation | 631 // <code>errorCallback</code> must be called. Note, that callbacks of the |
632 // must not be called, as they will be ignored. Despite calling <code> | 632 // aborted operation must not be called, as they will be ignored. Despite |
633 // errorCallback</code>, the request may be forcibly aborted. | 633 // calling <code>errorCallback</code>, the request may be forcibly aborted. |
634 [maxListeners=1] static void onAbortRequested( | 634 [maxListeners=1] static void onAbortRequested( |
635 AbortRequestedOptions options, | 635 AbortRequestedOptions options, |
636 ProviderSuccessCallback successCallback, | 636 ProviderSuccessCallback successCallback, |
637 ProviderErrorCallback errorCallback); | 637 ProviderErrorCallback errorCallback); |
638 | 638 |
639 // Raised when showing a configuration dialog for <code>fileSystemId</code> | 639 // Raised when showing a configuration dialog for <code>fileSystemId</code> |
640 // is requested. If it's not supported, then this event must not be handled. | 640 // is requested. If it's handled, the |
641 [maxListeners=1, nodoc] static void onConfigureRequested( | 641 // <code>file_system_provider.configurable</code> manfiest option must be |
| 642 // set to true. |
| 643 [maxListeners=1] static void onConfigureRequested( |
642 ConfigureRequestedOptions options, | 644 ConfigureRequestedOptions options, |
643 ProviderSuccessCallback successCallback, | 645 ProviderSuccessCallback successCallback, |
644 ProviderErrorCallback errorCallback); | 646 ProviderErrorCallback errorCallback); |
645 | 647 |
646 // Raised when showing a dialog for mounting a new file system is requested. | 648 // Raised when showing a dialog for mounting a new file system is requested. |
647 // If the extension/app is a file handler, then this event shouldn't be | 649 // If the extension/app is a file handler, then this event shouldn't be |
648 // handled. Instead <code>onLaunched</code> should be handled in order to | 650 // handled. Instead <code>app.runtime.onLaunched</code> should be handled in |
649 // mount new file systems when a file is opened. | 651 // order to mount new file systems when a file is opened. For multiple |
650 [maxListeners=1, nodoc] static void onMountRequested( | 652 // mounts, the <code>file_system_provider.multiple_mounts</code> manifest |
| 653 // option must be set to true. |
| 654 [maxListeners=1] static void onMountRequested( |
651 ProviderSuccessCallback successCallback, | 655 ProviderSuccessCallback successCallback, |
652 ProviderErrorCallback errorCallback); | 656 ProviderErrorCallback errorCallback); |
653 | 657 |
654 // Raised when setting a new directory watcher is requested. If an error | 658 // Raised when setting a new directory watcher is requested. If an error |
655 // occurs, then <code>errorCallback</code> must be called. | 659 // occurs, then <code>errorCallback</code> must be called. |
656 [maxListeners=1, nodoc] static void onAddWatcherRequested( | 660 [maxListeners=1, nodoc] static void onAddWatcherRequested( |
657 AddWatcherRequestedOptions options, | 661 AddWatcherRequestedOptions options, |
658 ProviderSuccessCallback successCallback, | 662 ProviderSuccessCallback successCallback, |
659 ProviderErrorCallback errorCallback); | 663 ProviderErrorCallback errorCallback); |
660 | 664 |
661 // Raised when the watcher should be removed. If an error occurs, then | 665 // Raised when the watcher should be removed. If an error occurs, then |
662 // <code>errorCallback</code> must be called. | 666 // <code>errorCallback</code> must be called. |
663 [maxListeners=1, nodoc] static void onRemoveWatcherRequested( | 667 [maxListeners=1, nodoc] static void onRemoveWatcherRequested( |
664 RemoveWatcherRequestedOptions options, | 668 RemoveWatcherRequestedOptions options, |
665 ProviderSuccessCallback successCallback, | 669 ProviderSuccessCallback successCallback, |
666 ProviderErrorCallback errorCallback); | 670 ProviderErrorCallback errorCallback); |
667 }; | 671 }; |
668 }; | 672 }; |
669 | 673 |
OLD | NEW |