Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/common/extensions/api/file_system_provider.idl

Issue 1151763007: Add the boilerplate for actions to File System Provider API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased + fixed a comment. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // Type of an action. <code>"SHARE"</code> is for sharing files with others,
45 // <code>"PIN_TOGGLE"</code> for pinning (saving for offline access) and
not at google - send to devlin 2015/05/27 23:37:58 could you call it like SAVE_OFFLINE then? "pin" se
benwells 2015/05/28 00:17:36 Yep it also feels like it should be two actions as
mtomasz 2015/05/28 04:12:15 Good idea. How to name opposite? UNSAVE_OFFLINE? H
mtomasz 2015/06/23 02:05:36 Done.
46 // unpinning. <code>"CUSTOM"</code> is used for any other custom action.
47 // Used by $(ref:onGetActionsRequested) and $(ref:onExecuteActionRequested).
48 enum ActionType {
49 SHARE,
50 PIN_TOGGLE,
51 CUSTOM
52 };
53
44 // Represents metadata of a file or a directory. 54 // Represents metadata of a file or a directory.
45 dictionary EntryMetadata { 55 dictionary EntryMetadata {
46 // True if it is a directory. 56 // True if it is a directory.
47 boolean isDirectory; 57 boolean isDirectory;
48 58
49 // Name of this entry (not full path name). Must not contain '/'. For root 59 // Name of this entry (not full path name). Must not contain '/'. For root
50 // it must be empty. 60 // it must be empty.
51 DOMString name; 61 DOMString name;
52 62
53 // File size in bytes. 63 // File size in bytes.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // The unique identifier of this request. 172 // The unique identifier of this request.
163 long requestId; 173 long requestId;
164 174
165 // The path of the entry to fetch metadata about. 175 // The path of the entry to fetch metadata about.
166 DOMString entryPath; 176 DOMString entryPath;
167 177
168 // Set to <code>true</code> if the thumbnail is requested. 178 // Set to <code>true</code> if the thumbnail is requested.
169 boolean thumbnail; 179 boolean thumbnail;
170 }; 180 };
171 181
182 // Options for the $(ref:onGetActionsRequested) event.
183 dictionary GetActionsRequestedOptions {
184 // The identifier of the file system related to this operation.
185 DOMString fileSystemId;
186
187 // The unique identifier of this request.
188 long requestId;
189
190 // The path of the entry to return the list of actions for.
191 DOMString entryPath;
192 };
193
172 // Options for the $(ref:onReadDirectoryRequested) event. 194 // Options for the $(ref:onReadDirectoryRequested) event.
173 dictionary ReadDirectoryRequestedOptions { 195 dictionary ReadDirectoryRequestedOptions {
174 // The identifier of the file system related to this operation. 196 // The identifier of the file system related to this operation.
175 DOMString fileSystemId; 197 DOMString fileSystemId;
176 198
177 // The unique identifier of this request. 199 // The unique identifier of this request.
178 long requestId; 200 long requestId;
179 201
180 // The path of the directory which contents are requested. 202 // The path of the directory which contents are requested.
181 DOMString directoryPath; 203 DOMString directoryPath;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // The unique identifier of this request. 390 // The unique identifier of this request.
369 long requestId; 391 long requestId;
370 392
371 // The path of the watched entry. 393 // The path of the watched entry.
372 DOMString entryPath; 394 DOMString entryPath;
373 395
374 // Mode of the watcher. 396 // Mode of the watcher.
375 boolean recursive; 397 boolean recursive;
376 }; 398 };
377 399
400 // Information about an action for an entry.
401 dictionary Action {
402 // The identifier of the action.
403 DOMString id;
404
405 // The type of the action. Files app uses the <code>type</code> to render
406 // the action accordingly. For <code>"CUSTOM"</code> action type, the
407 // actions are rendered in the context menu. For other types, they may be
408 // rendered in a way consistent with other file types, eg. as a button in
409 // the Files app's header.
410 ActionType type;
benwells 2015/05/28 00:17:36 Why have a type and an ID? Can we just have an ID
mtomasz 2015/05/28 04:12:15 I'm fine to combine. How about: enum CommonAction
not at google - send to devlin 2015/05/28 16:02:39 That's precisely what we support, and it was even
mtomasz 2015/06/23 02:05:36 Sadly unions do not work when both strings and enu
411
412 // The title of the action. Used only for the <code>"CUSTOM"</code> action
413 // type. For other types, the title is ignored.
414 DOMString? title;
415 };
416
417 // Options for the $(ref:onExecuteActionRequested) event.
418 dictionary ExecuteActionRequestedOptions {
419 // The identifier of the file system related to this operation.
420 DOMString fileSystemId;
421
422 // The unique identifier of this request.
423 long requestId;
424
425 // The path of the entry to be used for the action.
426 DOMString entryPath;
427
428 // The identifier of the action to be executed.
429 DOMString actionId;
430 };
431
378 // Information about a change happened to an entry within the observed 432 // Information about a change happened to an entry within the observed
379 // directory (including the entry itself). 433 // directory (including the entry itself).
380 dictionary Change { 434 dictionary Change {
381 // The path of the changed entry. 435 // The path of the changed entry.
382 DOMString entryPath; 436 DOMString entryPath;
383 437
384 // The type of the change which happened to the entry. 438 // The type of the change which happened to the entry.
385 ChangeType changeType; 439 ChangeType changeType;
386 }; 440 };
387 441
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // Callback to receive the result of $(ref:get) function. 481 // Callback to receive the result of $(ref:get) function.
428 callback GetCallback = void(FileSystemInfo fileSystem); 482 callback GetCallback = void(FileSystemInfo fileSystem);
429 483
430 // Callback to be called by the providing extension in case of a success. 484 // Callback to be called by the providing extension in case of a success.
431 [nocompile] callback ProviderSuccessCallback = void(); 485 [nocompile] callback ProviderSuccessCallback = void();
432 486
433 // Callback to be called by the providing extension in case of an error. 487 // Callback to be called by the providing extension in case of an error.
434 [nocompile] callback ProviderErrorCallback = void(ProviderError error); 488 [nocompile] callback ProviderErrorCallback = void(ProviderError error);
435 489
436 // Success callback for the $(ref:onGetMetadataRequested) event. 490 // Success callback for the $(ref:onGetMetadataRequested) event.
437 [nocompile] callback MetadataCallback = void( 491 [nocompile] callback MetadataCallback = void(EntryMetadata metadata);
438 EntryMetadata metadata); 492
493 // Success callback for the $(ref:onGetActionsRequested) event.
494 [nocompile, nodoc] callback ActionsCallback = void(Action[] actions);
439 495
440 // Success callback for the $(ref:onReadDirectoryRequested) event. If more 496 // Success callback for the $(ref:onReadDirectoryRequested) event. If more
441 // entries will be returned, then <code>hasMore</code> must be true, and it 497 // 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 498 // has to be called again with additional entries. If no more entries are
443 // available, then <code>hasMore</code> must be set to false. 499 // available, then <code>hasMore</code> must be set to false.
444 [nocompile] callback EntriesCallback = void( 500 [nocompile] callback EntriesCallback = void(
445 EntryMetadata[] entries, boolean hasMore); 501 EntryMetadata[] entries, boolean hasMore);
446 502
447 // Success callback for the $(ref:onReadFileRequested) event. If more 503 // Success callback for the $(ref:onReadFileRequested) event. If more
448 // data will be returned, then <code>hasMore</code> must be true, and it 504 // data will be returned, then <code>hasMore</code> must be true, and it
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 587
532 // Raised when metadata of a file or a directory at <code>entryPath</code> 588 // Raised when metadata of a file or a directory at <code>entryPath</code>
533 // is requested. The metadata must be returned with the 589 // is requested. The metadata must be returned with the
534 // <code>successCallback</code> call. In case of an error, 590 // <code>successCallback</code> call. In case of an error,
535 // <code>errorCallback</code> must be called. 591 // <code>errorCallback</code> must be called.
536 [maxListeners=1] static void onGetMetadataRequested( 592 [maxListeners=1] static void onGetMetadataRequested(
537 GetMetadataRequestedOptions options, 593 GetMetadataRequestedOptions options,
538 MetadataCallback successCallback, 594 MetadataCallback successCallback,
539 ProviderErrorCallback errorCallback); 595 ProviderErrorCallback errorCallback);
540 596
597 // Raised when list of actions for of a file or a directory at
598 // <code>entryPath</code>s requested. The actions must be returned with the
599 // <code>successCallback</code> call. In case of an error,
600 // <code>errorCallback</code> must be called.
601 [maxListeners=1, nodoc] static void onGetActionsRequested(
602 GetActionsRequestedOptions options,
603 ActionsCallback successCallback,
604 ProviderErrorCallback errorCallback);
605
541 // Raised when contents of a directory at <code>directoryPath</code> are 606 // Raised when contents of a directory at <code>directoryPath</code> are
542 // requested. The results must be returned in chunks by calling the 607 // requested. The results must be returned in chunks by calling the
543 // <code>successCallback</code> several times. In case of an error, 608 // <code>successCallback</code> several times. In case of an error,
544 // <code>errorCallback</code> must be called. 609 // <code>errorCallback</code> must be called.
545 [maxListeners=1] static void onReadDirectoryRequested( 610 [maxListeners=1] static void onReadDirectoryRequested(
546 ReadDirectoryRequestedOptions options, 611 ReadDirectoryRequestedOptions options,
547 EntriesCallback successCallback, 612 EntriesCallback successCallback,
548 ProviderErrorCallback errorCallback); 613 ProviderErrorCallback errorCallback);
549 614
550 // Raised when opening a file at <code>filePath</code> is requested. If the 615 // 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
661 AddWatcherRequestedOptions options, 726 AddWatcherRequestedOptions options,
662 ProviderSuccessCallback successCallback, 727 ProviderSuccessCallback successCallback,
663 ProviderErrorCallback errorCallback); 728 ProviderErrorCallback errorCallback);
664 729
665 // Raised when the watcher should be removed. If an error occurs, then 730 // Raised when the watcher should be removed. If an error occurs, then
666 // <code>errorCallback</code> must be called. 731 // <code>errorCallback</code> must be called.
667 [maxListeners=1, nodoc] static void onRemoveWatcherRequested( 732 [maxListeners=1, nodoc] static void onRemoveWatcherRequested(
668 RemoveWatcherRequestedOptions options, 733 RemoveWatcherRequestedOptions options,
669 ProviderSuccessCallback successCallback, 734 ProviderSuccessCallback successCallback,
670 ProviderErrorCallback errorCallback); 735 ProviderErrorCallback errorCallback);
736
737 // Raised when executing an action for a file or a directory is requested.
738 // After the action is completed, <code>successCallback</code> must be
739 // called. On error, <code>errorCallback</code> must be called.
740 [maxListeners=1, nodoc] static void onExecuteActionRequested(
741 ExecuteActionRequestedOptions options,
742 ProviderSuccessCallback successCallback,
743 ProviderErrorCallback errorCallback);
671 }; 744 };
672 }; 745 };
673 746
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/common/extensions/api/file_system_provider_internal.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698