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

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: Addressed review comments 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..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());
}

Powered by Google App Engine
This is Rietveld 408576698