Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / common / extensions / api / file_system_provider.idl
blob5ca491161001b80fed59f47eebfa32e293c152c0
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
3 // found in the LICENSE file.
5 // Use the <code>chrome.fileSystemProvider</code> API to create file systems,
6 // that can be accessible from the file manager on Chrome OS.
7 [platforms=("chromeos"),
8 implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h"]
9 namespace fileSystemProvider {
10 // Error codes used by providing extensions in response to requests. For
11 // success, <code>OK</code> should be used.
12 enum ProviderError {
13 OK,
14 FAILED,
15 IN_USE,
16 EXISTS,
17 NOT_FOUND,
18 ACCESS_DENIED,
19 TOO_MANY_OPENED,
20 NO_MEMORY,
21 NO_SPACE,
22 NOT_A_DIRECTORY,
23 INVALID_OPERATION,
24 SECURITY,
25 ABORT,
26 NOT_A_FILE,
27 NOT_EMPTY,
28 INVALID_URL,
32 // Represents metadata of a file or a directory.
33 dictionary EntryMetadata {
34 // True if it is a directory.
35 boolean isDirectory;
37 // Name of this entry (not full path name).
38 DOMString name;
40 // File size in bytes.
41 double size;
43 // The last modified time of this entry.
44 [instanceOf=Date] object modificationTime;
47 // Callback to receive the result of mount() function.
48 // <code>fileSystemID</code> will be a unique ID for the file system just
49 // mounted. The ID is used to distinguish multiple file systems mounted
50 // from a single File System Provider.
51 callback MountCallback = void(long fileSystemId,
52 [nodoc, instanceOf=DOMError] object error);
55 // Callback to receive the result of unmount() function with the <code>
56 // fileSystemId</code> identifier.
57 callback UnmountCallback = void(long fileSystemId,
58 [nodoc, instanceOf=DOMError] object error);
60 // Callback to be called by the providing extension in case of a success.
61 callback ProviderSuccessCallback = void();
63 // Callback to be called by the providing extension in case of an error.
64 callback ProviderErrorCallback = void(ProviderError error);
66 // Callback to handle an error raised from the browser.
67 [nocompile] callback ErrorCallback = void([instanceOf=DOMError] object error);
69 // Success callback for the <code>onGetMetadataRequested</code> event.
70 callback MetadataCallback = void(EntryMetadata metadata);
72 interface Functions {
73 // Mounts a file system with the given <code>displayName</code>.
74 // <code>displayName</code> will be shown in the left panel of
75 // Files.app. <code>displayName</code> can contain any characters
76 // including '/', but cannot be an empty string. <code>displayName</code>
77 // should be descriptive but doesn't have to be unique. Duplicate display
78 // names are uniquified by adding suffix like "(1)" in the Files.app UI.
79 static void mount(DOMString displayName,
80 MountCallback successCallback,
81 [nocompile] ErrorCallback errorCallback);
83 // Unmounts a file system with the given <code>fileSystemId</code>. It
84 // should be called after <code>onUnmountRequested</code> is invoked. Also,
85 // the providing extension can decide to perform unmounting if not requested
86 // (eg. in case of lost connection, or a file error). If there is no file
87 // system with the requested id, or unmounting fails, then the
88 // <code>errorCallback</code> will be called.
89 static void unmount(long fileSystemId,
90 UnmountCallback successCallback,
91 [nocompile] ErrorCallback errorCallback);
94 interface Events {
95 // Raised when unmounting for the file system with the <code>fileSystemId
96 // </code> identifier is requested. In response, the <code>unmount</code>
97 // API method should be called together with <code>successCallback</code>.
98 // If unmounting is not possible (eg. due to a pending operation), then
99 // <code>errorCallback</code> must be called.
100 [maxListeners=1] static void onUnmountRequested(
101 long fileSystemId,
102 ProviderSuccessCallback successCallback,
103 ProviderErrorCallback errorCallback);
105 // Raised when metadata of a file or a directory at <code>entryPath</code>
106 // is requested. The metadata should be returned with the <code>
107 // successCallback</code> call. In case of an error, <code>errorCallback
108 // </code> must be called.
109 [maxListeners=1] static void onGetMetadataRequested(
110 long fileSystemId,
111 DOMString entryPath,
112 MetadataCallback successCallback,
113 ErrorCallback errorCallback);