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

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

Issue 625463002: [fsp] Add support for observing entries and notifying about changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 2 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 [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 16 matching lines...) Expand all
27 INVALID_URL, 27 INVALID_URL,
28 IO 28 IO
29 }; 29 };
30 30
31 // Mode of opening a file. Used by <code>onOpenFileRequested</code>. 31 // Mode of opening a file. Used by <code>onOpenFileRequested</code>.
32 enum OpenFileMode { 32 enum OpenFileMode {
33 READ, 33 READ,
34 WRITE 34 WRITE
35 }; 35 };
36 36
37 // Type of a change detected on the observed directory.
38 enum ChangeType {
39 CHANGED,
40 DELETED
41 };
42
37 // Represents metadata of a file or a directory. 43 // Represents metadata of a file or a directory.
38 dictionary EntryMetadata { 44 dictionary EntryMetadata {
39 // True if it is a directory. 45 // True if it is a directory.
40 boolean isDirectory; 46 boolean isDirectory;
41 47
42 // Name of this entry (not full path name). 48 // Name of this entry (not full path name).
43 DOMString name; 49 DOMString name;
44 50
45 // File size in bytes. 51 // File size in bytes.
46 double size; 52 double size;
47 53
48 // The last modified time of this entry. 54 // The last modified time of this entry.
49 [instanceOf=Date] object modificationTime; 55 [instanceOf=Date] object modificationTime;
50 56
51 // Mime type for the entry. 57 // Mime type for the entry.
52 DOMString? mimeType; 58 DOMString? mimeType;
53 59
54 // Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most 60 // 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 61 // 32 KB in size. Optional, but can be provided only when explicitly
56 // requested by the <code>onGetMetadataRequested</code> event. 62 // requested by the <code>onGetMetadataRequested</code> event.
57 DOMString? thumbnail; 63 DOMString? thumbnail;
58 }; 64 };
59 65
66 // Represents an observed entry.
67 dictionary ObservedEntry {
68 // The path of the entry being observed.
69 DOMString entryPath;
70
71 // Whether observing should include all child entries recursively.
72 boolean recursive;
73
74 // Tag used by the last notification for the observed path.
75 DOMString? lastTag;
76 };
77
60 // Represents a mounted file system. 78 // Represents a mounted file system.
61 dictionary FileSystemInfo { 79 dictionary FileSystemInfo {
62 // The identifier of the file system. 80 // The identifier of the file system.
63 DOMString fileSystemId; 81 DOMString fileSystemId;
64 82
65 // A human-readable name for the file system. 83 // A human-readable name for the file system.
66 DOMString displayName; 84 DOMString displayName;
67 85
68 // Whether the file system supports operations which may change contents 86 // Whether the file system supports operations which may change contents
69 // of the file system (such as creating, deleting or writing to files). 87 // of the file system (such as creating, deleting or writing to files).
70 boolean writable; 88 boolean writable;
89
90 // Whether the file system supports the <code>tag</code> field for observing
91 // directories.
92 [nodoc] boolean? supportsNotifyTag;
93
94 // List of observed entries.
95 [nodoc] ObservedEntry[] observedEntries;
71 }; 96 };
72 97
73 // Options for the <code>mount()</code> method. 98 // Options for the <code>mount()</code> method.
74 dictionary MountOptions { 99 dictionary MountOptions {
75 // The string indentifier of the file system. Must be unique per each 100 // The string indentifier of the file system. Must be unique per each
76 // extension. 101 // extension.
77 DOMString fileSystemId; 102 DOMString fileSystemId;
78 103
79 // A human-readable name for the file system. 104 // A human-readable name for the file system.
80 DOMString displayName; 105 DOMString displayName;
81 106
82 // Whether the file system supports operations which may change contents 107 // Whether the file system supports operations which may change contents
83 // of the file system (such as creating, deleting or writing to files). 108 // of the file system (such as creating, deleting or writing to files).
84 boolean? writable; 109 boolean? writable;
110
111 // Whether the file system supports the <code>tag</code> field for observed
112 // directories. Required in order to enable the internal cache.
113 [nodoc] boolean? supportsNotifyTag;
85 }; 114 };
86 115
87 // Options for the <code>unmount()</code> method. 116 // Options for the <code>unmount()</code> method.
88 dictionary UnmountOptions { 117 dictionary UnmountOptions {
89 // The identifier of the file system to be unmounted. 118 // The identifier of the file system to be unmounted.
90 DOMString fileSystemId; 119 DOMString fileSystemId;
91 }; 120 };
92 121
93 // Options for the <code>onUnmountRequested()</code> event. 122 // Options for the <code>onUnmountRequested()</code> event.
94 dictionary UnmountRequestedOptions { 123 dictionary UnmountRequestedOptions {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 }; 305 };
277 306
278 // Options for the <code>onAbortRequested()</code> event. 307 // Options for the <code>onAbortRequested()</code> event.
279 dictionary AbortRequestedOptions { 308 dictionary AbortRequestedOptions {
280 // The identifier of the file system related to this operation. 309 // The identifier of the file system related to this operation.
281 DOMString fileSystemId; 310 DOMString fileSystemId;
282 311
283 // The unique identifier of this request. 312 // The unique identifier of this request.
284 long requestId; 313 long requestId;
285 314
286 // An ID of the request to be aborted. 315 // An ID of the request tothis change.
benwells 2014/10/09 04:36:44 nit: "tothis". not sure if this change is intentio
mtomasz 2014/10/09 07:37:52 Accidental change. Done.
287 long operationRequestId; 316 long operationRequestId;
288 }; 317 };
289 318
319 // Options for the <code>onObserveDirectoryRequested()</code> event.
320 dictionary ObserveDirectoryRequestedOptions {
321 // The identifier of the file system related to this operation.
322 DOMString fileSystemId;
323
324 // The unique identifier of this request.
325 long requestId;
326
327 // The path of the directory to be observed.
328 DOMString directoryPath;
329
330 // Whether observing should include all child entries recursively.
331 boolean recursive;
332 };
333
334 // Options for the <code>onUnobserveEntryRequested()</code> event.
335 dictionary UnobserveEntryRequestedOptions {
336 // The identifier of the file system related to this operation.
337 DOMString fileSystemId;
338
339 // The unique identifier of this request.
340 long requestId;
341
342 // The path of the entry to be not observed anymore.
343 DOMString entryPath;
344 };
345
346 // Information about a change happened to an entry within the observed
347 // directory.
348 dictionary ChildChange {
349 // The path of the changed entry.
350 DOMString entryPath;
351
352 // The type of the change which happened to the entry.
353 ChangeType changeType;
354 };
355
356 // Options for the <code>Notify()</code> method.
357 dictionary NotifyOptions {
358 // The identifier of the file system related to this change.
359 DOMString fileSystemId;
360
361 // The path of the observed entry.
362 DOMString observedPath;
363
364 // The type of the change which happened to the observed entry. If it is
365 // DELETED, then the observed entry will be automatically removed from the
366 // list of observed entries.
367 ChangeType changeType;
368
369 // List of changes to entries within the observed directory.
370 ChildChange[]? childChanges;
371
372 // Tag for the notification. Required if the file system was mounted with
373 // the <code>supportsNotifyTag</code> option. Note, that this flag is
374 // necessary to provide notifications about changes which changed even
375 // when the system was shutdown.
376 DOMString? tag;
377 };
378
290 // Callback to receive the result of mount() function. 379 // Callback to receive the result of mount() function.
291 callback MountCallback = void([nodoc, instanceOf=DOMError] object error); 380 callback MountCallback = void([nodoc, instanceOf=DOMError] object error);
292 381
293 // Callback to receive the result of unmount() function. 382 // Callback to receive the result of unmount() function.
294 callback UnmountCallback = void([nodoc, instanceOf=DOMError] object error); 383 callback UnmountCallback = void([nodoc, instanceOf=DOMError] object error);
295 384
296 // Callback to receive the result of getAll() function. 385 // Callback to receive the result of getAll() function.
297 callback GetAllCallback = void(FileSystemInfo[] fileSystems); 386 callback GetAllCallback = void(FileSystemInfo[] fileSystems);
298 387
299 // Callback to handle an error raised from the browser. 388 // Callback to handle an error raised from the browser.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // the providing extension can decide to perform unmounting if not requested 433 // the providing extension can decide to perform unmounting if not requested
345 // (eg. in case of lost connection, or a file error). If there is no file 434 // (eg. in case of lost connection, or a file error). If there is no file
346 // system with the requested id, or unmounting fails, then the 435 // system with the requested id, or unmounting fails, then the
347 // <code>errorCallback</code> will be called. 436 // <code>errorCallback</code> will be called.
348 static void unmount(UnmountOptions options, 437 static void unmount(UnmountOptions options,
349 UnmountCallback successCallback, 438 UnmountCallback successCallback,
350 [nocompile] ErrorCallback errorCallback); 439 [nocompile] ErrorCallback errorCallback);
351 440
352 // Returns all file systems mounted by the extension. 441 // Returns all file systems mounted by the extension.
353 static void getAll(GetAllCallback callback); 442 static void getAll(GetAllCallback callback);
443
444 // Notifies about changes in the observed directory at <code>
445 // observedPath</code>. If the file system is mounted with <code>
446 // supportsNofityTag</code>, then <code>tag</code> must be provided, and
447 // all changes since the last notification always reported, even if the
448 // system was shutdown. The last tag can be obtained with <code>
449 // getAll()</code>. Note, that tag is required in order to enable the
450 // internal cache.
benwells 2014/10/09 04:36:44 This stuff about tagging isn't very obvious (i.e.
mtomasz 2014/10/09 07:37:52 Done.
451 [nodoc] static void notify(NotifyOptions options);
354 }; 452 };
355 453
356 interface Events { 454 interface Events {
357 // Raised when unmounting for the file system with the <code>fileSystemId 455 // Raised when unmounting for the file system with the <code>fileSystemId
358 // </code> identifier is requested. In the response, the <code>unmount 456 // </code> identifier is requested. In the response, the <code>unmount
359 // </code> API method must be called together with <code>successCallback 457 // </code> API method must be called together with <code>successCallback
360 // </code>. If unmounting is not possible (eg. due to a pending operation), 458 // </code>. If unmounting is not possible (eg. due to a pending operation),
361 // then <code>errorCallback</code> must be called. 459 // then <code>errorCallback</code> must be called.
362 [maxListeners=1] static void onUnmountRequested( 460 [maxListeners=1] static void onUnmountRequested(
363 UnmountRequestedOptions options, 461 UnmountRequestedOptions options,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 // is requested. The operation executed with <code>operationRequestId</code> 560 // is requested. The operation executed with <code>operationRequestId</code>
463 // must be immediately stopped and <code>successCallback</code> of this 561 // must be immediately stopped and <code>successCallback</code> of this
464 // abort request executed. If aborting fails, then <code>errorCallback 562 // abort request executed. If aborting fails, then <code>errorCallback
465 // </code> must be called. Note, that callbacks of the aborted operation 563 // </code> must be called. Note, that callbacks of the aborted operation
466 // must not be called, as they will be ignored. Despite calling <code> 564 // must not be called, as they will be ignored. Despite calling <code>
467 // errorCallback</code>, the request may be forcibly aborted. 565 // errorCallback</code>, the request may be forcibly aborted.
468 [maxListeners=1] static void onAbortRequested( 566 [maxListeners=1] static void onAbortRequested(
469 AbortRequestedOptions options, 567 AbortRequestedOptions options,
470 ProviderSuccessCallback successCallback, 568 ProviderSuccessCallback successCallback,
471 ProviderErrorCallback errorCallback); 569 ProviderErrorCallback errorCallback);
570
571 // Raised when setting a new directory watcher is requested. If an error
572 // occurs, then <code>errorCallback</code> must be called.
573 [maxListeners=1, nodoc] static void onObserveDirectoryRequested(
574 ObserveDirectoryRequestedOptions options,
575 ProviderSuccessCallback successCallback,
576 ProviderErrorCallback errorCallback);
577
578 // Raised when the entry should no longer be observed. If an error occurs,
579 // then <code>errorCallback</code> must be called.
580 [maxListeners=1, nodoc] static void onUnobserveEntryRequested(
581 UnobserveEntryRequestedOptions options,
582 ProviderSuccessCallback successCallback,
583 ProviderErrorCallback errorCallback);
472 }; 584 };
473 }; 585 };
474 586
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698