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_DIRECTORY_IMPL_H_ |
| 6 #define SERVICES_FILES_DIRECTORY_IMPL_H_ |
| 7 |
| 8 #include "base/files/file_path.h" |
| 9 #include "base/files/scoped_file.h" |
| 10 #include "base/macros.h" |
| 11 #include "mojo/public/cpp/bindings/interface_request.h" |
| 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 13 #include "services/files/directory.mojom.h" |
| 14 |
| 15 namespace mojo { |
| 16 namespace files { |
| 17 |
| 18 class DirectoryImpl : public Directory { |
| 19 public: |
| 20 // Set |owned_dir_name| (to nonempty) only if there's a directory that should |
| 21 // be deleted when this object is destroyed. |
| 22 DirectoryImpl(InterfaceRequest<Directory> request, |
| 23 base::ScopedFD dir_fd, |
| 24 const base::FilePath& owned_dir_name); |
| 25 ~DirectoryImpl() override; |
| 26 |
| 27 // |Directory| implementation: |
| 28 void Read( |
| 29 const Callback<void(Error, Array<DirectoryEntryPtr>)>& callback) override; |
| 30 void Stat(const Callback<void(Error, FileInformationPtr)>& callback) override; |
| 31 void Touch(TimespecOrNowPtr atime, |
| 32 TimespecOrNowPtr mtime, |
| 33 const Callback<void(Error)>& callback) override; |
| 34 void OpenFile(const String& path, |
| 35 InterfaceRequest<File> file, |
| 36 uint32_t open_flags, |
| 37 const Callback<void(Error)>& callback) override; |
| 38 void OpenDirectory(const String& path, |
| 39 InterfaceRequest<Directory> directory, |
| 40 uint32_t open_flags, |
| 41 const Callback<void(Error)>& callback) override; |
| 42 void Rename(const String& path, |
| 43 const String& new_path, |
| 44 const Callback<void(Error)>& callback) override; |
| 45 void Delete(const String& path, |
| 46 uint32_t delete_flags, |
| 47 const Callback<void(Error)>& callback) override; |
| 48 |
| 49 private: |
| 50 StrongBinding<Directory> binding_; |
| 51 base::ScopedFD dir_fd_; |
| 52 base::FilePath owned_dir_name_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(DirectoryImpl); |
| 55 }; |
| 56 |
| 57 } // namespace files |
| 58 } // namespace mojo |
| 59 |
| 60 #endif // SERVICES_FILES_DIRECTORY_IMPL_H_ |
OLD | NEW |