Index: webkit/fileapi/isolated_mount_point_provider.cc |
diff --git a/webkit/fileapi/isolated_mount_point_provider.cc b/webkit/fileapi/isolated_mount_point_provider.cc |
index a8875a0b670ea2abc0ec462869e84ab36449890a..028ca9f5c9f8a5d47d09e35e00ef7fbbd070996e 100644 |
--- a/webkit/fileapi/isolated_mount_point_provider.cc |
+++ b/webkit/fileapi/isolated_mount_point_provider.cc |
@@ -21,8 +21,14 @@ |
#include "webkit/fileapi/isolated_file_util.h" |
#include "webkit/fileapi/local_file_stream_writer.h" |
#include "webkit/fileapi/local_file_system_operation.h" |
+#include "webkit/fileapi/media/media_file_system_config.h" |
#include "webkit/fileapi/native_file_util.h" |
+#if defined(SUPPORT_MEDIA_FILESYSTEM) |
+#include "webkit/fileapi/media/device_media_file_util.h" |
+#include "webkit/fileapi/media/media_device_map_service.h" |
+#endif |
+ |
namespace fileapi { |
namespace { |
@@ -31,11 +37,34 @@ IsolatedContext* isolated_context() { |
return IsolatedContext::GetInstance(); |
} |
+#if defined(SUPPORT_MEDIA_FILESYSTEM) |
+MediaDeviceInterfaceImpl* GetDeviceForUrl(const FileSystemURL& url, |
+ FileSystemContext* context) { |
+ |
Lei Zhang
2012/07/31 20:04:37
nit: blank line
kmadhusu
2012/08/01 01:43:59
Done.
|
+ FilePath root_path; |
+ if (!isolated_context()->GetRegisteredPath(url.filesystem_id(), &root_path)) |
+ return NULL; |
+ |
+ // Add the media device if required. |
+ MediaDeviceMapService::GetInstance()->MaybeAddMediaDevice( |
+ root_path.value(), context->file_task_runner()); |
+ |
+ return MediaDeviceMapService::GetInstance()->GetMediaDevice( |
+ root_path.value()); |
+} |
+#endif |
+ |
} // namespace |
-IsolatedMountPointProvider::IsolatedMountPointProvider() |
- : isolated_file_util_(new IsolatedFileUtil()), |
+IsolatedMountPointProvider::IsolatedMountPointProvider( |
+ const FilePath& profile_path) |
+ : profile_path_(profile_path), |
+ isolated_file_util_(new IsolatedFileUtil()), |
dragged_file_util_(new DraggedFileUtil()) { |
+ // TODO(kmadhusu): Initialize device_media_file_util_ in initialization list. |
+#if defined(SUPPORT_MEDIA_FILESYSTEM) |
+ device_media_file_util_.reset(new DeviceMediaFileUtil(profile_path_)); |
+#endif |
} |
IsolatedMountPointProvider::~IsolatedMountPointProvider() { |
@@ -78,6 +107,10 @@ FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( |
FileSystemType type) { |
if (type == kFileSystemTypeDragged) |
return dragged_file_util_.get(); |
+#if defined(SUPPORT_MEDIA_FILESYSTEM) |
+ else if (type == kFileSystemTypeDeviceMedia) |
+ return device_media_file_util_.get(); |
+#endif |
else |
return isolated_file_util_.get(); |
} |
@@ -95,6 +128,16 @@ IsolatedMountPointProvider::CreateFileSystemOperation( |
FileSystemContext* context) const { |
scoped_ptr<FileSystemOperationContext> operation_context( |
new FileSystemOperationContext(context)); |
+ |
+#if defined(SUPPORT_MEDIA_FILESYSTEM) |
+ if (url.type() == kFileSystemTypeDeviceMedia) { |
+ scoped_refptr<MediaDeviceInterfaceImpl> device(GetDeviceForUrl(url, |
+ context)); |
+ if (device.get()) |
+ operation_context->set_media_device(device); |
kinuko
2012/07/31 20:32:31
nit: Could this be null? Should we DCHECK?
kmadhusu
2012/08/01 01:43:59
Yes, it can be null. As we discussed, I am leaving
|
+ } |
+#endif |
+ |
return new LocalFileSystemOperation(context, operation_context.Pass()); |
} |