Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_de legate.h" | 5 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_backend_de legate.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | |
| 7 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file _util.h" | 8 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file _util.h" |
| 8 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_strea m_reader.h" | 9 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_file_strea m_reader.h" |
| 10 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h " | |
| 9 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 10 #include "storage/browser/fileapi/file_stream_writer.h" | 12 #include "storage/browser/fileapi/file_stream_writer.h" |
| 11 #include "storage/browser/fileapi/file_system_url.h" | 13 #include "storage/browser/fileapi/file_system_url.h" |
| 12 | 14 |
| 13 namespace arc { | 15 namespace arc { |
| 14 | 16 |
| 15 ArcContentFileSystemBackendDelegate::ArcContentFileSystemBackendDelegate() | 17 ArcContentFileSystemBackendDelegate::ArcContentFileSystemBackendDelegate() |
| 16 : async_file_util_(new ArcContentFileSystemAsyncFileUtil()) {} | 18 : async_file_util_(new ArcContentFileSystemAsyncFileUtil()) {} |
| 17 | 19 |
| 18 ArcContentFileSystemBackendDelegate::~ArcContentFileSystemBackendDelegate() = | 20 ArcContentFileSystemBackendDelegate::~ArcContentFileSystemBackendDelegate() = |
| 19 default; | 21 default; |
| 20 | 22 |
| 21 storage::AsyncFileUtil* ArcContentFileSystemBackendDelegate::GetAsyncFileUtil( | 23 storage::AsyncFileUtil* ArcContentFileSystemBackendDelegate::GetAsyncFileUtil( |
| 22 storage::FileSystemType type) { | 24 storage::FileSystemType type) { |
| 23 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 25 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 24 DCHECK_EQ(storage::kFileSystemTypeArcContent, type); | 26 DCHECK_EQ(storage::kFileSystemTypeArcContent, type); |
| 25 return async_file_util_.get(); | 27 return async_file_util_.get(); |
| 26 } | 28 } |
| 27 | 29 |
| 28 std::unique_ptr<storage::FileStreamReader> | 30 std::unique_ptr<storage::FileStreamReader> |
| 29 ArcContentFileSystemBackendDelegate::CreateFileStreamReader( | 31 ArcContentFileSystemBackendDelegate::CreateFileStreamReader( |
| 30 const storage::FileSystemURL& url, | 32 const storage::FileSystemURL& url, |
| 31 int64_t offset, | 33 int64_t offset, |
| 32 int64_t max_bytes_to_read, | 34 int64_t max_bytes_to_read, |
| 33 const base::Time& expected_modification_time, | 35 const base::Time& expected_modification_time, |
| 34 storage::FileSystemContext* context) { | 36 storage::FileSystemContext* context) { |
| 35 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 37 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 36 DCHECK_EQ(storage::kFileSystemTypeArcContent, url.type()); | 38 DCHECK_EQ(storage::kFileSystemTypeArcContent, url.type()); |
| 37 return std::unique_ptr<storage::FileStreamReader>( | 39 GURL arc_url = FileSystemUrlToArcUrl(url); |
| 38 new ArcContentFileSystemFileStreamReader(url, offset, max_bytes_to_read)); | 40 return base::MakeUnique<ArcContentFileSystemFileStreamReader>(arc_url, |
|
hidehiko
2016/11/10 07:07:06
max_bytes_to_read gets ignored now.
According to:
hashimoto
2016/11/11 22:30:17
IIUC implementations MAY use max_bytes_to_read to
hidehiko
2016/11/14 17:46:34
Good to know. Thanks.
| |
| 41 offset); | |
| 39 } | 42 } |
| 40 | 43 |
| 41 std::unique_ptr<storage::FileStreamWriter> | 44 std::unique_ptr<storage::FileStreamWriter> |
| 42 ArcContentFileSystemBackendDelegate::CreateFileStreamWriter( | 45 ArcContentFileSystemBackendDelegate::CreateFileStreamWriter( |
| 43 const storage::FileSystemURL& url, | 46 const storage::FileSystemURL& url, |
| 44 int64_t offset, | 47 int64_t offset, |
| 45 storage::FileSystemContext* context) { | 48 storage::FileSystemContext* context) { |
| 46 NOTIMPLEMENTED(); | 49 NOTIMPLEMENTED(); |
| 47 return std::unique_ptr<storage::FileStreamWriter>(); | 50 return std::unique_ptr<storage::FileStreamWriter>(); |
| 48 } | 51 } |
| 49 | 52 |
| 50 storage::WatcherManager* ArcContentFileSystemBackendDelegate::GetWatcherManager( | 53 storage::WatcherManager* ArcContentFileSystemBackendDelegate::GetWatcherManager( |
| 51 storage::FileSystemType type) { | 54 storage::FileSystemType type) { |
| 52 NOTIMPLEMENTED(); | 55 NOTIMPLEMENTED(); |
| 53 return nullptr; | 56 return nullptr; |
| 54 } | 57 } |
| 55 | 58 |
| 56 void ArcContentFileSystemBackendDelegate::GetRedirectURLForContents( | 59 void ArcContentFileSystemBackendDelegate::GetRedirectURLForContents( |
| 57 const storage::FileSystemURL& url, | 60 const storage::FileSystemURL& url, |
| 58 const storage::URLCallback& callback) { | 61 const storage::URLCallback& callback) { |
| 59 NOTIMPLEMENTED(); | 62 NOTIMPLEMENTED(); |
| 60 } | 63 } |
| 61 | 64 |
| 62 } // namespace arc | 65 } // namespace arc |
| OLD | NEW |