Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // Next MinVersion: 4 | 5 // Next MinVersion: 4 |
| 6 | 6 |
| 7 module arc.mojom; | 7 module arc.mojom; |
| 8 | 8 |
| 9 // Represents a document in Android DocumentsProvider. | 9 // Represents a document in Android DocumentsProvider. |
| 10 // See Android docs of DocumentsContract.Document for details. | 10 // See Android docs of DocumentsContract.Document for details. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // Describes the type of a change made to a document. | 32 // Describes the type of a change made to a document. |
| 33 [Extensible] | 33 [Extensible] |
| 34 enum ChangeType { | 34 enum ChangeType { |
| 35 // Indicates that the child document list of the watched directory was | 35 // Indicates that the child document list of the watched directory was |
| 36 // changed. Note that a watcher can be installed only on directory for now. | 36 // changed. Note that a watcher can be installed only on directory for now. |
| 37 CHANGED = 0, | 37 CHANGED = 0, |
| 38 | 38 |
| 39 // Indicates that the watched document itself was deleted. | 39 // Indicates that the watched document itself was deleted. |
| 40 // When OnDocumentChanged() is called with this change type, the corresponding | 40 // Even if OnDocumentChanged() is called with this change type, the |
| 41 // watcher has been already uninstalled and the host should not call | 41 // corresponding watcher is not uninstalled automatically. The host must |
| 42 // RemoveWatcher(). | 42 // call RemoveWatcher() to clean up an orphaned watcher. |
| 43 DELETED = 1, | 43 DELETED = 1, |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 | 46 |
| 47 // Next method ID: 1 | 47 // Next method ID: 1 |
| 48 interface FileSystemHost { | 48 interface FileSystemHost { |
| 49 // Called when a watched document was changed. | 49 // Called when a watched document was changed. |
| 50 // |type| describes the type of change made to the document. If |type| is | 50 // |type| describes the type of change made to the document. |
| 51 // DELETED, the watcher has been already removed and the host should not call | |
| 52 // RemoveWatcher(). | |
| 53 [MinVersion=3] OnDocumentChanged@0(int64 watcher_id, ChangeType type); | 51 [MinVersion=3] OnDocumentChanged@0(int64 watcher_id, ChangeType type); |
| 54 }; | 52 }; |
| 55 | 53 |
| 56 // Next method ID: 8 | 54 // Next method ID: 8 |
| 57 interface FileSystemInstance { | 55 interface FileSystemInstance { |
| 58 // Notes about Android Documents Provider: | 56 // Notes about Android Documents Provider: |
| 59 // | 57 // |
| 60 // In Android Storage Access Framework, a document is uniquely identified by | 58 // In Android Storage Access Framework, a document is uniquely identified by |
| 61 // a pair of "authority" and "document ID". | 59 // a pair of "authority" and "document ID". |
| 62 // | 60 // |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 75 // | 73 // |
| 76 // Note: Currently, watchers can be installed only on directories, and only | 74 // Note: Currently, watchers can be installed only on directories, and only |
| 77 // directory content changes are notified. | 75 // directory content changes are notified. |
| 78 // | 76 // |
| 79 // On success, a positive unique integer is returned as a watcher ID. | 77 // On success, a positive unique integer is returned as a watcher ID. |
| 80 // FileSystemHost.OnDocumentChanged() will be called with the watcher ID | 78 // FileSystemHost.OnDocumentChanged() will be called with the watcher ID |
| 81 // on directory content changes. | 79 // on directory content changes. |
| 82 // On failure, -1 is returned. | 80 // On failure, -1 is returned. |
| 83 // | 81 // |
| 84 // It is allowed to install multiple watchers to the same directory. In that | 82 // It is allowed to install multiple watchers to the same directory. In that |
| 85 // case, different watcher IDs are returned. | 83 // case, different watcher IDs are returned. |
|
hidehiko
2017/03/02 14:20:28
Optional: How about adding the lifetime of watcher
Shuhei Takahashi
2017/03/02 16:13:15
Sounds great! Let's do so.
| |
| 86 [MinVersion=3] AddWatcher@6(string authority, string document_id) => | 84 [MinVersion=3] AddWatcher@6(string authority, string document_id) => |
| 87 (int64 watcher_id); | 85 (int64 watcher_id); |
| 88 | 86 |
| 89 // Queries child documents of the directory specified by |authority| and | 87 // Queries child documents of the directory specified by |authority| and |
| 90 // |parent_document_id| in Documents Provider. | 88 // |parent_document_id| in Documents Provider. |
| 91 // If such a directory does not exist, null is returned. | 89 // If such a directory does not exist, null is returned. |
| 92 [MinVersion=2] GetChildDocuments@4(string authority, | 90 [MinVersion=2] GetChildDocuments@4(string authority, |
| 93 string parent_document_id) => | 91 string parent_document_id) => |
| 94 (array<Document>? documents); | 92 (array<Document>? documents); |
| 95 | 93 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 110 // Asks the ContentResolver to get a FD to read the file specified by the | 108 // Asks the ContentResolver to get a FD to read the file specified by the |
| 111 // URL. | 109 // URL. |
| 112 [MinVersion=1] OpenFileToRead@2(string url) => (handle? fd); | 110 [MinVersion=1] OpenFileToRead@2(string url) => (handle? fd); |
| 113 | 111 |
| 114 // Uninstalls a document watcher. | 112 // Uninstalls a document watcher. |
| 115 // | 113 // |
| 116 // After this method call returns, OnDocumentChanged() will never be called | 114 // After this method call returns, OnDocumentChanged() will never be called |
| 117 // with the watcher ID. Whether OnDocumentChanged() is called or not after | 115 // with the watcher ID. Whether OnDocumentChanged() is called or not after |
| 118 // this method is called and before this method returns is undefined. | 116 // this method is called and before this method returns is undefined. |
| 119 // | 117 // |
| 120 // It fails if the specified watcher does not exist. Note that a watcher | 118 // It fails if the specified watcher does not exist. |
| 121 // can be automatically uninstalled when a watched document is deleted | |
| 122 // (notified by OnDocumentChanged() with |type| = DELETED). | |
| 123 [MinVersion=3] RemoveWatcher@7(int64 watcher_id) => (bool success); | 119 [MinVersion=3] RemoveWatcher@7(int64 watcher_id) => (bool success); |
| 124 | 120 |
| 125 // Requests MediaProvider to scan specified files. | 121 // Requests MediaProvider to scan specified files. |
| 126 // When the specified file does not exist, the corresponding entry in | 122 // When the specified file does not exist, the corresponding entry in |
| 127 // MediaProvider is removed. | 123 // MediaProvider is removed. |
| 128 RequestMediaScan@0(array<string> paths); | 124 RequestMediaScan@0(array<string> paths); |
| 129 }; | 125 }; |
| OLD | NEW |