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

Unified Diff: services/file_manager/directory.mojom

Issue 875643004: Prototype of Files service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Directory: make OpenFile()'s |file| arg optional; add flags to OpenDirectory(); add Delete() Created 5 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
Index: services/file_manager/directory.mojom
diff --git a/services/file_manager/directory.mojom b/services/file_manager/directory.mojom
new file mode 100644
index 0000000000000000000000000000000000000000..c5140aae630a4a8b8d8fea238058d76abdf6de92
--- /dev/null
+++ b/services/file_manager/directory.mojom
@@ -0,0 +1,43 @@
+// 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/file_manager/file.mojom";
+import "services/file_manager/types.mojom";
+
+// TODO(vtl): paths may be relative; should they allowed to be absolute?
+// (currently not)
+
+interface Directory {
+ // Operations about "this" |Directory|:
+
+ // TODO(vtl): Should we have a "close" method?
+ Read() => (Error error, array<DirectoryEntry>? directory_contents);
darin (slow to review) 2015/02/06 23:36:11 note, this kind of API does not handle large direc
vtl 2015/02/06 23:51:49 Yep (see TODO below).
+ Stat() => (Error error, FileInformation? file_information);
+ Touch(FileTimes? times) => (Error error);
+
+ // 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 access_flags, 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 access_flags,
+ uint32 open_flags) => (Error error);
+
+ Rename(string path, string new_path) => (Error error);
+
+ // Can delete both files and directories.
+ Delete(string path) => (Error error);
darin (slow to review) 2015/02/06 23:36:11 not sure if you want to include this, but a recurs
vtl 2015/02/06 23:51:49 Maybe this should take flags.
+
+ // 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")
+};

Powered by Google App Engine
This is Rietveld 408576698