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

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

Issue 527723002: [fsp] Cleanup IDL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 [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
11 // success, <code>OK</code> should be used. 11 // success, <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 30 matching lines...) Expand all
52 DOMString? mimeType; 52 DOMString? mimeType;
53 53
54 // Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most 54 // Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most
55 // 32 KB in size. Optional, but can be provided only when explicitly 55 // 32 KB in size. Optional, but can be provided only when explicitly
56 // requested by the <code>onGetMetadataRequested</code> event. 56 // requested by the <code>onGetMetadataRequested</code> event.
57 DOMString? thumbnail; 57 DOMString? thumbnail;
58 }; 58 };
59 59
60 // Represents a mounted file system. 60 // Represents a mounted file system.
61 dictionary FileSystemInfo { 61 dictionary FileSystemInfo {
62 // The identifier of the file system.
62 DOMString fileSystemId; 63 DOMString fileSystemId;
64
65 // A human-readable name for the file system.
63 DOMString displayName; 66 DOMString displayName;
67
68 // Whether the file system supports operations which may change contents
69 // of the file system (such as creating, deleting or writing to files).
64 [nodoc] boolean writable; 70 [nodoc] boolean writable;
65 }; 71 };
66 72
67 // Options for the <code>mount()</code> method. 73 // Options for the <code>mount()</code> method.
68 dictionary MountOptions { 74 dictionary MountOptions {
75 // The string indentifier of the file system. Must be unique per each
76 // extension.
69 DOMString fileSystemId; 77 DOMString fileSystemId;
78
79 // A human-readable name for the file system.
70 DOMString displayName; 80 DOMString displayName;
81
82 // Whether the file system supports operations which may change contents
83 // of the file system (such as creating, deleting or writing to files).
71 [nodoc] boolean? writable; 84 [nodoc] boolean? writable;
72 }; 85 };
73 86
74 // Options for the <code>unmount()</code> method. 87 // Options for the <code>unmount()</code> method.
75 dictionary UnmountOptions { 88 dictionary UnmountOptions {
89 // The identifier of the file system to be unmounted.
76 DOMString fileSystemId; 90 DOMString fileSystemId;
77 }; 91 };
78 92
79 // Options for the <code>onUnmountRequested()</code> event. 93 // Options for the <code>onUnmountRequested()</code> event.
80 dictionary UnmountRequestedOptions { 94 dictionary UnmountRequestedOptions {
95 // The identifier of the file system to be unmounted.
81 DOMString fileSystemId; 96 DOMString fileSystemId;
82 long requestId; 97 long requestId;
83 }; 98 };
84 99
85 // Options for the <code>onGetMetadataRequested()</code> event. 100 // Options for the <code>onGetMetadataRequested()</code> event.
86 dictionary GetMetadataRequestedOptions { 101 dictionary GetMetadataRequestedOptions {
102 // The identifier of the file system related to this operation.
87 DOMString fileSystemId; 103 DOMString fileSystemId;
104
105 // The unique identifier of this request.
88 long requestId; 106 long requestId;
107
108 // The path of the entry to fetch metadata about.
89 DOMString entryPath; 109 DOMString entryPath;
90 110
91 // Set to <code>true</code> if the thumbnail is requested. 111 // Set to <code>true</code> if the thumbnail is requested.
92 boolean thumbnail; 112 boolean thumbnail;
93 }; 113 };
94 114
95 // Options for the <code>onReadDirectoryRequested()</code> event. 115 // Options for the <code>onReadDirectoryRequested()</code> event.
96 dictionary ReadDirectoryRequestedOptions { 116 dictionary ReadDirectoryRequestedOptions {
117 // The identifier of the file system related to this operation.
97 DOMString fileSystemId; 118 DOMString fileSystemId;
119
120 // The unique identifier of this request.
98 long requestId; 121 long requestId;
122
123 // The path of the directory which contents are requested.
99 DOMString directoryPath; 124 DOMString directoryPath;
100 }; 125 };
101 126
102 // Options for the <code>onOpenFileRequested()</code> event. 127 // Options for the <code>onOpenFileRequested()</code> event.
103 dictionary OpenFileRequestedOptions { 128 dictionary OpenFileRequestedOptions {
129 // The identifier of the file system related to this operation.
104 DOMString fileSystemId; 130 DOMString fileSystemId;
131
132 // A request ID which will be used by consecutive read/write and close
133 // requests.
105 long requestId; 134 long requestId;
135
136 // The path of the file to be opened.
106 DOMString filePath; 137 DOMString filePath;
138
139 // Whether the file will be used for reading or writing.
107 OpenFileMode mode; 140 OpenFileMode mode;
108 }; 141 };
109 142
110 // Options for the <code>onCloseFileRequested()</code> event. 143 // Options for the <code>onCloseFileRequested()</code> event.
111 dictionary CloseFileRequestedOptions { 144 dictionary CloseFileRequestedOptions {
145 // The identifier of the file system related to this operation.
112 DOMString fileSystemId; 146 DOMString fileSystemId;
147
148 // The unique identifier of this request.
113 long requestId; 149 long requestId;
150
151 // A request ID used to open the file.
114 long openRequestId; 152 long openRequestId;
115 }; 153 };
116 154
117 // Options for the <code>onReadFileRequested()</code> event. 155 // Options for the <code>onReadFileRequested()</code> event.
118 dictionary ReadFileRequestedOptions { 156 dictionary ReadFileRequestedOptions {
157 // The identifier of the file system related to this operation.
119 DOMString fileSystemId; 158 DOMString fileSystemId;
159
160 // The unique identifier of this request.
120 long requestId; 161 long requestId;
162
163 // A request ID used to open the file.
121 long openRequestId; 164 long openRequestId;
165
166 // Position in the file (in bytes) to start reading from.
122 double offset; 167 double offset;
168
169 // Number of bytes to be returned.
123 double length; 170 double length;
124 }; 171 };
125 172
126 // Options for the <code>onCreateDirectoryRequested()</code> event. 173 // Options for the <code>onCreateDirectoryRequested()</code> event.
127 dictionary CreateDirectoryRequestedOptions { 174 dictionary CreateDirectoryRequestedOptions {
175 // The identifier of the file system related to this operation.
128 DOMString fileSystemId; 176 DOMString fileSystemId;
177
178 // The unique identifier of this request.
129 long requestId; 179 long requestId;
180
181 // The path of the directory to be created.
130 DOMString directoryPath; 182 DOMString directoryPath;
183
184 // Whether the operation is recursive (for directories only).
131 boolean recursive; 185 boolean recursive;
132 }; 186 };
133 187
134 // Options for the <code>onDeleteEntryRequested()</code> event. 188 // Options for the <code>onDeleteEntryRequested()</code> event.
135 dictionary DeleteEntryRequestedOptions { 189 dictionary DeleteEntryRequestedOptions {
190 // The identifier of the file system related to this operation.
136 DOMString fileSystemId; 191 DOMString fileSystemId;
192
193 // The unique identifier of this request.
137 long requestId; 194 long requestId;
195
196 // The path of the entry to be deleted.
138 DOMString entryPath; 197 DOMString entryPath;
198
199 // Whether the operation is recursive (for directories only).
139 boolean recursive; 200 boolean recursive;
140 }; 201 };
141 202
142 // Options for the <code>onCreateFileRequested()</code> event. 203 // Options for the <code>onCreateFileRequested()</code> event.
143 dictionary CreateFileRequestedOptions { 204 dictionary CreateFileRequestedOptions {
205 // The identifier of the file system related to this operation.
144 DOMString fileSystemId; 206 DOMString fileSystemId;
207
208 // The unique identifier of this request.
145 long requestId; 209 long requestId;
210
211 // The path of the file to be created.
146 DOMString filePath; 212 DOMString filePath;
147 }; 213 };
148 214
149 // Options for the <code>onCopyEntryRequested()</code> event. 215 // Options for the <code>onCopyEntryRequested()</code> event.
150 dictionary CopyEntryRequestedOptions { 216 dictionary CopyEntryRequestedOptions {
217 // The identifier of the file system related to this operation.
151 DOMString fileSystemId; 218 DOMString fileSystemId;
219
220 // The unique identifier of this request.
152 long requestId; 221 long requestId;
222
223 // The source path of the entry to be copied.
153 DOMString sourcePath; 224 DOMString sourcePath;
225
226 // The destination path for the copy operation.
154 DOMString targetPath; 227 DOMString targetPath;
155 }; 228 };
156 229
157 // Options for the <code>onMoveEntryRequested()</code> event. 230 // Options for the <code>onMoveEntryRequested()</code> event.
158 dictionary MoveEntryRequestedOptions { 231 dictionary MoveEntryRequestedOptions {
232 // The identifier of the file system related to this operation.
159 DOMString fileSystemId; 233 DOMString fileSystemId;
234
235 // The unique identifier of this request.
160 long requestId; 236 long requestId;
237
238 // The source path of the entry to be moved into a new place.
161 DOMString sourcePath; 239 DOMString sourcePath;
240
241 // The destination path for the copy operation.
162 DOMString targetPath; 242 DOMString targetPath;
163 }; 243 };
164 244
165 // Options for the <code>onTruncateRequested()</code> event. 245 // Options for the <code>onTruncateRequested()</code> event.
166 dictionary TruncateRequestedOptions { 246 dictionary TruncateRequestedOptions {
247 // The identifier of the file system related to this operation.
167 DOMString fileSystemId; 248 DOMString fileSystemId;
249
250 // The unique identifier of this request.
168 long requestId; 251 long requestId;
252
253 // The path of the file to be truncated.
169 DOMString filePath; 254 DOMString filePath;
255
256 // Number of bytes to be retained after the operation completes.
170 double length; 257 double length;
171 }; 258 };
172 259
173 // Options for the <code>onWriteFileRequested()</code> event. 260 // Options for the <code>onWriteFileRequested()</code> event.
174 dictionary WriteFileRequestedOptions { 261 dictionary WriteFileRequestedOptions {
262 // The identifier of the file system related to this operation.
175 DOMString fileSystemId; 263 DOMString fileSystemId;
264
265 // The unique identifier of this request.
176 long requestId; 266 long requestId;
267
268 // A request ID used to open the file.
177 long openRequestId; 269 long openRequestId;
270
271 // Position in the file (in bytes) to start writing the bytes from.
178 double offset; 272 double offset;
273
274 // Buffer of bytes to be written to the file.
179 ArrayBuffer data; 275 ArrayBuffer data;
180 }; 276 };
181 277
182 // Options for the <code>onAbortRequested()</code> event. 278 // Options for the <code>onAbortRequested()</code> event.
183 dictionary AbortRequestedOptions { 279 dictionary AbortRequestedOptions {
280 // The identifier of the file system related to this operation.
184 DOMString fileSystemId; 281 DOMString fileSystemId;
282
283 // The unique identifier of this request.
185 long requestId; 284 long requestId;
285
286 // An ID of the request to be aborted.
186 long operationRequestId; 287 long operationRequestId;
187 }; 288 };
188 289
189 // Callback to receive the result of mount() function. 290 // Callback to receive the result of mount() function.
190 callback MountCallback = void([nodoc, instanceOf=DOMError] object error); 291 callback MountCallback = void([nodoc, instanceOf=DOMError] object error);
191 292
192 // Callback to receive the result of unmount() function. 293 // Callback to receive the result of unmount() function.
193 callback UnmountCallback = void([nodoc, instanceOf=DOMError] object error); 294 callback UnmountCallback = void([nodoc, instanceOf=DOMError] object error);
194 295
195 // Callback to receive the result of getAll() function. 296 // Callback to receive the result of getAll() function.
(...skipping 21 matching lines...) Expand all
217 // data will be returned, then <code>hasMore</code> must be true, and it 318 // data will be returned, then <code>hasMore</code> must be true, and it
218 // has to be called again with additional entries. If no more data is 319 // has to be called again with additional entries. If no more data is
219 // available, then <code>hasMore</code> must be set to false. 320 // available, then <code>hasMore</code> must be set to false.
220 callback FileDataCallback = void(ArrayBuffer data, boolean hasMore); 321 callback FileDataCallback = void(ArrayBuffer data, boolean hasMore);
221 322
222 interface Functions { 323 interface Functions {
223 // Mounts a file system with the given <code>fileSystemId</code> and <code> 324 // Mounts a file system with the given <code>fileSystemId</code> and <code>
224 // displayName</code>. <code>displayName</code> will be shown in the left 325 // displayName</code>. <code>displayName</code> will be shown in the left
225 // panel of Files.app. <code>displayName</code> can contain any characters 326 // panel of Files.app. <code>displayName</code> can contain any characters
226 // including '/', but cannot be an empty string. <code>displayName</code> 327 // including '/', but cannot be an empty string. <code>displayName</code>
227 // should be descriptive but doesn't have to be unique. Duplicate display 328 // must be descriptive but doesn't have to be unique. Duplicate display
228 // names are uniquified by adding suffix like "(1)" in the Files app UI. 329 // names are uniquified by adding suffix like "(1)" in the Files app UI.
229 // 330 //
230 // If a file system with the passed <code>fileSystemId</code> is already 331 // If a file system with the passed <code>fileSystemId</code> is already
231 // mounted by this extension, then <code>errorCallback</code> will be called 332 // mounted by this extension, then <code>errorCallback</code> will be called
232 // with <code>ProviderError.EXISTS</code> value. The <code>fileSystemId 333 // with <code>ProviderError.EXISTS</code> value. The <code>fileSystemId
233 // </code> must not be an empty string. 334 // </code> must not be an empty string.
234 static void mount(MountOptions options, 335 static void mount(MountOptions options,
235 MountCallback successCallback, 336 MountCallback successCallback,
236 [nocompile] ErrorCallback errorCallback); 337 [nocompile] ErrorCallback errorCallback);
237 338
238 // Unmounts a file system with the given <code>fileSystemId</code>. It 339 // Unmounts a file system with the given <code>fileSystemId</code>. It
239 // should be called after <code>onUnmountRequested</code> is invoked. Also, 340 // must be called after <code>onUnmountRequested</code> is invoked. Also,
240 // the providing extension can decide to perform unmounting if not requested 341 // the providing extension can decide to perform unmounting if not requested
241 // (eg. in case of lost connection, or a file error). If there is no file 342 // (eg. in case of lost connection, or a file error). If there is no file
242 // system with the requested id, or unmounting fails, then the 343 // system with the requested id, or unmounting fails, then the
243 // <code>errorCallback</code> will be called. 344 // <code>errorCallback</code> will be called.
244 static void unmount(UnmountOptions options, 345 static void unmount(UnmountOptions options,
245 UnmountCallback successCallback, 346 UnmountCallback successCallback,
246 [nocompile] ErrorCallback errorCallback); 347 [nocompile] ErrorCallback errorCallback);
247 348
248 // Returns all file systems mounted by the extension. 349 // Returns all file systems mounted by the extension.
249 static void getAll(GetAllCallback callback); 350 static void getAll(GetAllCallback callback);
250 }; 351 };
251 352
252 interface Events { 353 interface Events {
253 // Raised when unmounting for the file system with the <code>fileSystemId 354 // Raised when unmounting for the file system with the <code>fileSystemId
254 // </code> identifier is requested. In the response, the <code>unmount 355 // </code> identifier is requested. In the response, the <code>unmount
255 // </code> API method should be called together with <code>successCallback 356 // </code> API method must be called together with <code>successCallback
256 // </code>. If unmounting is not possible (eg. due to a pending operation), 357 // </code>. If unmounting is not possible (eg. due to a pending operation),
257 // then <code>errorCallback</code> must be called. 358 // then <code>errorCallback</code> must be called.
258 [maxListeners=1] static void onUnmountRequested( 359 [maxListeners=1] static void onUnmountRequested(
259 UnmountRequestedOptions options, 360 UnmountRequestedOptions options,
260 ProviderSuccessCallback successCallback, 361 ProviderSuccessCallback successCallback,
261 ProviderErrorCallback errorCallback); 362 ProviderErrorCallback errorCallback);
262 363
263 // Raised when metadata of a file or a directory at <code>entryPath</code> 364 // Raised when metadata of a file or a directory at <code>entryPath</code>
264 // is requested. The metadata should be returned with the <code> 365 // is requested. The metadata must be returned with the <code>
265 // successCallback</code> call. In case of an error, <code>errorCallback 366 // successCallback</code> call. In case of an error, <code>errorCallback
266 // </code> must be called. 367 // </code> must be called.
267 [maxListeners=1] static void onGetMetadataRequested( 368 [maxListeners=1] static void onGetMetadataRequested(
268 GetMetadataRequestedOptions options, 369 GetMetadataRequestedOptions options,
269 MetadataCallback successCallback, 370 MetadataCallback successCallback,
270 ProviderErrorCallback errorCallback); 371 ProviderErrorCallback errorCallback);
271 372
272 // Raised when contents of a directory at <code>directoryPath</code> are 373 // Raised when contents of a directory at <code>directoryPath</code> are
273 // requested. The results should be returned in chunks by calling the <code> 374 // requested. The results must be returned in chunks by calling the <code>
274 // successCallback</code> several times. In case of an error, <code> 375 // successCallback</code> several times. In case of an error, <code>
275 // errorCallback</code> must be called. 376 // errorCallback</code> must be called.
276 [maxListeners=1] static void onReadDirectoryRequested( 377 [maxListeners=1] static void onReadDirectoryRequested(
277 ReadDirectoryRequestedOptions options, 378 ReadDirectoryRequestedOptions options,
278 EntriesCallback successCallback, 379 EntriesCallback successCallback,
279 ProviderErrorCallback errorCallback); 380 ProviderErrorCallback errorCallback);
280 381
281 // Raised when opening a file at <code>filePath</code> is requested. If the 382 // Raised when opening a file at <code>filePath</code> is requested. If the
282 // file does not exist, then the operation must fail. 383 // file does not exist, then the operation must fail.
283 [maxListeners=1] static void onOpenFileRequested( 384 [maxListeners=1] static void onOpenFileRequested(
284 OpenFileRequestedOptions options, 385 OpenFileRequestedOptions options,
285 ProviderSuccessCallback successCallback, 386 ProviderSuccessCallback successCallback,
286 ProviderErrorCallback errorCallback); 387 ProviderErrorCallback errorCallback);
287 388
288 // Raised when opening a file previously opened with <code>openRequestId 389 // Raised when opening a file previously opened with <code>openRequestId
289 // </code> is requested to be closed. 390 // </code> is requested to be closed.
290 [maxListeners=1] static void onCloseFileRequested( 391 [maxListeners=1] static void onCloseFileRequested(
291 CloseFileRequestedOptions options, 392 CloseFileRequestedOptions options,
292 ProviderSuccessCallback successCallback, 393 ProviderSuccessCallback successCallback,
293 ProviderErrorCallback errorCallback); 394 ProviderErrorCallback errorCallback);
294 395
295 // Raised when reading contents of a file opened previously with <code> 396 // Raised when reading contents of a file opened previously with <code>
296 // openRequestId</code> is requested. The results should be returned in 397 // openRequestId</code> is requested. The results must be returned in
297 // chunks by calling <code>successCallback</code> several times. In case of 398 // chunks by calling <code>successCallback</code> several times. In case of
298 // an error, <code>errorCallback</code> must be called. 399 // an error, <code>errorCallback</code> must be called.
299 [maxListeners=1] static void onReadFileRequested( 400 [maxListeners=1] static void onReadFileRequested(
300 ReadFileRequestedOptions options, 401 ReadFileRequestedOptions options,
301 FileDataCallback successCallback, 402 FileDataCallback successCallback,
302 ProviderErrorCallback errorCallback); 403 ProviderErrorCallback errorCallback);
303 404
304 // Raised when creating a directory is requested. The operation must fail 405 // Raised when creating a directory is requested. The operation must fail
305 // with the EXISTS error if the target directory already exists. 406 // with the EXISTS error if the target directory already exists.
306 // If <code>recursive</code> is true, then all of the missing directories 407 // If <code>recursive</code> is true, then all of the missing directories
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 450
350 // Raised when writing contents to a file opened previously with <code> 451 // Raised when writing contents to a file opened previously with <code>
351 // openRequestId</code> is requested. 452 // openRequestId</code> is requested.
352 [maxListeners=1, nodoc] static void onWriteFileRequested( 453 [maxListeners=1, nodoc] static void onWriteFileRequested(
353 WriteFileRequestedOptions options, 454 WriteFileRequestedOptions options,
354 ProviderSuccessCallback successCallback, 455 ProviderSuccessCallback successCallback,
355 ProviderErrorCallback errorCallback); 456 ProviderErrorCallback errorCallback);
356 457
357 // Raised when aborting an operation with <code>operationRequestId</code> 458 // Raised when aborting an operation with <code>operationRequestId</code>
358 // is requested. The operation executed with <code>operationRequestId</code> 459 // is requested. The operation executed with <code>operationRequestId</code>
359 // should be immediately stopped and <code>successCallback</code> of this 460 // must be immediately stopped and <code>successCallback</code> of this
360 // abort request executed. If aborting fails, then <code>errorCallback 461 // abort request executed. If aborting fails, then <code>errorCallback
361 // </code> must be called. Note, that callbacks of the aborted operation 462 // </code> must be called. Note, that callbacks of the aborted operation
362 // should not be called, as they will be ignored. Despite calling <code> 463 // must not be called, as they will be ignored. Despite calling <code>
363 // errorCallback</code>, the request may be forcibly aborted. 464 // errorCallback</code>, the request may be forcibly aborted.
364 [maxListeners=1, nodoc] static void onAbortRequested( 465 [maxListeners=1, nodoc] static void onAbortRequested(
365 AbortRequestedOptions options, 466 AbortRequestedOptions options,
366 ProviderSuccessCallback successCallback, 467 ProviderSuccessCallback successCallback,
367 ProviderErrorCallback errorCallback); 468 ProviderErrorCallback errorCallback);
368 }; 469 };
369 }; 470 };
370 471
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698