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_FILES_FILE_IMPL_H_ |
| 6 #define SERVICES_FILES_FILE_IMPL_H_ |
| 7 |
| 8 #include "base/files/scoped_file.h" |
| 9 #include "base/macros.h" |
| 10 #include "components/filesystem/public/interfaces/directory.mojom.h" |
| 11 #include "mojo/public/cpp/bindings/interface_request.h" |
| 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 13 |
| 14 namespace mojo { |
| 15 namespace files { |
| 16 |
| 17 class FileImpl : public File { |
| 18 public: |
| 19 // TODO(vtl): Will need more for, e.g., |Reopen()|. |
| 20 FileImpl(InterfaceRequest<File> request, base::ScopedFD file_fd); |
| 21 ~FileImpl() override; |
| 22 |
| 23 // |File| implementation: |
| 24 void Close(const CloseCallback& callback) override; |
| 25 void Read(uint32_t num_bytes_to_read, |
| 26 int64_t offset, |
| 27 Whence whence, |
| 28 const ReadCallback& callback) override; |
| 29 void Write(Array<uint8_t> bytes_to_write, |
| 30 int64_t offset, |
| 31 Whence whence, |
| 32 const WriteCallback& callback) override; |
| 33 void ReadToStream(ScopedDataPipeProducerHandle source, |
| 34 int64_t offset, |
| 35 Whence whence, |
| 36 int64_t num_bytes_to_read, |
| 37 const ReadToStreamCallback& callback) override; |
| 38 void WriteFromStream(ScopedDataPipeConsumerHandle sink, |
| 39 int64_t offset, |
| 40 Whence whence, |
| 41 const WriteFromStreamCallback& callback) override; |
| 42 void Tell(const TellCallback& callback) override; |
| 43 void Seek(int64_t offset, |
| 44 Whence whence, |
| 45 const SeekCallback& callback) override; |
| 46 void Stat(const StatCallback& callback) override; |
| 47 void Truncate(int64_t size, const TruncateCallback& callback) override; |
| 48 void Touch(TimespecOrNowPtr atime, |
| 49 TimespecOrNowPtr mtime, |
| 50 const TouchCallback& callback) override; |
| 51 void Dup(InterfaceRequest<File> file, const DupCallback& callback) override; |
| 52 void Reopen(InterfaceRequest<File> file, |
| 53 uint32_t open_flags, |
| 54 const ReopenCallback& callback) override; |
| 55 void AsBuffer(const AsBufferCallback& callback) override; |
| 56 void Ioctl(uint32_t request, |
| 57 Array<uint32_t> in_values, |
| 58 const IoctlCallback& callback) override; |
| 59 |
| 60 private: |
| 61 StrongBinding<File> binding_; |
| 62 base::ScopedFD file_fd_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(FileImpl); |
| 65 }; |
| 66 |
| 67 } // namespace files |
| 68 } // namespace mojo |
| 69 |
| 70 #endif // SERVICES_FILES_FILE_IMPL_H_ |
OLD | NEW |