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

Unified Diff: chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h

Issue 2580713004: mediaview: Implement ArcDocumentsProviderBackendDelegate. (Closed)
Patch Set: Addressed hashimoto's comments. Created 3 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: chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h
new file mode 100644
index 0000000000000000000000000000000000000000..43abe7087ca6920b61a45f07f88e238eba0c531b
--- /dev/null
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h
@@ -0,0 +1,63 @@
+// Copyright 2016 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 CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_FILE_STREAM_READER_H_
+#define CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_FILE_STREAM_READER_H_
+
+#include <memory>
+#include <vector>
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "storage/browser/fileapi/file_stream_reader.h"
+
+class GURL;
+
+namespace storage {
+
+class FileSystemURL;
+
+} // namespace storage
+
+namespace arc {
+
+class ArcDocumentsProviderRootMap;
+
+// FileStreamReader implementation for ARC documents provider file system.
+// It actually delegates operations to ArcContentFileSystemFileStreamReader.
+class ArcDocumentsProviderFileStreamReader : public storage::FileStreamReader {
hashimoto 2017/01/06 04:16:51 It'd be nice to have a test for this class (not ne
Shuhei Takahashi 2017/01/06 05:38:10 Sure, added a TODO.
+ public:
+ // |roots| can be released soon after the constructor returns.
+ ArcDocumentsProviderFileStreamReader(const storage::FileSystemURL& url,
+ int64_t offset,
+ ArcDocumentsProviderRootMap* roots);
+ ~ArcDocumentsProviderFileStreamReader() override;
+
+ // storage::FileStreamReader override:
+ int Read(net::IOBuffer* buffer,
+ int buffer_length,
+ const net::CompletionCallback& callback) override;
+ int64_t GetLength(const net::Int64CompletionCallback& callback) override;
+
+ private:
+ void OnResolveToContentUrl(const GURL& content_url);
+ void RunPendingRead(scoped_refptr<net::IOBuffer> buffer,
+ int buffer_length,
+ const net::CompletionCallback& callback);
+ void RunPendingGetLength(const net::Int64CompletionCallback& callback);
+
+ const int64_t offset_;
+ bool content_url_resolved_;
+ std::unique_ptr<storage::FileStreamReader> underlying_reader_;
+ std::vector<base::Closure> pending_operations_;
+
+ base::WeakPtrFactory<ArcDocumentsProviderFileStreamReader> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderFileStreamReader);
+};
+
+} // namespace arc
+
+#endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_FILE_STREAM_READER_H_

Powered by Google App Engine
This is Rietveld 408576698