| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_ | 5 #ifndef COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_ | 
| 6 #define COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_ | 6 #define COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_ | 
| 7 | 7 | 
|  | 8 #include "base/files/file_path.h" | 
| 8 #include "base/files/scoped_file.h" | 9 #include "base/files/scoped_file.h" | 
| 9 #include "base/macros.h" | 10 #include "base/macros.h" | 
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" | 
| 11 #include "components/filesystem/public/interfaces/directory.mojom.h" | 12 #include "components/filesystem/public/interfaces/directory.mojom.h" | 
| 12 #include "mojo/public/cpp/bindings/interface_request.h" | 13 #include "mojo/public/cpp/bindings/interface_request.h" | 
| 13 #include "mojo/public/cpp/bindings/strong_binding.h" | 14 #include "mojo/public/cpp/bindings/strong_binding.h" | 
| 14 | 15 | 
| 15 namespace base { | 16 namespace base { | 
| 16 class ScopedTempDir; | 17 class ScopedTempDir; | 
| 17 }  // namespace base | 18 }  // namespace base | 
| 18 | 19 | 
| 19 namespace filesystem { | 20 namespace filesystem { | 
| 20 | 21 | 
| 21 class DirectoryImpl : public Directory { | 22 class DirectoryImpl : public Directory { | 
| 22  public: | 23  public: | 
| 23   // Set |temp_dir| only if there's a temporary directory that should be deleted | 24   // Set |temp_dir| only if there's a temporary directory that should be deleted | 
| 24   // when this object is destroyed. | 25   // when this object is destroyed. | 
| 25   DirectoryImpl(mojo::InterfaceRequest<Directory> request, | 26   DirectoryImpl(mojo::InterfaceRequest<Directory> request, | 
| 26                 base::ScopedFD dir_fd, | 27                 base::FilePath directory_path, | 
| 27                 scoped_ptr<base::ScopedTempDir> temp_dir); | 28                 scoped_ptr<base::ScopedTempDir> temp_dir); | 
| 28   ~DirectoryImpl() override; | 29   ~DirectoryImpl() override; | 
| 29 | 30 | 
| 30   // |Directory| implementation: | 31   // |Directory| implementation: | 
| 31   void Read(const ReadCallback& callback) override; | 32   void Read(const ReadCallback& callback) override; | 
| 32   void Stat(const StatCallback& callback) override; |  | 
| 33   void Touch(TimespecOrNowPtr atime, |  | 
| 34              TimespecOrNowPtr mtime, |  | 
| 35              const TouchCallback& callback) override; |  | 
| 36   void OpenFile(const mojo::String& path, | 33   void OpenFile(const mojo::String& path, | 
| 37                 mojo::InterfaceRequest<File> file, | 34                 mojo::InterfaceRequest<File> file, | 
| 38                 uint32_t open_flags, | 35                 uint32_t open_flags, | 
| 39                 const OpenFileCallback& callback) override; | 36                 const OpenFileCallback& callback) override; | 
| 40   void OpenDirectory(const mojo::String& path, | 37   void OpenDirectory(const mojo::String& path, | 
| 41                      mojo::InterfaceRequest<Directory> directory, | 38                      mojo::InterfaceRequest<Directory> directory, | 
| 42                      uint32_t open_flags, | 39                      uint32_t open_flags, | 
| 43                      const OpenDirectoryCallback& callback) override; | 40                      const OpenDirectoryCallback& callback) override; | 
| 44   void Rename(const mojo::String& path, | 41   void Rename(const mojo::String& path, | 
| 45               const mojo::String& new_path, | 42               const mojo::String& new_path, | 
| 46               const RenameCallback& callback) override; | 43               const RenameCallback& callback) override; | 
| 47   void Delete(const mojo::String& path, | 44   void Delete(const mojo::String& path, | 
| 48               uint32_t delete_flags, | 45               uint32_t delete_flags, | 
| 49               const DeleteCallback& callback) override; | 46               const DeleteCallback& callback) override; | 
| 50 | 47 | 
| 51  private: | 48  private: | 
| 52   mojo::StrongBinding<Directory> binding_; | 49   mojo::StrongBinding<Directory> binding_; | 
| 53   base::ScopedFD dir_fd_; | 50   base::FilePath directory_path_; | 
| 54   scoped_ptr<base::ScopedTempDir> temp_dir_; | 51   scoped_ptr<base::ScopedTempDir> temp_dir_; | 
| 55 | 52 | 
| 56   DISALLOW_COPY_AND_ASSIGN(DirectoryImpl); | 53   DISALLOW_COPY_AND_ASSIGN(DirectoryImpl); | 
| 57 }; | 54 }; | 
| 58 | 55 | 
| 59 }  // namespace filesystem | 56 }  // namespace filesystem | 
| 60 | 57 | 
| 61 #endif  // COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_ | 58 #endif  // COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_ | 
| OLD | NEW | 
|---|