OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 #include "chrome/browser/chromeos/fileapi/mtp_file_system_backend_delegate.h" | |
6 #include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h" | |
7 #include "webkit/browser/blob/file_stream_reader.h" | |
8 #include "webkit/browser/fileapi/file_stream_writer.h" | |
9 | |
10 namespace chromeos { | |
11 | |
12 MTPFileSystemBackendDelegate::MTPFileSystemBackendDelegate( | |
13 const base::FilePath& storage_partition_path) | |
14 : device_media_async_file_util_( | |
15 DeviceMediaAsyncFileUtil::Create(storage_partition_path)) { | |
16 } | |
17 | |
18 MTPFileSystemBackendDelegate::~MTPFileSystemBackendDelegate() { | |
19 } | |
20 | |
21 fileapi::AsyncFileUtil* MTPFileSystemBackendDelegate::GetAsyncFileUtil( | |
22 fileapi::FileSystemType type) { | |
23 return device_media_async_file_util_.get(); | |
mtomasz
2014/04/24 01:41:42
nit: How about a DCHECK for a type as in https://c
kinaba
2014/04/24 01:52:34
Done.
| |
24 } | |
25 | |
26 scoped_ptr<webkit_blob::FileStreamReader> | |
27 MTPFileSystemBackendDelegate::CreateFileStreamReader( | |
28 const fileapi::FileSystemURL& url, | |
29 int64 offset, | |
30 const base::Time& expected_modification_time, | |
31 fileapi::FileSystemContext* context) { | |
32 // TODO(kinaba): Returned MediaFileStreamReader verifies file header and | |
33 // stops reading if the stream does not represent a media file. We might | |
34 // want to remove the verification here since we want to mount MTP devices | |
35 // as normal file storage in Chrome OS file manager. | |
36 return device_media_async_file_util_->GetFileStreamReader( | |
37 url, offset, expected_modification_time, context); | |
38 } | |
39 | |
40 scoped_ptr<fileapi::FileStreamWriter> | |
41 MTPFileSystemBackendDelegate::CreateFileStreamWriter( | |
42 const fileapi::FileSystemURL& url, | |
43 int64 offset, | |
44 fileapi::FileSystemContext* context) { | |
45 // TODO(kinaba): support writing. | |
46 return scoped_ptr<fileapi::FileStreamWriter>(); | |
47 } | |
48 | |
49 } // namespace chromeos | |
OLD | NEW |