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

Unified Diff: services/file_manager/file_impl.h

Issue 875643004: Prototype of Files service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: wipwipwip Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: services/file_manager/file_impl.h
diff --git a/services/file_manager/file_impl.h b/services/file_manager/file_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..bab064e8f2a82f1d6ac5c15e9d68c976d966c6a0
--- /dev/null
+++ b/services/file_manager/file_impl.h
@@ -0,0 +1,68 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_FILE_MANAGER_FILE_IMPL_H_
+#define SERVICES_FILE_MANAGER_FILE_IMPL_H_
+
+#include "base/files/scoped_file.h"
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "services/file_manager/directory.mojom.h"
+
+namespace mojo {
+namespace files {
+
+class FileImpl : public File {
+ public:
+ // TODO(vtl): Will need more for, e.g., |Reopen()|.
+ FileImpl(InterfaceRequest<File> request, base::ScopedFD file_fd);
+ ~FileImpl() override;
+
+ // |File| implementation:
+ void Close(const Callback<void(Error)>& callback) override;
+ void Read(uint32_t num_bytes_to_read,
+ int64_t offset,
+ Whence whence,
+ const Callback<void(Error, Array<uint8_t>)>& callback) override;
+ void Write(Array<uint8_t> bytes_to_write,
+ int64_t offset,
+ Whence whence,
+ const Callback<void(Error, uint32_t)>& callback) override;
+ void ReadStream(ScopedDataPipeProducerHandle source,
+ int64_t offset,
+ Whence whence,
+ const Callback<void(Error)>& callback) override;
+ void WriteStream(ScopedDataPipeConsumerHandle sink,
+ int64_t offset,
+ Whence whence,
+ const Callback<void(Error)>& callback) override;
+ void Tell(const Callback<void(Error, int64_t)>& callback) override;
+ void Seek(int64_t offset,
+ Whence whence,
+ const Callback<void(Error, int64_t)>& callback) override;
+ void Stat(const Callback<void(Error, FileInformationPtr)>& callback) override;
+ void Truncate(int64_t size, const Callback<void(Error)>& callback) override;
+ void Touch(FileTimesPtr times,
+ const Callback<void(Error)>& callback) override;
+ void Dup(InterfaceRequest<File> file,
+ const Callback<void(Error)>& callback) override;
+ void Reopen(InterfaceRequest<File> file,
+ uint32_t access_flags,
+ uint32_t open_flags,
+ const Callback<void(Error)>& callback) override;
+ void AsBuffer(
+ const Callback<void(Error, ScopedSharedBufferHandle)>& callback) override;
+
+ private:
+ StrongBinding<File> binding_;
+ base::ScopedFD file_fd_;
+
+ DISALLOW_COPY_AND_ASSIGN(FileImpl);
+};
+
+} // namespace files
+} // namespace mojo
+
+#endif // SERVICES_FILE_MANAGER_FILE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698