Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 module mojo.files; | |
| 6 | |
| 7 import "services/file_manager/file.mojom"; | |
| 8 import "services/file_manager/types.mojom"; | |
| 9 | |
| 10 // TODO(vtl): paths may be relative; should they allowed to be absolute? | |
| 11 // (currently not) | |
| 12 | |
| 13 interface Directory { | |
| 14 // Operations about "this" |Directory|: | |
| 15 | |
| 16 // TODO(vtl): Should we have a "close" method? | |
| 17 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).
| |
| 18 Stat() => (Error error, FileInformation? file_information); | |
| 19 Touch(FileTimes? times) => (Error error); | |
| 20 | |
| 21 // Operations *in* "this" |Directory|: | |
| 22 | |
| 23 // Note: |file| is optional, for consistency with |OpenDirectory()|. However, | |
| 24 // it's somewhat useful with |kOpenFlagCreate| to "touch" a file. | |
| 25 OpenFile(string path, File&? file, uint32 access_flags, uint32 open_flags) | |
| 26 => (Error error); | |
| 27 // Note: This can be used as a simple "mkdir()" with |kOpenFlagCreate| and no | |
| 28 // |directory|. | |
| 29 OpenDirectory(string path, Directory&? directory, uint32 access_flags, | |
| 30 uint32 open_flags) => (Error error); | |
| 31 | |
| 32 Rename(string path, string new_path) => (Error error); | |
| 33 | |
| 34 // Can delete both files and directories. | |
| 35 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.
| |
| 36 | |
| 37 // TODO(vtl): directory "streaming"? | |
| 38 // TODO(vtl): "make root" (i.e., prevent cd-ing, etc., to parent); note that | |
| 39 // this would require a much more complicated implementation (e.g., it needs | |
| 40 // to be "inherited" by OpenDirectory(), and the enforcement needs to be valid | |
| 41 // even if the opened directory is subsequently moved -- e.g., closer to the | |
| 42 // "root") | |
| 43 }; | |
| OLD | NEW |