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

Unified Diff: webkit/fileapi/isolated_mount_point_provider.cc

Issue 10781014: Isolated FS for media devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix shared_build compile error. Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
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..321b83107d078ad462345e751db4c05a317f2caf 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,35 @@ IsolatedContext* isolated_context() {
return IsolatedContext::GetInstance();
}
+#if defined(SUPPORT_MEDIA_FILESYSTEM)
+bool GetDeviceForUrl(const FileSystemURL& url,
+ FileSystemContext* context,
+ scoped_refptr<MediaDeviceInterfaceImpl>* device) {
kinuko 2012/07/30 23:19:03 This might be a minor coding-taste issue, but mayb
kmadhusu 2012/07/31 01:17:48 As we discussed, I changed this function signature
+
+ FilePath root_path;
+ if (!isolated_context()->GetRegisteredPath(url.filesystem_id(), &root_path))
+ return false;
+
+ // Add the media device if required.
+ MediaDeviceMapService::GetInstance()->AddMediaDevice(
+ root_path.value(), context->file_task_runner());
+
+ return MediaDeviceMapService::GetInstance()->GetMediaDevice(root_path.value(),
+ 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 +108,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 +129,15 @@ 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;
+ if (GetDeviceForUrl(url, context, &device))
+ operation_context->set_media_device(device);
+ }
+#endif
+
return new LocalFileSystemOperation(context, operation_context.Pass());
}

Powered by Google App Engine
This is Rietveld 408576698