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 #ifndef SERVICES_FILES_C_LIB_DIRECTORY_WRAPPER_H_ | |
6 #define SERVICES_FILES_C_LIB_DIRECTORY_WRAPPER_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "files/public/c/mojio_sys_types.h" | |
11 #include "files/public/interfaces/directory.mojom.h" | |
12 #include "mojo/public/c/system/macros.h" | |
13 | |
14 namespace mojio { | |
15 | |
16 class ErrnoImpl; | |
17 class FDImpl; | |
18 | |
19 // TODO(vtl): Probably this should be made into an implementation of |FDImpl| | |
20 // (with additional methods) and renamed |DirectoryFDImpl|, to support opening | |
21 // directories, |openat()|, etc> | |
22 class DirectoryWrapper { | |
23 public: | |
24 DirectoryWrapper(ErrnoImpl* errno_impl, mojo::files::DirectoryPtr directory); | |
25 ~DirectoryWrapper(); | |
26 | |
27 std::unique_ptr<FDImpl> Open(const char* path, int oflag, mojio_mode_t mode); | |
28 bool Chdir(const char* path); | |
29 | |
30 // TODO(vtl): MkDir(), etc. | |
31 | |
32 // Mostly for tests: | |
33 mojo::files::DirectoryPtr& directory() { return directory_; } | |
34 | |
35 private: | |
36 ErrnoImpl* const errno_impl_; | |
37 mojo::files::DirectoryPtr directory_; | |
38 | |
39 MOJO_DISALLOW_COPY_AND_ASSIGN(DirectoryWrapper); | |
40 }; | |
41 | |
42 } // namespace mojio | |
43 | |
44 #endif // SERVICES_FILES_C_LIB_DIRECTORY_WRAPPER_H_ | |
OLD | NEW |