OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/browser/fileapi/isolated_file_system_backend.h" | 5 #include "webkit/browser/fileapi/isolated_file_system_backend.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util_proxy.h" | 11 #include "base/files/file_util_proxy.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop/message_loop_proxy.h" | 13 #include "base/message_loop/message_loop_proxy.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "webkit/browser/blob/file_stream_reader.h" | 15 #include "webkit/browser/blob/file_stream_reader.h" |
16 #include "webkit/browser/fileapi/async_file_util_adapter.h" | 16 #include "webkit/browser/fileapi/async_file_util_adapter.h" |
17 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | 17 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
18 #include "webkit/browser/fileapi/dragged_file_util.h" | 18 #include "webkit/browser/fileapi/dragged_file_util.h" |
19 #include "webkit/browser/fileapi/file_stream_writer.h" | 19 #include "webkit/browser/fileapi/file_stream_writer.h" |
20 #include "webkit/browser/fileapi/file_system_context.h" | 20 #include "webkit/browser/fileapi/file_system_context.h" |
21 #include "webkit/browser/fileapi/file_system_operation.h" | 21 #include "webkit/browser/fileapi/file_system_operation.h" |
22 #include "webkit/browser/fileapi/file_system_operation_context.h" | 22 #include "webkit/browser/fileapi/file_system_operation_context.h" |
23 #include "webkit/browser/fileapi/isolated_context.h" | 23 #include "webkit/browser/fileapi/isolated_context.h" |
24 #include "webkit/browser/fileapi/native_file_util.h" | 24 #include "webkit/browser/fileapi/native_file_util.h" |
25 #include "webkit/browser/fileapi/transient_file_util.h" | 25 #include "webkit/browser/fileapi/transient_file_util.h" |
26 #include "webkit/common/fileapi/file_system_types.h" | 26 #include "webkit/common/fileapi/file_system_types.h" |
27 #include "webkit/common/fileapi/file_system_util.h" | 27 #include "webkit/common/fileapi/file_system_util.h" |
28 | 28 |
29 namespace fileapi { | 29 namespace storage { |
30 | 30 |
31 IsolatedFileSystemBackend::IsolatedFileSystemBackend() | 31 IsolatedFileSystemBackend::IsolatedFileSystemBackend() |
32 : isolated_file_util_(new AsyncFileUtilAdapter(new LocalFileUtil())), | 32 : isolated_file_util_(new AsyncFileUtilAdapter(new LocalFileUtil())), |
33 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())), | 33 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())), |
34 transient_file_util_(new AsyncFileUtilAdapter(new TransientFileUtil())) { | 34 transient_file_util_(new AsyncFileUtilAdapter(new TransientFileUtil())) { |
35 } | 35 } |
36 | 36 |
37 IsolatedFileSystemBackend::~IsolatedFileSystemBackend() { | 37 IsolatedFileSystemBackend::~IsolatedFileSystemBackend() { |
38 } | 38 } |
39 | 39 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 FileSystemOperation* IsolatedFileSystemBackend::CreateFileSystemOperation( | 95 FileSystemOperation* IsolatedFileSystemBackend::CreateFileSystemOperation( |
96 const FileSystemURL& url, | 96 const FileSystemURL& url, |
97 FileSystemContext* context, | 97 FileSystemContext* context, |
98 base::File::Error* error_code) const { | 98 base::File::Error* error_code) const { |
99 return FileSystemOperation::Create( | 99 return FileSystemOperation::Create( |
100 url, context, make_scoped_ptr(new FileSystemOperationContext(context))); | 100 url, context, make_scoped_ptr(new FileSystemOperationContext(context))); |
101 } | 101 } |
102 | 102 |
103 bool IsolatedFileSystemBackend::SupportsStreaming( | 103 bool IsolatedFileSystemBackend::SupportsStreaming( |
104 const fileapi::FileSystemURL& url) const { | 104 const storage::FileSystemURL& url) const { |
105 return false; | 105 return false; |
106 } | 106 } |
107 | 107 |
108 bool IsolatedFileSystemBackend::HasInplaceCopyImplementation( | 108 bool IsolatedFileSystemBackend::HasInplaceCopyImplementation( |
109 fileapi::FileSystemType type) const { | 109 storage::FileSystemType type) const { |
110 DCHECK(type == kFileSystemTypeNativeLocal || type == kFileSystemTypeDragged || | 110 DCHECK(type == kFileSystemTypeNativeLocal || type == kFileSystemTypeDragged || |
111 type == kFileSystemTypeForTransientFile); | 111 type == kFileSystemTypeForTransientFile); |
112 return false; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 scoped_ptr<webkit_blob::FileStreamReader> | 115 scoped_ptr<storage::FileStreamReader> |
116 IsolatedFileSystemBackend::CreateFileStreamReader( | 116 IsolatedFileSystemBackend::CreateFileStreamReader( |
117 const FileSystemURL& url, | 117 const FileSystemURL& url, |
118 int64 offset, | 118 int64 offset, |
119 const base::Time& expected_modification_time, | 119 const base::Time& expected_modification_time, |
120 FileSystemContext* context) const { | 120 FileSystemContext* context) const { |
121 return scoped_ptr<webkit_blob::FileStreamReader>( | 121 return scoped_ptr<storage::FileStreamReader>( |
122 webkit_blob::FileStreamReader::CreateForLocalFile( | 122 storage::FileStreamReader::CreateForLocalFile( |
123 context->default_file_task_runner(), | 123 context->default_file_task_runner(), |
124 url.path(), offset, expected_modification_time)); | 124 url.path(), |
| 125 offset, |
| 126 expected_modification_time)); |
125 } | 127 } |
126 | 128 |
127 scoped_ptr<FileStreamWriter> IsolatedFileSystemBackend::CreateFileStreamWriter( | 129 scoped_ptr<FileStreamWriter> IsolatedFileSystemBackend::CreateFileStreamWriter( |
128 const FileSystemURL& url, | 130 const FileSystemURL& url, |
129 int64 offset, | 131 int64 offset, |
130 FileSystemContext* context) const { | 132 FileSystemContext* context) const { |
131 return scoped_ptr<FileStreamWriter>( | 133 return scoped_ptr<FileStreamWriter>( |
132 FileStreamWriter::CreateForLocalFile( | 134 FileStreamWriter::CreateForLocalFile( |
133 context->default_file_task_runner(), | 135 context->default_file_task_runner(), |
134 url.path(), | 136 url.path(), |
135 offset, | 137 offset, |
136 FileStreamWriter::OPEN_EXISTING_FILE)); | 138 FileStreamWriter::OPEN_EXISTING_FILE)); |
137 } | 139 } |
138 | 140 |
139 FileSystemQuotaUtil* IsolatedFileSystemBackend::GetQuotaUtil() { | 141 FileSystemQuotaUtil* IsolatedFileSystemBackend::GetQuotaUtil() { |
140 // No quota support. | 142 // No quota support. |
141 return NULL; | 143 return NULL; |
142 } | 144 } |
143 | 145 |
144 } // namespace fileapi | 146 } // namespace storage |
OLD | NEW |