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

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

Issue 2580713004: mediaview: Implement ArcDocumentsProviderBackendDelegate. (Closed)
Patch Set: Removed unused #include. 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..777c13140c6e909d414b64931918765102eea33f
--- /dev/null
+++ b/chrome/browser/chromeos/arc/fileapi/arc_documents_provider_file_stream_reader.h
@@ -0,0 +1,53 @@
+// 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/weak_ptr.h"
+#include "storage/browser/fileapi/file_stream_reader.h"
+
+class GURL;
+
+namespace arc {
+
+// FileStreamReader implementation for ARC documents provider file system.
+// It actually delegates operations to ArcContentFileSystemFileStreamReader.
+class ArcDocumentsProviderFileStreamReader : public storage::FileStreamReader {
+ public:
+ explicit ArcDocumentsProviderFileStreamReader(int64_t offset);
+ ~ArcDocumentsProviderFileStreamReader() override;
+
+ // Sets the content URL this reader should read from.
+ // This function must be called at most once. If an invalid GURL is set,
+ // all operations will fail with net::ERR_FILE_NOT_FOUND.
+ void SetContentUrl(const GURL& content_url);
+
+ // Returns a weak pointer that can be dereferenced on the IO thread.
+ base::WeakPtr<ArcDocumentsProviderFileStreamReader> GetWeakPtr();
hashimoto 2017/01/05 09:21:22 How about calling ParseAndLookup() and ArcDocument
Shuhei Takahashi 2017/01/05 11:08:28 Sounds good.
+
+ // 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:
+ const int64_t offset_;
+ bool resolved_;
hashimoto 2017/01/05 09:21:22 What "resolve" means is not clear from just lookin
Shuhei Takahashi 2017/01/05 11:08:28 renamed to 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