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/fileapi/isolated_mount_point_provider.h" | 5 #include "webkit/fileapi/isolated_mount_point_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 namespace fileapi { | 28 namespace fileapi { |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 IsolatedContext* isolated_context() { | 32 IsolatedContext* isolated_context() { |
33 return IsolatedContext::GetInstance(); | 33 return IsolatedContext::GetInstance(); |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 IsolatedMountPointProvider::IsolatedMountPointProvider() | 38 IsolatedMountPointProvider::IsolatedMountPointProvider( |
| 39 base::SequencedTaskRunner* media_task_runner) |
39 : media_path_filter_(new MediaPathFilter()), | 40 : media_path_filter_(new MediaPathFilter()), |
| 41 media_task_runner_(media_task_runner), |
40 isolated_file_util_(new IsolatedFileUtil()), | 42 isolated_file_util_(new IsolatedFileUtil()), |
41 dragged_file_util_(new DraggedFileUtil()), | 43 dragged_file_util_(new DraggedFileUtil()), |
42 native_media_file_util_(new NativeMediaFileUtil()) { | 44 native_media_file_util_(new NativeMediaFileUtil()) { |
43 } | 45 } |
44 | 46 |
45 IsolatedMountPointProvider::~IsolatedMountPointProvider() { | 47 IsolatedMountPointProvider::~IsolatedMountPointProvider() { |
46 } | 48 } |
47 | 49 |
48 void IsolatedMountPointProvider::ValidateFileSystemRoot( | 50 void IsolatedMountPointProvider::ValidateFileSystemRoot( |
49 const GURL& origin_url, | 51 const GURL& origin_url, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return virtual_path; | 108 return virtual_path; |
107 } | 109 } |
108 | 110 |
109 FileSystemOperationInterface* | 111 FileSystemOperationInterface* |
110 IsolatedMountPointProvider::CreateFileSystemOperation( | 112 IsolatedMountPointProvider::CreateFileSystemOperation( |
111 const FileSystemURL& url, | 113 const FileSystemURL& url, |
112 FileSystemContext* context) const { | 114 FileSystemContext* context) const { |
113 scoped_ptr<FileSystemOperationContext> operation_context( | 115 scoped_ptr<FileSystemOperationContext> operation_context( |
114 new FileSystemOperationContext(context)); | 116 new FileSystemOperationContext(context)); |
115 if (url.type() == kFileSystemTypeNativeMedia || | 117 if (url.type() == kFileSystemTypeNativeMedia || |
116 url.type() == kFileSystemTypeDeviceMedia) | 118 url.type() == kFileSystemTypeDeviceMedia) { |
117 operation_context->set_media_path_filter(media_path_filter_.get()); | 119 operation_context->set_media_path_filter(media_path_filter_.get()); |
| 120 operation_context->SetTaskRunner(media_task_runner_.get()); |
| 121 } |
118 return new LocalFileSystemOperation(context, operation_context.Pass()); | 122 return new LocalFileSystemOperation(context, operation_context.Pass()); |
119 } | 123 } |
120 | 124 |
121 webkit_blob::FileStreamReader* | 125 webkit_blob::FileStreamReader* |
122 IsolatedMountPointProvider::CreateFileStreamReader( | 126 IsolatedMountPointProvider::CreateFileStreamReader( |
123 const FileSystemURL& url, | 127 const FileSystemURL& url, |
124 int64 offset, | 128 int64 offset, |
125 FileSystemContext* context) const { | 129 FileSystemContext* context) const { |
126 return new webkit_blob::LocalFileStreamReader( | 130 return new webkit_blob::LocalFileStreamReader( |
127 context->file_task_runner(), url.path(), offset, base::Time()); | 131 context->file_task_runner(), url.path(), offset, base::Time()); |
128 } | 132 } |
129 | 133 |
130 FileStreamWriter* IsolatedMountPointProvider::CreateFileStreamWriter( | 134 FileStreamWriter* IsolatedMountPointProvider::CreateFileStreamWriter( |
131 const FileSystemURL& url, | 135 const FileSystemURL& url, |
132 int64 offset, | 136 int64 offset, |
133 FileSystemContext* context) const { | 137 FileSystemContext* context) const { |
134 return new LocalFileStreamWriter(url.path(), offset); | 138 return new LocalFileStreamWriter(url.path(), offset); |
135 } | 139 } |
136 | 140 |
137 FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() { | 141 FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() { |
138 // No quota support. | 142 // No quota support. |
139 return NULL; | 143 return NULL; |
140 } | 144 } |
141 | 145 |
142 } // namespace fileapi | 146 } // namespace fileapi |
OLD | NEW |