Index: services/files/directory.mojom |
diff --git a/services/files/directory.mojom b/services/files/directory.mojom |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c1ddd02d8a1a6d3440fdfec7977d35aec9d7937f |
--- /dev/null |
+++ b/services/files/directory.mojom |
@@ -0,0 +1,47 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+module mojo.files; |
+ |
+import "services/files/file.mojom"; |
+import "services/files/types.mojom"; |
+ |
+// TODO(vtl): paths may be relative; should they allowed to be absolute? |
+// (currently not) |
+ |
+// TODO(vtl): Write comments. |
+interface Directory { |
+ // Operations about "this" |Directory|: |
+ |
+ // TODO(vtl): Should we have a "close" method? |
qsr
2015/03/02 12:46:40
Isn't closing the handle enough? What can you do w
viettrungluu
2015/03/02 18:10:59
See my answer for files. Having an explicit close
|
+ Read() => (Error error, array<DirectoryEntry>? directory_contents); |
+ Stat() => (Error error, FileInformation? file_information); |
+ Touch(TimespecOrNow? atime, TimespecOrNow? mtime) => (Error error); |
qsr
2015/03/02 12:46:40
Do a null atime or mtime means I should not modify
viettrungluu
2015/03/02 18:10:59
See TODO at line #13. Lots of comments are obvious
|
+ |
+ // Operations *in* "this" |Directory|: |
+ |
+ // Note: |file| is optional, for consistency with |OpenDirectory()|. However, |
+ // it's somewhat useful with |kOpenFlagCreate| to "touch" a file. |
+ OpenFile(string path, File&? file, uint32 open_flags) |
+ => (Error error); |
+ // Note: This can be used as a simple "mkdir()" with |kOpenFlagCreate| and no |
+ // |directory|. |
+ OpenDirectory(string path, |
+ Directory&? directory, |
+ uint32 open_flags) => (Error error); |
+ |
+ Rename(string path, string new_path) => (Error error); |
+ |
+ // Deletes the given path, which may be a file or a directory (see |
+ // |kDeleteFlag...| for details). |
+ Delete(string path, uint32 delete_flags) => (Error error); |
+ |
+ // TODO(vtl): directory "streaming"? |
+ // TODO(vtl): "make root" (i.e., prevent cd-ing, etc., to parent); note that |
+ // this would require a much more complicated implementation (e.g., it needs |
+ // to be "inherited" by OpenDirectory(), and the enforcement needs to be valid |
+ // even if the opened directory is subsequently moved -- e.g., closer to the |
+ // "root") |
+ // TODO(vtl): Add a "watch"? |
+}; |