Update V8 to version 4.7.21.
[chromium-blink-merge.git] / components / filesystem / directory_impl.h
blobb016b8395815cfae690dce337547240811464602
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.
5 #ifndef COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_
6 #define COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_
8 #include "base/files/file_path.h"
9 #include "base/files/scoped_file.h"
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/filesystem/public/interfaces/directory.mojom.h"
13 #include "mojo/public/cpp/bindings/interface_request.h"
14 #include "mojo/public/cpp/bindings/strong_binding.h"
16 namespace base {
17 class ScopedTempDir;
18 } // namespace base
20 namespace filesystem {
22 class DirectoryImpl : public Directory {
23 public:
24 // Set |temp_dir| only if there's a temporary directory that should be deleted
25 // when this object is destroyed.
26 DirectoryImpl(mojo::InterfaceRequest<Directory> request,
27 base::FilePath directory_path,
28 scoped_ptr<base::ScopedTempDir> temp_dir);
29 ~DirectoryImpl() override;
31 void set_connection_error_handler(const mojo::Closure& error_handler) {
32 binding_.set_connection_error_handler(error_handler);
35 // |Directory| implementation:
36 void Read(const ReadCallback& callback) override;
37 void OpenFile(const mojo::String& path,
38 mojo::InterfaceRequest<File> file,
39 uint32_t open_flags,
40 const OpenFileCallback& callback) override;
41 void OpenDirectory(const mojo::String& path,
42 mojo::InterfaceRequest<Directory> directory,
43 uint32_t open_flags,
44 const OpenDirectoryCallback& callback) override;
45 void Rename(const mojo::String& path,
46 const mojo::String& new_path,
47 const RenameCallback& callback) override;
48 void Delete(const mojo::String& path,
49 uint32_t delete_flags,
50 const DeleteCallback& callback) override;
51 void Exists(const mojo::String& path,
52 const ExistsCallback& callback) override;
53 void IsWritable(const mojo::String& path,
54 const IsWritableCallback& callback) override;
55 void Flush(const FlushCallback& callback) override;
57 private:
58 mojo::StrongBinding<Directory> binding_;
59 base::FilePath directory_path_;
60 scoped_ptr<base::ScopedTempDir> temp_dir_;
62 DISALLOW_COPY_AND_ASSIGN(DirectoryImpl);
65 } // namespace filesystem
67 #endif // COMPONENTS_FILESYSTEM_DIRECTORY_IMPL_H_