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

Unified Diff: components/arc/common/file_system.mojom

Issue 2714433003: mediaview: IPC definitions to watch for document changes. (Closed)
Patch Set: Add more fool-proof comment as per hidehiko's request in another CL. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/arc/test/fake_file_system_instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/common/file_system.mojom
diff --git a/components/arc/common/file_system.mojom b/components/arc/common/file_system.mojom
index de13a030d0099265c5fd65fb27f39bfade747812..0fc8ecb91d458b1752b57a05f4d4ccb6019d9fba 100644
--- a/components/arc/common/file_system.mojom
+++ b/components/arc/common/file_system.mojom
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// Next MinVersion: 3
+// Next MinVersion: 4
module arc.mojom;
@@ -29,7 +29,31 @@ struct Document {
uint64 last_modified;
};
-// Next method ID: 5
+// Describes the type of a change made to a document.
+[Extensible]
+enum ChangeType {
+ // Indicates that the child document list of the watched directory was
+ // changed. Note that a watcher can be installed only on directory for now.
+ CHANGED = 0,
+
+ // Indicates that the watched document itself was deleted.
+ // When OnDocumentChanged() is called with this change type, the corresponding
+ // watcher has been already uninstalled and the host should not call
+ // RemoveWatcher().
+ DELETED = 1,
+};
+
+
+// Next method ID: 1
+interface FileSystemHost {
+ // Called when a watched document was changed.
+ // |type| describes the type of change made to the document. If |type| is
+ // DELETED, the watcher has been already removed and the host should not call
+ // RemoveWatcher().
+ [MinVersion=3] OnDocumentChanged@0(int64 watcher_id, ChangeType type);
+};
+
+// Next method ID: 8
interface FileSystemInstance {
// Notes about Android Documents Provider:
//
@@ -47,6 +71,21 @@ interface FileSystemInstance {
// https://developer.android.com/guide/topics/providers/document-provider.html
// https://developer.android.com/reference/android/provider/DocumentsContract.html
+ // Installs a document watcher to watch updates of a document.
+ //
+ // Note: Currently, watchers can be installed only on directories, and only
+ // directory content changes are notified.
+ //
+ // On success, a positive unique integer is returned as a watcher ID.
+ // FileSystemHost.OnDocumentChanged() will be called with the watcher ID
+ // on directory content changes.
+ // On failure, -1 is returned.
+ //
+ // It is allowed to install multiple watchers to the same directory. In that
+ // case, different watcher IDs are returned.
+ [MinVersion=3] AddWatcher@6(string authority, string document_id) =>
+ (int64 watcher_id);
+
// Queries child documents of the directory specified by |authority| and
// |parent_document_id| in Documents Provider.
// If such a directory does not exist, null is returned.
@@ -65,10 +104,24 @@ interface FileSystemInstance {
// streams), -1 is returned.
[MinVersion=1] GetFileSize@1(string url) => (int64 size);
+ // Establishes full-duplex communication with the host.
+ [MinVersion=3] Init@5(FileSystemHost host_ptr);
+
// Asks the ContentResolver to get a FD to read the file specified by the
// URL.
[MinVersion=1] OpenFileToRead@2(string url) => (handle? fd);
+ // Uninstalls a document watcher.
+ //
+ // After this method call returns, OnDocumentChanged() will never be called
+ // with the watcher ID. Whether OnDocumentChanged() is called or not after
+ // this method is called and before this method returns is undefined.
+ //
+ // It fails if the specified watcher does not exist. Note that a watcher
+ // can be automatically uninstalled when a watched document is deleted
+ // (notified by OnDocumentChanged() with |type| = DELETED).
+ [MinVersion=3] RemoveWatcher@7(int64 watcher_id) => (bool success);
+
// Requests MediaProvider to scan specified files.
// When the specified file does not exist, the corresponding entry in
// MediaProvider is removed.
« no previous file with comments | « no previous file | components/arc/test/fake_file_system_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698