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..cbaf2ae7d2d08883d4820980bf95e95709c1b643 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,36 @@ IsolatedContext* isolated_context() { |
return IsolatedContext::GetInstance(); |
} |
+#if defined(SUPPORT_MEDIA_FILESYSTEM) |
+MediaDeviceInterfaceImpl* GetDeviceForUrl(const FileSystemURL& url, |
+ FileSystemContext* context) { |
+ |
+ MediaDeviceInterfaceImpl* device = NULL; |
+ FilePath root_path; |
+ if (!isolated_context()->GetRegisteredPath(url.filesystem_id(), &root_path)) |
+ return device; |
+ |
+ // Add the media device if required. |
+ MediaDeviceMapService::GetInstance()->AddMediaDevice( |
+ root_path.value(), context->file_task_runner()); |
+ |
+ MediaDeviceMapService::GetInstance()->GetMediaDevice(root_path.value(), |
+ device); |
kinuko
2012/07/31 05:35:44
Maybe GetMediaDevice() can simply return the devic
kmadhusu
2012/07/31 19:47:24
Done.
|
+ return device; |
+} |
+#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 +109,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 +130,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); |
+ } |
+#endif |
+ |
return new LocalFileSystemOperation(context, operation_context.Pass()); |
} |