Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: services/files/file_impl.h

Issue 875643004: Prototype of Files service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: moar comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "mojo/public/cpp/bindings/interface_request.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h"
12 #include "services/files/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 ReadToStream(ScopedDataPipeProducerHandle source,
34 int64_t offset,
35 Whence whence,
36 int64_t num_bytes_to_read,
37 const Callback<void(Error)>& callback) override;
38 void WriteFromStream(ScopedDataPipeConsumerHandle sink,
39 int64_t offset,
40 Whence whence,
41 const Callback<void(Error)>& callback) override;
42 void Tell(const Callback<void(Error, int64_t)>& callback) override;
43 void Seek(int64_t offset,
44 Whence whence,
45 const Callback<void(Error, int64_t)>& callback) override;
46 void Stat(const Callback<void(Error, FileInformationPtr)>& callback) override;
47 void Truncate(int64_t size, const Callback<void(Error)>& callback) override;
48 void Touch(TimespecOrNowPtr atime,
49 TimespecOrNowPtr mtime,
50 const Callback<void(Error)>& callback) override;
51 void Dup(InterfaceRequest<File> file,
52 const Callback<void(Error)>& callback) override;
53 void Reopen(InterfaceRequest<File> file,
54 uint32_t open_flags,
55 const Callback<void(Error)>& callback) override;
56 void AsBuffer(
57 const Callback<void(Error, ScopedSharedBufferHandle)>& callback) override;
58
59 private:
60 StrongBinding<File> binding_;
61 base::ScopedFD file_fd_;
62
63 DISALLOW_COPY_AND_ASSIGN(FileImpl);
64 };
65
66 } // namespace files
67 } // namespace mojo
68
69 #endif // SERVICES_FILES_FILE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698