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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/api/file_system_provider.idl
diff --git a/chrome/common/extensions/api/file_system_provider.idl b/chrome/common/extensions/api/file_system_provider.idl
index cd4cd613e584ada5180751cde88faf6569e1dc72..7ec37c2af603d4938398101734a16c3c50181d10 100644
--- a/chrome/common/extensions/api/file_system_provider.idl
+++ b/chrome/common/extensions/api/file_system_provider.idl
@@ -8,7 +8,7 @@
namespace fileSystemProvider {
// Error codes used by providing extensions in response to requests as well
// as in case of errors when calling methods of the API. For success,
- // <code>OK</code> must be used.
+ // <code>"OK"</code> must be used.
enum ProviderError {
OK,
FAILED,
@@ -41,6 +41,16 @@ namespace fileSystemProvider {
DELETED
};
+ // Type of an action. <code>"SHARE"</code> is for sharing files with others,
+ // <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.
+ // unpinning. <code>"CUSTOM"</code> is used for any other custom action.
+ // Used by $(ref:onGetActionsRequested) and $(ref:onExecuteActionRequested).
+ enum ActionType {
+ SHARE,
+ PIN_TOGGLE,
+ CUSTOM
+ };
+
// Represents metadata of a file or a directory.
dictionary EntryMetadata {
// True if it is a directory.
@@ -169,6 +179,18 @@ namespace fileSystemProvider {
boolean thumbnail;
};
+ // Options for the $(ref:onGetActionsRequested) event.
+ dictionary GetActionsRequestedOptions {
+ // The identifier of the file system related to this operation.
+ DOMString fileSystemId;
+
+ // The unique identifier of this request.
+ long requestId;
+
+ // The path of the entry to return the list of actions for.
+ DOMString entryPath;
+ };
+
// Options for the $(ref:onReadDirectoryRequested) event.
dictionary ReadDirectoryRequestedOptions {
// The identifier of the file system related to this operation.
@@ -375,6 +397,38 @@ namespace fileSystemProvider {
boolean recursive;
};
+ // Information about an action for an entry.
+ dictionary Action {
+ // The identifier of the action.
+ DOMString id;
+
+ // The type of the action. Files app uses the <code>type</code> to render
+ // the action accordingly. For <code>"CUSTOM"</code> action type, the
+ // actions are rendered in the context menu. For other types, they may be
+ // rendered in a way consistent with other file types, eg. as a button in
+ // the Files app's header.
+ 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
+
+ // The title of the action. Used only for the <code>"CUSTOM"</code> action
+ // type. For other types, the title is ignored.
+ DOMString? title;
+ };
+
+ // Options for the $(ref:onExecuteActionRequested) event.
+ dictionary ExecuteActionRequestedOptions {
+ // The identifier of the file system related to this operation.
+ DOMString fileSystemId;
+
+ // The unique identifier of this request.
+ long requestId;
+
+ // The path of the entry to be used for the action.
+ DOMString entryPath;
+
+ // The identifier of the action to be executed.
+ DOMString actionId;
+ };
+
// Information about a change happened to an entry within the observed
// directory (including the entry itself).
dictionary Change {
@@ -434,8 +488,10 @@ namespace fileSystemProvider {
[nocompile] callback ProviderErrorCallback = void(ProviderError error);
// Success callback for the $(ref:onGetMetadataRequested) event.
- [nocompile] callback MetadataCallback = void(
- EntryMetadata metadata);
+ [nocompile] callback MetadataCallback = void(EntryMetadata metadata);
+
+ // Success callback for the $(ref:onGetActionsRequested) event.
+ [nocompile, nodoc] callback ActionsCallback = void(Action[] actions);
// Success callback for the $(ref:onReadDirectoryRequested) event. If more
// entries will be returned, then <code>hasMore</code> must be true, and it
@@ -538,6 +594,15 @@ namespace fileSystemProvider {
MetadataCallback successCallback,
ProviderErrorCallback errorCallback);
+ // Raised when list of actions for of a file or a directory at
+ // <code>entryPath</code>s requested. The actions must be returned with the
+ // <code>successCallback</code> call. In case of an error,
+ // <code>errorCallback</code> must be called.
+ [maxListeners=1, nodoc] static void onGetActionsRequested(
+ GetActionsRequestedOptions options,
+ ActionsCallback successCallback,
+ ProviderErrorCallback errorCallback);
+
// Raised when contents of a directory at <code>directoryPath</code> are
// requested. The results must be returned in chunks by calling the
// <code>successCallback</code> several times. In case of an error,
@@ -668,6 +733,14 @@ namespace fileSystemProvider {
RemoveWatcherRequestedOptions options,
ProviderSuccessCallback successCallback,
ProviderErrorCallback errorCallback);
+
+ // Raised when executing an action for a file or a directory is requested.
+ // After the action is completed, <code>successCallback</code> must be
+ // called. On error, <code>errorCallback</code> must be called.
+ [maxListeners=1, nodoc] static void onExecuteActionRequested(
+ ExecuteActionRequestedOptions options,
+ ProviderSuccessCallback successCallback,
+ ProviderErrorCallback errorCallback);
};
};
« 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