Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_FILE_STREAM_R EADER_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_FILE_STREAM_R EADER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "storage/browser/fileapi/file_stream_reader.h" | |
| 14 | |
| 15 class GURL; | |
| 16 | |
| 17 namespace arc { | |
| 18 | |
| 19 // FileStreamReader implementation for ARC documents provider file system. | |
| 20 // It actually delegates operations to ArcContentFileSystemFileStreamReader. | |
| 21 class ArcDocumentsProviderFileStreamReader : public storage::FileStreamReader { | |
| 22 public: | |
| 23 explicit ArcDocumentsProviderFileStreamReader(int64_t offset); | |
| 24 ~ArcDocumentsProviderFileStreamReader() override; | |
| 25 | |
| 26 // Sets the content URL this reader should read from. | |
| 27 // This function must be called at most once. If an invalid GURL is set, | |
| 28 // all operations will fail with net::ERR_FILE_NOT_FOUND. | |
| 29 void SetContentUrl(const GURL& content_url); | |
| 30 | |
| 31 // Returns a weak pointer that can be dereferenced on the IO thread. | |
| 32 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.
| |
| 33 | |
| 34 // storage::FileStreamReader override: | |
| 35 int Read(net::IOBuffer* buffer, | |
| 36 int buffer_length, | |
| 37 const net::CompletionCallback& callback) override; | |
| 38 int64_t GetLength(const net::Int64CompletionCallback& callback) override; | |
| 39 | |
| 40 private: | |
| 41 const int64_t offset_; | |
| 42 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.
| |
| 43 std::unique_ptr<storage::FileStreamReader> underlying_reader_; | |
| 44 std::vector<base::Closure> pending_operations_; | |
| 45 | |
| 46 base::WeakPtrFactory<ArcDocumentsProviderFileStreamReader> weak_ptr_factory_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(ArcDocumentsProviderFileStreamReader); | |
| 49 }; | |
| 50 | |
| 51 } // namespace arc | |
| 52 | |
| 53 #endif // CHROME_BROWSER_CHROMEOS_ARC_FILEAPI_ARC_DOCUMENTS_PROVIDER_FILE_STREA M_READER_H_ | |
| OLD | NEW |