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_FILE_MANAGER_FILE_IMPL_H_ |
| 6 #define SERVICES_FILE_MANAGER_FILE_IMPL_H_ |
| 7 |
| 8 #include "base/files/scoped_file.h" |
| 9 #include "base/macros.h" |
| 10 #include "mojo/public/cpp/bindings/interface_request.h" |
| 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 12 #include "services/file_manager/directory.mojom.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 Callback<void(Error)>& callback) override; |
| 25 void Read(uint32_t num_bytes_to_read, |
| 26 int64_t offset, |
| 27 Whence whence, |
| 28 const Callback<void(Error, Array<uint8_t>)>& callback) override; |
| 29 void Write(Array<uint8_t> bytes_to_write, |
| 30 int64_t offset, |
| 31 Whence whence, |
| 32 const Callback<void(Error, uint32_t)>& callback) override; |
| 33 void ReadStream(ScopedDataPipeProducerHandle source, |
| 34 int64_t offset, |
| 35 Whence whence, |
| 36 const Callback<void(Error)>& callback) override; |
| 37 void WriteStream(ScopedDataPipeConsumerHandle sink, |
| 38 int64_t offset, |
| 39 Whence whence, |
| 40 const Callback<void(Error)>& callback) override; |
| 41 void Tell(const Callback<void(Error, int64_t)>& callback) override; |
| 42 void Seek(int64_t offset, |
| 43 Whence whence, |
| 44 const Callback<void(Error, int64_t)>& callback) override; |
| 45 void Stat(const Callback<void(Error, FileInformationPtr)>& callback) override; |
| 46 void Truncate(int64_t size, const Callback<void(Error)>& callback) override; |
| 47 void Touch(FileTimesPtr times, |
| 48 const Callback<void(Error)>& callback) override; |
| 49 void Dup(InterfaceRequest<File> file, |
| 50 const Callback<void(Error)>& callback) override; |
| 51 void Reopen(InterfaceRequest<File> file, |
| 52 uint32_t access_flags, |
| 53 uint32_t open_flags, |
| 54 const Callback<void(Error)>& callback) override; |
| 55 void AsBuffer( |
| 56 const Callback<void(Error, ScopedSharedBufferHandle)>& callback) override; |
| 57 |
| 58 private: |
| 59 StrongBinding<File> binding_; |
| 60 base::ScopedFD file_fd_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(FileImpl); |
| 63 }; |
| 64 |
| 65 } // namespace files |
| 66 } // namespace mojo |
| 67 |
| 68 #endif // SERVICES_FILE_MANAGER_FILE_IMPL_H_ |
OLD | NEW |