Chromium Code Reviews| Index: services/files/directory_impl.h |
| diff --git a/services/files/directory_impl.h b/services/files/directory_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5f82379eadac20b97fb389adcac23342610da4cf |
| --- /dev/null |
| +++ b/services/files/directory_impl.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef SERVICES_FILES_DIRECTORY_IMPL_H_ |
| +#define SERVICES_FILES_DIRECTORY_IMPL_H_ |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/files/scoped_file.h" |
| +#include "base/macros.h" |
| +#include "mojo/public/cpp/bindings/interface_request.h" |
| +#include "mojo/public/cpp/bindings/strong_binding.h" |
| +#include "services/files/directory.mojom.h" |
| + |
| +namespace mojo { |
| +namespace files { |
| + |
| +class DirectoryImpl : public Directory { |
| + public: |
| + // Set |owned_dir_name| (to nonempty) only if there's a directory that should |
| + // be deleted when this object is destroyed. |
| + DirectoryImpl(InterfaceRequest<Directory> request, |
| + base::ScopedFD dir_fd, |
| + const base::FilePath& owned_dir_name); |
| + ~DirectoryImpl() override; |
| + |
| + // |Directory| implementation: |
| + void Read( |
| + const Callback<void(Error, Array<DirectoryEntryPtr>)>& callback) override; |
| + void Stat(const Callback<void(Error, FileInformationPtr)>& callback) override; |
| + void Touch(TimespecOrNowPtr atime, |
| + TimespecOrNowPtr mtime, |
| + const Callback<void(Error)>& callback) override; |
| + void OpenFile(const String& path, |
| + InterfaceRequest<File> file, |
| + uint32_t open_flags, |
| + const Callback<void(Error)>& callback) override; |
| + void OpenDirectory(const String& path, |
| + InterfaceRequest<Directory> directory, |
| + uint32_t open_flags, |
| + const Callback<void(Error)>& callback) override; |
| + void Rename(const String& path, |
| + const String& new_path, |
| + const Callback<void(Error)>& callback) override; |
| + void Delete(const String& path, |
| + uint32_t delete_flags, |
| + const Callback<void(Error)>& callback) override; |
| + |
| + private: |
| + StrongBinding<Directory> binding_; |
| + base::ScopedFD dir_fd_; |
| + base::FilePath owned_dir_name_; |
|
qsr
2015/03/03 11:56:44
It seems that you only use this with temporary dir
viettrungluu
2015/03/03 18:50:35
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(DirectoryImpl); |
| +}; |
| + |
| +} // namespace files |
| +} // namespace mojo |
| + |
| +#endif // SERVICES_FILES_DIRECTORY_IMPL_H_ |