| 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();
|
| +
|
| + // 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_;
|
| + 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_
|
|
|