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, | 10 // as in case of errors when calling methods of the API. For success, |
11 // <code>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, |
(...skipping 12 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 // List of common actions. <code>"SHARE"</code> is for sharing files with | |
45 // others. <code>"SAVE_FOR_OFFLINE"</code> for pinning (saving for offline | |
46 // access). <code>"OFFLINE_NOT_NECESSARY"</code> for notifying that the file | |
47 // doesn't need to be stored for offline access anymore. | |
48 // Used by $(ref:onGetActionsRequested) and $(ref:onExecuteActionRequested). | |
49 enum CommonActionId { | |
50 SAVE_FOR_OFFLINE, | |
51 OFFLINE_NOT_NECESSARY, | |
52 SHARE | |
53 }; | |
54 | |
44 // Represents metadata of a file or a directory. | 55 // Represents metadata of a file or a directory. |
45 dictionary EntryMetadata { | 56 dictionary EntryMetadata { |
46 // True if it is a directory. | 57 // True if it is a directory. |
47 boolean isDirectory; | 58 boolean isDirectory; |
48 | 59 |
49 // Name of this entry (not full path name). Must not contain '/'. For root | 60 // Name of this entry (not full path name). Must not contain '/'. For root |
50 // it must be empty. | 61 // it must be empty. |
51 DOMString name; | 62 DOMString name; |
52 | 63 |
53 // File size in bytes. | 64 // File size in bytes. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 // The unique identifier of this request. | 173 // The unique identifier of this request. |
163 long requestId; | 174 long requestId; |
164 | 175 |
165 // The path of the entry to fetch metadata about. | 176 // The path of the entry to fetch metadata about. |
166 DOMString entryPath; | 177 DOMString entryPath; |
167 | 178 |
168 // Set to <code>true</code> if the thumbnail is requested. | 179 // Set to <code>true</code> if the thumbnail is requested. |
169 boolean thumbnail; | 180 boolean thumbnail; |
170 }; | 181 }; |
171 | 182 |
183 // Options for the $(ref:onGetActionsRequested) event. | |
184 dictionary GetActionsRequestedOptions { | |
185 // The identifier of the file system related to this operation. | |
186 DOMString fileSystemId; | |
187 | |
188 // The unique identifier of this request. | |
189 long requestId; | |
benwells
2015/06/23 06:29:38
Why is there a requestId?
mtomasz
2015/06/23 06:34:25
All FSP requests (file system related events wired
benwells
2015/06/23 06:51:06
ok makes sense.
| |
190 | |
191 // The path of the entry to return the list of actions for. | |
192 DOMString entryPath; | |
193 }; | |
194 | |
172 // Options for the $(ref:onReadDirectoryRequested) event. | 195 // Options for the $(ref:onReadDirectoryRequested) event. |
173 dictionary ReadDirectoryRequestedOptions { | 196 dictionary ReadDirectoryRequestedOptions { |
174 // The identifier of the file system related to this operation. | 197 // The identifier of the file system related to this operation. |
175 DOMString fileSystemId; | 198 DOMString fileSystemId; |
176 | 199 |
177 // The unique identifier of this request. | 200 // The unique identifier of this request. |
178 long requestId; | 201 long requestId; |
179 | 202 |
180 // The path of the directory which contents are requested. | 203 // The path of the directory which contents are requested. |
181 DOMString directoryPath; | 204 DOMString directoryPath; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 // The unique identifier of this request. | 391 // The unique identifier of this request. |
369 long requestId; | 392 long requestId; |
370 | 393 |
371 // The path of the watched entry. | 394 // The path of the watched entry. |
372 DOMString entryPath; | 395 DOMString entryPath; |
373 | 396 |
374 // Mode of the watcher. | 397 // Mode of the watcher. |
375 boolean recursive; | 398 boolean recursive; |
376 }; | 399 }; |
377 | 400 |
401 // Information about an action for an entry. | |
402 dictionary Action { | |
403 // The identifier of the action. Any string or $(ref:CommonActionId) for | |
404 // common actions. | |
405 DOMString id; | |
406 | |
407 // The title of the action. It may be ignored for common actions. | |
408 DOMString? title; | |
409 }; | |
410 | |
411 // Options for the $(ref:onExecuteActionRequested) event. | |
412 dictionary ExecuteActionRequestedOptions { | |
413 // The identifier of the file system related to this operation. | |
414 DOMString fileSystemId; | |
415 | |
416 // The unique identifier of this request. | |
417 long requestId; | |
418 | |
419 // The path of the entry to be used for the action. | |
420 DOMString entryPath; | |
421 | |
422 // The identifier of the action to be executed. | |
423 DOMString actionId; | |
424 }; | |
425 | |
378 // Information about a change happened to an entry within the observed | 426 // Information about a change happened to an entry within the observed |
379 // directory (including the entry itself). | 427 // directory (including the entry itself). |
380 dictionary Change { | 428 dictionary Change { |
381 // The path of the changed entry. | 429 // The path of the changed entry. |
382 DOMString entryPath; | 430 DOMString entryPath; |
383 | 431 |
384 // The type of the change which happened to the entry. | 432 // The type of the change which happened to the entry. |
385 ChangeType changeType; | 433 ChangeType changeType; |
386 }; | 434 }; |
387 | 435 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 // Callback to receive the result of $(ref:get) function. | 475 // Callback to receive the result of $(ref:get) function. |
428 callback GetCallback = void(FileSystemInfo fileSystem); | 476 callback GetCallback = void(FileSystemInfo fileSystem); |
429 | 477 |
430 // Callback to be called by the providing extension in case of a success. | 478 // Callback to be called by the providing extension in case of a success. |
431 [nocompile] callback ProviderSuccessCallback = void(); | 479 [nocompile] callback ProviderSuccessCallback = void(); |
432 | 480 |
433 // Callback to be called by the providing extension in case of an error. | 481 // Callback to be called by the providing extension in case of an error. |
434 [nocompile] callback ProviderErrorCallback = void(ProviderError error); | 482 [nocompile] callback ProviderErrorCallback = void(ProviderError error); |
435 | 483 |
436 // Success callback for the $(ref:onGetMetadataRequested) event. | 484 // Success callback for the $(ref:onGetMetadataRequested) event. |
437 [nocompile] callback MetadataCallback = void( | 485 [nocompile] callback MetadataCallback = void(EntryMetadata metadata); |
438 EntryMetadata metadata); | 486 |
487 // Success callback for the $(ref:onGetActionsRequested) event. | |
488 [nocompile, nodoc] callback ActionsCallback = void(Action[] actions); | |
439 | 489 |
440 // Success callback for the $(ref:onReadDirectoryRequested) event. If more | 490 // Success callback for the $(ref:onReadDirectoryRequested) event. If more |
441 // entries will be returned, then <code>hasMore</code> must be true, and it | 491 // entries will be returned, then <code>hasMore</code> must be true, and it |
442 // has to be called again with additional entries. If no more entries are | 492 // has to be called again with additional entries. If no more entries are |
443 // available, then <code>hasMore</code> must be set to false. | 493 // available, then <code>hasMore</code> must be set to false. |
444 [nocompile] callback EntriesCallback = void( | 494 [nocompile] callback EntriesCallback = void( |
445 EntryMetadata[] entries, boolean hasMore); | 495 EntryMetadata[] entries, boolean hasMore); |
446 | 496 |
447 // Success callback for the $(ref:onReadFileRequested) event. If more | 497 // Success callback for the $(ref:onReadFileRequested) event. If more |
448 // data will be returned, then <code>hasMore</code> must be true, and it | 498 // data will be returned, then <code>hasMore</code> must be true, and it |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 | 580 |
531 // Raised when metadata of a file or a directory at <code>entryPath</code> | 581 // Raised when metadata of a file or a directory at <code>entryPath</code> |
532 // is requested. The metadata must be returned with the | 582 // is requested. The metadata must be returned with the |
533 // <code>successCallback</code> call. In case of an error, | 583 // <code>successCallback</code> call. In case of an error, |
534 // <code>errorCallback</code> must be called. | 584 // <code>errorCallback</code> must be called. |
535 [maxListeners=1] static void onGetMetadataRequested( | 585 [maxListeners=1] static void onGetMetadataRequested( |
536 GetMetadataRequestedOptions options, | 586 GetMetadataRequestedOptions options, |
537 MetadataCallback successCallback, | 587 MetadataCallback successCallback, |
538 ProviderErrorCallback errorCallback); | 588 ProviderErrorCallback errorCallback); |
539 | 589 |
590 // Raised when list of actions for of a file or a directory at | |
591 // <code>entryPath</code>s requested. The actions must be returned with the | |
592 // <code>successCallback</code> call. In case of an error, | |
593 // <code>errorCallback</code> must be called. | |
594 [maxListeners=1, nodoc] static void onGetActionsRequested( | |
595 GetActionsRequestedOptions options, | |
596 ActionsCallback successCallback, | |
597 ProviderErrorCallback errorCallback); | |
598 | |
540 // Raised when contents of a directory at <code>directoryPath</code> are | 599 // Raised when contents of a directory at <code>directoryPath</code> are |
541 // requested. The results must be returned in chunks by calling the | 600 // requested. The results must be returned in chunks by calling the |
542 // <code>successCallback</code> several times. In case of an error, | 601 // <code>successCallback</code> several times. In case of an error, |
543 // <code>errorCallback</code> must be called. | 602 // <code>errorCallback</code> must be called. |
544 [maxListeners=1] static void onReadDirectoryRequested( | 603 [maxListeners=1] static void onReadDirectoryRequested( |
545 ReadDirectoryRequestedOptions options, | 604 ReadDirectoryRequestedOptions options, |
546 EntriesCallback successCallback, | 605 EntriesCallback successCallback, |
547 ProviderErrorCallback errorCallback); | 606 ProviderErrorCallback errorCallback); |
548 | 607 |
549 // Raised when opening a file at <code>filePath</code> is requested. If the | 608 // Raised when opening a file at <code>filePath</code> is requested. If the |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 AddWatcherRequestedOptions options, | 719 AddWatcherRequestedOptions options, |
661 ProviderSuccessCallback successCallback, | 720 ProviderSuccessCallback successCallback, |
662 ProviderErrorCallback errorCallback); | 721 ProviderErrorCallback errorCallback); |
663 | 722 |
664 // Raised when the watcher should be removed. If an error occurs, then | 723 // Raised when the watcher should be removed. If an error occurs, then |
665 // <code>errorCallback</code> must be called. | 724 // <code>errorCallback</code> must be called. |
666 [maxListeners=1] static void onRemoveWatcherRequested( | 725 [maxListeners=1] static void onRemoveWatcherRequested( |
667 RemoveWatcherRequestedOptions options, | 726 RemoveWatcherRequestedOptions options, |
668 ProviderSuccessCallback successCallback, | 727 ProviderSuccessCallback successCallback, |
669 ProviderErrorCallback errorCallback); | 728 ProviderErrorCallback errorCallback); |
729 | |
730 // Raised when executing an action for a file or a directory is requested. | |
731 // After the action is completed, <code>successCallback</code> must be | |
732 // called. On error, <code>errorCallback</code> must be called. | |
733 [maxListeners=1, nodoc] static void onExecuteActionRequested( | |
734 ExecuteActionRequestedOptions options, | |
735 ProviderSuccessCallback successCallback, | |
736 ProviderErrorCallback errorCallback); | |
670 }; | 737 }; |
671 }; | 738 }; |
672 | 739 |
OLD | NEW |