Roll src/third_party/WebKit c63b89c:29324ab (svn 202546:202547)
[chromium-blink-merge.git] / components / filesystem / file_impl.h
blob0ca3501e6b2b30c4daf3bfaacc3fadc2be0680dd
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_FILE_IMPL_H_
6 #define COMPONENTS_FILESYSTEM_FILE_IMPL_H_
8 #include "base/files/file.h"
9 #include "base/files/scoped_file.h"
10 #include "base/macros.h"
11 #include "components/filesystem/public/interfaces/directory.mojom.h"
12 #include "mojo/public/cpp/bindings/interface_request.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h"
15 namespace base {
16 class FilePath;
19 namespace filesystem {
21 class FileImpl : public File {
22 public:
23 FileImpl(mojo::InterfaceRequest<File> request,
24 const base::FilePath& path,
25 uint32 flags);
26 FileImpl(mojo::InterfaceRequest<File> request, base::File file);
27 ~FileImpl() override;
29 // |File| implementation:
30 void Close(const CloseCallback& callback) override;
31 void Read(uint32_t num_bytes_to_read,
32 int64_t offset,
33 Whence whence,
34 const ReadCallback& callback) override;
35 void Write(mojo::Array<uint8_t> bytes_to_write,
36 int64_t offset,
37 Whence whence,
38 const WriteCallback& callback) override;
39 void Tell(const TellCallback& callback) override;
40 void Seek(int64_t offset,
41 Whence whence,
42 const SeekCallback& callback) override;
43 void Stat(const StatCallback& callback) override;
44 void Truncate(int64_t size, const TruncateCallback& callback) override;
45 void Touch(TimespecOrNowPtr atime,
46 TimespecOrNowPtr mtime,
47 const TouchCallback& callback) override;
48 void Dup(mojo::InterfaceRequest<File> file,
49 const DupCallback& callback) override;
50 void Flush(const FlushCallback& callback) override;
51 void AsHandle(const AsHandleCallback& callback) override;
53 private:
54 mojo::StrongBinding<File> binding_;
55 base::File file_;
57 DISALLOW_COPY_AND_ASSIGN(FileImpl);
60 } // namespace filesystem
62 #endif // COMPONENTS_FILESYSTEM_FILE_IMPL_H_