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"
19 namespace filesystem
{
21 class FileImpl
: public File
{
23 FileImpl(mojo::InterfaceRequest
<File
> request
,
24 const base::FilePath
& path
,
26 FileImpl(mojo::InterfaceRequest
<File
> request
, base::File file
);
29 // |File| implementation:
30 void Close(const CloseCallback
& callback
) override
;
31 void Read(uint32_t num_bytes_to_read
,
34 const ReadCallback
& callback
) override
;
35 void Write(mojo::Array
<uint8_t> bytes_to_write
,
38 const WriteCallback
& callback
) override
;
39 void Tell(const TellCallback
& callback
) override
;
40 void Seek(int64_t offset
,
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
;
54 mojo::StrongBinding
<File
> binding_
;
57 DISALLOW_COPY_AND_ASSIGN(FileImpl
);
60 } // namespace filesystem
62 #endif // COMPONENTS_FILESYSTEM_FILE_IMPL_H_