| 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 [platforms=("chromeos"), | 7 [platforms=("chromeos"), |
| 8 implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_sy
stem_provider_api.h"] | 8 implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_sy
stem_provider_api.h"] |
| 9 namespace fileSystemProvider { | 9 namespace fileSystemProvider { |
| 10 // Error codes used by providing extensions in response to requests. For | 10 // Error codes used by providing extensions in response to requests. For |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Name of this entry (not full path name). | 43 // Name of this entry (not full path name). |
| 44 DOMString name; | 44 DOMString name; |
| 45 | 45 |
| 46 // File size in bytes. | 46 // File size in bytes. |
| 47 double size; | 47 double size; |
| 48 | 48 |
| 49 // The last modified time of this entry. | 49 // The last modified time of this entry. |
| 50 [instanceOf=Date] object modificationTime; | 50 [instanceOf=Date] object modificationTime; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 // Options for the <code>mount()</code> method. |
| 54 dictionary MountOptions { |
| 55 DOMString fileSystemId; |
| 56 DOMString displayName; |
| 57 }; |
| 58 |
| 59 // Options for the <code>unmount()</code> method. |
| 60 dictionary UnmountOptions { |
| 61 DOMString fileSystemId; |
| 62 }; |
| 63 |
| 64 // Options for the <code>onUnmountRequested()</code> event. |
| 65 dictionary UnmountRequestedOptions { |
| 66 DOMString fileSystemId; |
| 67 long requestId; |
| 68 }; |
| 69 |
| 70 // Options for the <code>onGetMetadataRequested()</code> event. |
| 71 dictionary GetMetadataRequestedOptions { |
| 72 DOMString fileSystemId; |
| 73 long requestId; |
| 74 DOMString entryPath; |
| 75 }; |
| 76 |
| 77 // Options for the <code>onReadDirectoryRequested()</code> event. |
| 78 dictionary ReadDirectoryRequestedOptions { |
| 79 DOMString fileSystemId; |
| 80 long requestId; |
| 81 DOMString directoryPath; |
| 82 }; |
| 83 |
| 84 // Options for the <code>onOpenFileRequested()</code> event. |
| 85 dictionary OpenFileRequestedOptions { |
| 86 DOMString fileSystemId; |
| 87 long requestId; |
| 88 DOMString filePath; |
| 89 OpenFileMode mode; |
| 90 boolean create; |
| 91 }; |
| 92 |
| 93 // Options for the <code>onCloseFileRequested()</code> event. |
| 94 dictionary CloseFileRequestedOptions { |
| 95 DOMString fileSystemId; |
| 96 long requestId; |
| 97 long openRequestId; |
| 98 }; |
| 99 |
| 100 // Options for the <code>onReadFileRequested()</code> event. |
| 101 dictionary ReadFileRequestedOptions { |
| 102 DOMString fileSystemId; |
| 103 long requestId; |
| 104 long openRequestId; |
| 105 double offset; |
| 106 double length; |
| 107 }; |
| 108 |
| 53 // Callback to receive the result of mount() function. | 109 // Callback to receive the result of mount() function. |
| 54 callback MountCallback = void([nodoc, instanceOf=DOMError] object error); | 110 callback MountCallback = void([nodoc, instanceOf=DOMError] object error); |
| 55 | 111 |
| 56 | |
| 57 // Callback to receive the result of unmount() function. | 112 // Callback to receive the result of unmount() function. |
| 58 callback UnmountCallback = void([nodoc, instanceOf=DOMError] object error); | 113 callback UnmountCallback = void([nodoc, instanceOf=DOMError] object error); |
| 59 | 114 |
| 60 // Callback to be called by the providing extension in case of a success. | 115 // Callback to be called by the providing extension in case of a success. |
| 61 callback ProviderSuccessCallback = void(); | 116 callback ProviderSuccessCallback = void(); |
| 62 | 117 |
| 63 // Callback to be called by the providing extension in case of an error. | 118 // Callback to be called by the providing extension in case of an error. |
| 64 callback ProviderErrorCallback = void(ProviderError error); | 119 callback ProviderErrorCallback = void(ProviderError error); |
| 65 | 120 |
| 66 // Callback to handle an error raised from the browser. | 121 // Callback to handle an error raised from the browser. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 86 // displayName</code>. <code>displayName</code> will be shown in the left | 141 // displayName</code>. <code>displayName</code> will be shown in the left |
| 87 // panel of Files.app. <code>displayName</code> can contain any characters | 142 // panel of Files.app. <code>displayName</code> can contain any characters |
| 88 // including '/', but cannot be an empty string. <code>displayName</code> | 143 // including '/', but cannot be an empty string. <code>displayName</code> |
| 89 // should be descriptive but doesn't have to be unique. Duplicate display | 144 // should be descriptive but doesn't have to be unique. Duplicate display |
| 90 // names are uniquified by adding suffix like "(1)" in the Files app UI. | 145 // names are uniquified by adding suffix like "(1)" in the Files app UI. |
| 91 // | 146 // |
| 92 // If a file system with the passed <code>fileSystemId</code> is already | 147 // If a file system with the passed <code>fileSystemId</code> is already |
| 93 // mounted by this extension, then <code>errorCallback</code> will be called | 148 // mounted by this extension, then <code>errorCallback</code> will be called |
| 94 // with <code>ProviderError.EXISTS</code> value. The <code>fileSystemId | 149 // with <code>ProviderError.EXISTS</code> value. The <code>fileSystemId |
| 95 // </code> must not be an empty string. | 150 // </code> must not be an empty string. |
| 96 static void mount(DOMString fileSystemId, | 151 static void mount(MountOptions options, |
| 97 DOMString displayName, | |
| 98 MountCallback successCallback, | 152 MountCallback successCallback, |
| 99 [nocompile] ErrorCallback errorCallback); | 153 [nocompile] ErrorCallback errorCallback); |
| 100 | 154 |
| 101 // Unmounts a file system with the given <code>fileSystemId</code>. It | 155 // Unmounts a file system with the given <code>fileSystemId</code>. It |
| 102 // should be called after <code>onUnmountRequested</code> is invoked. Also, | 156 // should be called after <code>onUnmountRequested</code> is invoked. Also, |
| 103 // the providing extension can decide to perform unmounting if not requested | 157 // the providing extension can decide to perform unmounting if not requested |
| 104 // (eg. in case of lost connection, or a file error). If there is no file | 158 // (eg. in case of lost connection, or a file error). If there is no file |
| 105 // system with the requested id, or unmounting fails, then the | 159 // system with the requested id, or unmounting fails, then the |
| 106 // <code>errorCallback</code> will be called. | 160 // <code>errorCallback</code> will be called. |
| 107 static void unmount(DOMString fileSystemId, | 161 static void unmount(UnmountOptions options, |
| 108 UnmountCallback successCallback, | 162 UnmountCallback successCallback, |
| 109 [nocompile] ErrorCallback errorCallback); | 163 [nocompile] ErrorCallback errorCallback); |
| 110 }; | 164 }; |
| 111 | 165 |
| 112 interface Events { | 166 interface Events { |
| 113 // Raised when unmounting for the file system with the <code>fileSystemId | 167 // Raised when unmounting for the file system with the <code>fileSystemId |
| 114 // </code> identifier is requested. In the response, the <code>unmount | 168 // </code> identifier is requested. In the response, the <code>unmount |
| 115 // </code> API method should be called together with <code>successCallback | 169 // </code> API method should be called together with <code>successCallback |
| 116 // </code>. If unmounting is not possible (eg. due to a pending operation), | 170 // </code>. If unmounting is not possible (eg. due to a pending operation), |
| 117 // then <code>errorCallback</code> must be called. | 171 // then <code>errorCallback</code> must be called. |
| 118 [maxListeners=1] static void onUnmountRequested( | 172 [maxListeners=1] static void onUnmountRequested( |
| 119 DOMString fileSystemId, | 173 UnmountRequestedOptions options, |
| 120 ProviderSuccessCallback successCallback, | 174 ProviderSuccessCallback successCallback, |
| 121 ProviderErrorCallback errorCallback); | 175 ProviderErrorCallback errorCallback); |
| 122 | 176 |
| 123 // Raised when metadata of a file or a directory at <code>entryPath</code> | 177 // Raised when metadata of a file or a directory at <code>entryPath</code> |
| 124 // is requested. The metadata should be returned with the <code> | 178 // is requested. The metadata should be returned with the <code> |
| 125 // successCallback</code> call. In case of an error, <code>errorCallback | 179 // successCallback</code> call. In case of an error, <code>errorCallback |
| 126 // </code> must be called. | 180 // </code> must be called. |
| 127 [maxListeners=1] static void onGetMetadataRequested( | 181 [maxListeners=1] static void onGetMetadataRequested( |
| 128 DOMString fileSystemId, | 182 GetMetadataRequestedOptions options, |
| 129 DOMString entryPath, | |
| 130 MetadataCallback successCallback, | 183 MetadataCallback successCallback, |
| 131 ProviderErrorCallback errorCallback); | 184 ProviderErrorCallback errorCallback); |
| 132 | 185 |
| 133 // Raised when contents of a directory at <code>directoryPath</code> are | 186 // Raised when contents of a directory at <code>directoryPath</code> are |
| 134 // requested. The results should be returned in chunks by calling the <code> | 187 // requested. The results should be returned in chunks by calling the <code> |
| 135 // successCallback</code> several times. In case of an error, <code> | 188 // successCallback</code> several times. In case of an error, <code> |
| 136 // errorCallback</code> must be called. | 189 // errorCallback</code> must be called. |
| 137 [maxListeners=1] static void onReadDirectoryRequested( | 190 [maxListeners=1] static void onReadDirectoryRequested( |
| 138 DOMString fileSystemId, | 191 ReadDirectoryRequestedOptions options, |
| 139 DOMString directoryPath, | |
| 140 EntriesCallback successCallback, | 192 EntriesCallback successCallback, |
| 141 ProviderErrorCallback errorCallback); | 193 ProviderErrorCallback errorCallback); |
| 142 | 194 |
| 143 // Raised when opening a file at <code>filePath</code> is requested. | 195 // Raised when opening a file at <code>filePath</code> is requested. |
| 144 // If <code>create</code> is set to <code>true</code> and the file does not | 196 // If <code>create</code> is set to <code>true</code> and the file does not |
| 145 // exist, then it should be created. | 197 // exist, then it should be created. |
| 146 [maxListeners=1] static void onOpenFileRequested( | 198 [maxListeners=1] static void onOpenFileRequested( |
| 147 DOMString fileSystemId, | 199 OpenFileRequestedOptions options, |
| 148 long requestId, | |
| 149 DOMString filePath, | |
| 150 OpenFileMode mode, | |
| 151 boolean create, | |
| 152 ProviderSuccessCallback successCallback, | 200 ProviderSuccessCallback successCallback, |
| 153 ProviderErrorCallback errorCallback); | 201 ProviderErrorCallback errorCallback); |
| 154 | 202 |
| 155 // Raised when opening a file previously opened with <code>openRequestId | 203 // Raised when opening a file previously opened with <code>openRequestId |
| 156 // </code> is requested to be closed. | 204 // </code> is requested to be closed. |
| 157 [maxListeners=1] static void onCloseFileRequested( | 205 [maxListeners=1] static void onCloseFileRequested( |
| 158 DOMString fileSystemId, | 206 CloseFileRequestedOptions options, |
| 159 long openRequestId, | |
| 160 ProviderSuccessCallback successCallback, | 207 ProviderSuccessCallback successCallback, |
| 161 ProviderErrorCallback errorCallback); | 208 ProviderErrorCallback errorCallback); |
| 162 | 209 |
| 163 // Raised when contents of a file opened previously with <code>openRequestId | 210 // Raised when contents of a file opened previously with <code>openRequestId |
| 164 // </code>. The results should be returned in chunks by calling <code> | 211 // </code>. The results should be returned in chunks by calling <code> |
| 165 // successCallback</code> several times. In case of an error, <code> | 212 // successCallback</code> several times. In case of an error, <code> |
| 166 // errorCallback</code> must be called. | 213 // errorCallback</code> must be called. |
| 167 [maxListeners=1] static void onReadFileRequested( | 214 [maxListeners=1] static void onReadFileRequested( |
| 168 DOMString fileSystemId, | 215 ReadFileRequestedOptions options, |
| 169 long openRequestId, | |
| 170 double offset, | |
| 171 double length, | |
| 172 FileDataCallback successCallback, | 216 FileDataCallback successCallback, |
| 173 ProviderErrorCallback errorCallback); | 217 ProviderErrorCallback errorCallback); |
| 174 }; | 218 }; |
| 175 }; | 219 }; |
| 176 | 220 |
| OLD | NEW |