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_FILE_MANAGER_DIRECTORY_IMPL_H_ |
| 6 #define SERVICES_FILE_MANAGER_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/file_manager/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(const Callback<void(Error, Array<FileInformationPtr>)>& callback) |
| 29 override; |
| 30 void Change(const String& path, |
| 31 const Callback<void(Error)>& callback) override; |
| 32 void OpenFile(const String& path, |
| 33 InterfaceRequest<File> file, |
| 34 uint32_t access_flags, |
| 35 uint32_t open_flags, |
| 36 const Callback<void(Error)>& callback) override; |
| 37 void OpenDirectory(const String& path, |
| 38 InterfaceRequest<Directory> directory, |
| 39 const Callback<void(Error)>& callback) override; |
| 40 void Rename(const String& path, |
| 41 const String& new_path, |
| 42 const Callback<void(Error)>& callback) override; |
| 43 |
| 44 private: |
| 45 StrongBinding<Directory> binding_; |
| 46 base::ScopedFD dir_fd_; |
| 47 base::FilePath owned_dir_name_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(DirectoryImpl); |
| 50 }; |
| 51 |
| 52 } // namespace files |
| 53 } // namespace mojo |
| 54 |
| 55 #endif // SERVICES_FILE_MANAGER_DIRECTORY_IMPL_H_ |
OLD | NEW |