Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: webkit/fileapi/isolated_mount_point_provider.cc

Issue 14341004: FileAPI code should not rely on or assume specific MountPointProvider types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 18 matching lines...) Expand all
29 #include "webkit/fileapi/media/media_path_filter.h" 29 #include "webkit/fileapi/media/media_path_filter.h"
30 #include "webkit/fileapi/media/native_media_file_util.h" 30 #include "webkit/fileapi/media/native_media_file_util.h"
31 #include "webkit/fileapi/native_file_util.h" 31 #include "webkit/fileapi/native_file_util.h"
32 32
33 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 33 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
34 #include "webkit/fileapi/media/device_media_async_file_util.h" 34 #include "webkit/fileapi/media/device_media_async_file_util.h"
35 #endif 35 #endif
36 36
37 namespace fileapi { 37 namespace fileapi {
38 38
39 const char IsolatedMountPointProvider::kMediaPathFilterKey[] =
40 "MediaPathFilterKey";
41 const char IsolatedMountPointProvider::kMTPDeviceDelegateURLKey[] =
42 "MTPDeviceDelegateKey";
43
39 IsolatedMountPointProvider::IsolatedMountPointProvider( 44 IsolatedMountPointProvider::IsolatedMountPointProvider(
40 const base::FilePath& profile_path) 45 const base::FilePath& profile_path)
41 : profile_path_(profile_path), 46 : profile_path_(profile_path),
42 media_path_filter_(new MediaPathFilter()), 47 media_path_filter_(new MediaPathFilter()),
43 isolated_file_util_(new AsyncFileUtilAdapter(new IsolatedFileUtil())), 48 isolated_file_util_(new AsyncFileUtilAdapter(new IsolatedFileUtil())),
44 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())), 49 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())),
45 native_media_file_util_( 50 native_media_file_util_(
46 new AsyncFileUtilAdapter(new NativeMediaFileUtil())) { 51 new AsyncFileUtilAdapter(new NativeMediaFileUtil())) {
47 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 52 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
48 // TODO(kmadhusu): Initialize |device_media_file_util_| in 53 // TODO(kmadhusu): Initialize |device_media_file_util_| in
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 179 }
175 // Access to isolated file systems should be checked using per-filesystem 180 // Access to isolated file systems should be checked using per-filesystem
176 // access permission. 181 // access permission.
177 return FILE_PERMISSION_USE_FILESYSTEM_PERMISSION; 182 return FILE_PERMISSION_USE_FILESYSTEM_PERMISSION;
178 } 183 }
179 184
180 FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation( 185 FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation(
181 const FileSystemURL& url, 186 const FileSystemURL& url,
182 FileSystemContext* context, 187 FileSystemContext* context,
183 base::PlatformFileError* error_code) const { 188 base::PlatformFileError* error_code) const {
184 scoped_ptr<FileSystemOperationContext> operation_context( 189 if (url.type() != kFileSystemTypeNativeMedia &&
185 new FileSystemOperationContext(context)); 190 url.type() != kFileSystemTypeDeviceMedia) {
186 if (url.type() == kFileSystemTypeNativeMedia || 191 return new LocalFileSystemOperation(
187 url.type() == kFileSystemTypeDeviceMedia) { 192 context, make_scoped_ptr(new FileSystemOperationContext(context)));
188 operation_context->set_media_path_filter(media_path_filter_.get());
189 operation_context->set_task_runner(
190 context->task_runners()->media_task_runner());
191 } 193 }
192 194
195 // For media filesystems.
196 scoped_ptr<FileSystemOperationContext> operation_context(
197 new FileSystemOperationContext(
198 context, context->task_runners()->media_task_runner()));
199
200 operation_context->SetUserValue(kMediaPathFilterKey,
201 media_path_filter_.get());
202
193 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 203 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
194 if (url.type() == kFileSystemTypeDeviceMedia) 204 if (url.type() == kFileSystemTypeDeviceMedia) {
195 operation_context->set_mtp_device_delegate_url(url.filesystem_id()); 205 operation_context->SetUserValue(kMTPDeviceDelegateURLKey,
206 url.filesystem_id());
207 }
196 #endif 208 #endif
197 209
198 return new LocalFileSystemOperation(context, operation_context.Pass()); 210 return new LocalFileSystemOperation(context, operation_context.Pass());
199 } 211 }
200 212
201 scoped_ptr<webkit_blob::FileStreamReader> 213 scoped_ptr<webkit_blob::FileStreamReader>
202 IsolatedMountPointProvider::CreateFileStreamReader( 214 IsolatedMountPointProvider::CreateFileStreamReader(
203 const FileSystemURL& url, 215 const FileSystemURL& url,
204 int64 offset, 216 int64 offset,
205 const base::Time& expected_modification_time, 217 const base::Time& expected_modification_time,
(...skipping 20 matching lines...) Expand all
226 void IsolatedMountPointProvider::DeleteFileSystem( 238 void IsolatedMountPointProvider::DeleteFileSystem(
227 const GURL& origin_url, 239 const GURL& origin_url,
228 FileSystemType type, 240 FileSystemType type,
229 FileSystemContext* context, 241 FileSystemContext* context,
230 const DeleteFileSystemCallback& callback) { 242 const DeleteFileSystemCallback& callback) {
231 NOTREACHED(); 243 NOTREACHED();
232 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); 244 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
233 } 245 }
234 246
235 } // namespace fileapi 247 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/isolated_mount_point_provider.h ('k') | webkit/fileapi/local_file_system_operation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698