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

Side by Side Diff: components/arc/common/file_system.mojom

Issue 2718303002: mediaview: Change the contract of watcher callbacks. (Closed)
Patch Set: Added a comment about watcher persistence. Created 3 years, 9 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 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
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 //
63 // - An authority specifies a Documents Provider that serves a document. 61 // - An authority specifies a Documents Provider that serves a document.
64 // It is the origin part of a content:// URI used to access the Documents 62 // It is the origin part of a content:// URI used to access the Documents
65 // Provider via Content Resolver protocol. 63 // Provider via Content Resolver protocol.
66 // Example: "com.android.providers.media.documents" 64 // Example: "com.android.providers.media.documents"
67 // - A document ID is an opaque string that specifies a particular document 65 // - A document ID is an opaque string that specifies a particular document
68 // in a documents provider. Its format varies by providers. 66 // in a documents provider. Its format varies by providers.
69 // 67 //
70 // See the following documents for details about Documents Provider: 68 // See the following documents for details about Documents Provider:
71 // https://developer.android.com/guide/topics/providers/document-provider.html 69 // https://developer.android.com/guide/topics/providers/document-provider.html
72 // https://developer.android.com/reference/android/provider/DocumentsContract. html 70 // https://developer.android.com/reference/android/provider/DocumentsContract. html
73 71
74 // Installs a document watcher to watch updates of a document. 72 // Installs a document watcher to watch updates of a document.
75 // 73 //
76 // Note: Currently, watchers can be installed only on directories, and only 74 // 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.
84 //
85 // Watchers are not persistent. When the Mojo connection is lost, all
86 // watchers are cleared. Also, after reconnecting, watcher IDs can be reused.
86 [MinVersion=3] AddWatcher@6(string authority, string document_id) => 87 [MinVersion=3] AddWatcher@6(string authority, string document_id) =>
87 (int64 watcher_id); 88 (int64 watcher_id);
88 89
89 // Queries child documents of the directory specified by |authority| and 90 // Queries child documents of the directory specified by |authority| and
90 // |parent_document_id| in Documents Provider. 91 // |parent_document_id| in Documents Provider.
91 // If such a directory does not exist, null is returned. 92 // If such a directory does not exist, null is returned.
92 [MinVersion=2] GetChildDocuments@4(string authority, 93 [MinVersion=2] GetChildDocuments@4(string authority,
93 string parent_document_id) => 94 string parent_document_id) =>
94 (array<Document>? documents); 95 (array<Document>? documents);
95 96
(...skipping 14 matching lines...) Expand all
110 // Asks the ContentResolver to get a FD to read the file specified by the 111 // Asks the ContentResolver to get a FD to read the file specified by the
111 // URL. 112 // URL.
112 [MinVersion=1] OpenFileToRead@2(string url) => (handle? fd); 113 [MinVersion=1] OpenFileToRead@2(string url) => (handle? fd);
113 114
114 // Uninstalls a document watcher. 115 // Uninstalls a document watcher.
115 // 116 //
116 // After this method call returns, OnDocumentChanged() will never be called 117 // After this method call returns, OnDocumentChanged() will never be called
117 // with the watcher ID. Whether OnDocumentChanged() is called or not after 118 // with the watcher ID. Whether OnDocumentChanged() is called or not after
118 // this method is called and before this method returns is undefined. 119 // this method is called and before this method returns is undefined.
119 // 120 //
120 // It fails if the specified watcher does not exist. Note that a watcher 121 // 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); 122 [MinVersion=3] RemoveWatcher@7(int64 watcher_id) => (bool success);
124 123
125 // Requests MediaProvider to scan specified files. 124 // Requests MediaProvider to scan specified files.
126 // When the specified file does not exist, the corresponding entry in 125 // When the specified file does not exist, the corresponding entry in
127 // MediaProvider is removed. 126 // MediaProvider is removed.
128 RequestMediaScan@0(array<string> paths); 127 RequestMediaScan@0(array<string> paths);
129 }; 128 };
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