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 35cbcf37e4eecf17250468d64bddaa685911b719..e7ed8ba8d1cf4dd82d93eee4e9b3b5a02faf4618 100644 |
--- a/webkit/fileapi/isolated_mount_point_provider.cc |
+++ b/webkit/fileapi/isolated_mount_point_provider.cc |
@@ -20,6 +20,8 @@ |
#include "webkit/fileapi/file_system_util.h" |
#include "webkit/fileapi/isolated_context.h" |
#include "webkit/fileapi/isolated_file_util.h" |
+#include "webkit/fileapi/media_device_map_service.h" |
+#include "webkit/fileapi/media_file_util.h" |
#include "webkit/fileapi/local_file_stream_writer.h" |
#include "webkit/fileapi/native_file_util.h" |
@@ -41,10 +43,24 @@ FilePath GetPathFromURL(const FileSystemURL& url) { |
return path; |
} |
+bool IsMediaFileSystemURL(const FileSystemURL& url) { |
+// TODO(kmadhusu): Query the SystemMonitor for the URL device type. |
+#if defined(OS_WIN) |
+ FilePath temp = GetPathFromURL(url); |
+ if (temp.empty()) |
+ return false; |
+ FilePath::StringType device_name(temp.value()); |
+ return (!(device_name.substr(0,4)).compare(L"\\\\?\\")); |
+#else |
+ return true; |
+#endif |
kinuko
2012/07/24 19:57:19
We are thinking about a refactoring like following
kmadhusu
2012/07/24 20:56:34
sgtm. Your changes will simplify this CL. I will s
|
+} |
+ |
} // namespace |
IsolatedMountPointProvider::IsolatedMountPointProvider() |
- : isolated_file_util_(new IsolatedFileUtil()) { |
+ : isolated_file_util_(new IsolatedFileUtil()), |
+ media_file_util_(new MediaFileUtil()) { |
} |
IsolatedMountPointProvider::~IsolatedMountPointProvider() { |
@@ -92,7 +108,10 @@ bool IsolatedMountPointProvider::IsRestrictedFileName( |
return false; |
} |
-FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil() { |
+FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( |
+ const FileSystemURL& url) { |
+ if (IsMediaFileSystemURL(url)) |
+ return media_file_util_.get(); |
return isolated_file_util_.get(); |
} |
@@ -109,6 +128,13 @@ FileSystemOperationInterface* |
IsolatedMountPointProvider::CreateFileSystemOperation( |
const FileSystemURL& url, |
FileSystemContext* context) const { |
+ if (IsMediaFileSystemURL(url)) { |
+ FilePath actual_path = GetPathFromURL(url); |
+ if (actual_path.empty()) |
+ return false; |
+ FilePath::StringType device_name(actual_path.value()); |
+ MediaDeviceMapService::GetInstance()->AddMediaDevice(device_name); |
+ } |
return new FileSystemOperation(context); |
} |