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

Unified Diff: webkit/fileapi/media/media_file_system_mount_point_provider.cc

Issue 14352004: Split Media-related code from IsolatedMountPointProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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/media/media_file_system_mount_point_provider.cc
diff --git a/webkit/fileapi/isolated_mount_point_provider.cc b/webkit/fileapi/media/media_file_system_mount_point_provider.cc
similarity index 67%
copy from webkit/fileapi/isolated_mount_point_provider.cc
copy to webkit/fileapi/media/media_file_system_mount_point_provider.cc
index 926fb69d1712e160d89c8c36263fdb3ab0fd144a..d968c0a16b1533eb8ec7077f2d53ae0d5a5e8151 100644
--- a/webkit/fileapi/isolated_mount_point_provider.cc
+++ b/webkit/fileapi/media/media_file_system_mount_point_provider.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/fileapi/isolated_mount_point_provider.h"
+#include "webkit/fileapi/media/media_file_system_mount_point_provider.h"
#include <string>
@@ -36,17 +36,15 @@
namespace fileapi {
-const char IsolatedMountPointProvider::kMediaPathFilterKey[] =
+const char MediaFileSystemMountPointProvider::kMediaPathFilterKey[] =
"MediaPathFilterKey";
-const char IsolatedMountPointProvider::kMTPDeviceDelegateURLKey[] =
+const char MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey[] =
"MTPDeviceDelegateKey";
-IsolatedMountPointProvider::IsolatedMountPointProvider(
+MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider(
const base::FilePath& profile_path)
: profile_path_(profile_path),
media_path_filter_(new MediaPathFilter()),
- isolated_file_util_(new AsyncFileUtilAdapter(new IsolatedFileUtil())),
- dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())),
native_media_file_util_(
new AsyncFileUtilAdapter(new NativeMediaFileUtil())) {
#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
@@ -57,27 +55,21 @@ IsolatedMountPointProvider::IsolatedMountPointProvider(
#endif
}
-IsolatedMountPointProvider::~IsolatedMountPointProvider() {
+MediaFileSystemMountPointProvider::~MediaFileSystemMountPointProvider() {
}
-bool IsolatedMountPointProvider::CanHandleType(FileSystemType type) const {
+bool MediaFileSystemMountPointProvider::CanHandleType(
+ FileSystemType type) const {
switch (type) {
- case kFileSystemTypeIsolated:
- case kFileSystemTypeDragged:
case kFileSystemTypeNativeMedia:
case kFileSystemTypeDeviceMedia:
return true;
-#if !defined(OS_CHROMEOS)
- case kFileSystemTypeNativeLocal:
- case kFileSystemTypeNativeForPlatformApp:
- return true;
-#endif
default:
return false;
}
}
-void IsolatedMountPointProvider::ValidateFileSystemRoot(
+void MediaFileSystemMountPointProvider::ValidateFileSystemRoot(
const GURL& origin_url,
FileSystemType type,
bool create,
@@ -88,7 +80,8 @@ void IsolatedMountPointProvider::ValidateFileSystemRoot(
base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY));
}
-base::FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread(
+base::FilePath
+MediaFileSystemMountPointProvider::GetFileSystemRootPathOnFileThread(
const FileSystemURL& url,
bool create) {
// This is not supposed to be used.
@@ -96,13 +89,9 @@ base::FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread(
return base::FilePath();
}
-FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil(
+FileSystemFileUtil* MediaFileSystemMountPointProvider::GetFileUtil(
FileSystemType type) {
switch (type) {
- case kFileSystemTypeNativeLocal:
- return isolated_file_util_->sync_file_util();
- case kFileSystemTypeDragged:
- return dragged_file_util_->sync_file_util();
case kFileSystemTypeNativeMedia:
return native_media_file_util_->sync_file_util();
default:
@@ -111,13 +100,9 @@ FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil(
return NULL;
}
-AsyncFileUtil* IsolatedMountPointProvider::GetAsyncFileUtil(
+AsyncFileUtil* MediaFileSystemMountPointProvider::GetAsyncFileUtil(
FileSystemType type) {
switch (type) {
- case kFileSystemTypeNativeLocal:
- return isolated_file_util_.get();
- case kFileSystemTypeDragged:
- return dragged_file_util_.get();
case kFileSystemTypeNativeMedia:
return native_media_file_util_.get();
case kFileSystemTypeDeviceMedia:
@@ -131,14 +116,11 @@ AsyncFileUtil* IsolatedMountPointProvider::GetAsyncFileUtil(
}
CopyOrMoveFileValidatorFactory*
-IsolatedMountPointProvider::GetCopyOrMoveFileValidatorFactory(
+MediaFileSystemMountPointProvider::GetCopyOrMoveFileValidatorFactory(
FileSystemType type, base::PlatformFileError* error_code) {
DCHECK(error_code);
*error_code = base::PLATFORM_FILE_OK;
switch (type) {
- case kFileSystemTypeNativeLocal:
- case kFileSystemTypeDragged:
- return NULL;
case kFileSystemTypeNativeMedia:
case kFileSystemTypeDeviceMedia:
if (!media_copy_or_move_file_validator_factory_) {
@@ -152,14 +134,11 @@ IsolatedMountPointProvider::GetCopyOrMoveFileValidatorFactory(
return NULL;
}
-void IsolatedMountPointProvider::InitializeCopyOrMoveFileValidatorFactory(
+void
+MediaFileSystemMountPointProvider::InitializeCopyOrMoveFileValidatorFactory(
FileSystemType type,
scoped_ptr<CopyOrMoveFileValidatorFactory> factory) {
switch (type) {
- case kFileSystemTypeNativeLocal:
- case kFileSystemTypeDragged:
- DCHECK(factory == NULL);
- break;
case kFileSystemTypeNativeMedia:
case kFileSystemTypeDeviceMedia:
if (!media_copy_or_move_file_validator_factory_)
@@ -170,36 +149,24 @@ void IsolatedMountPointProvider::InitializeCopyOrMoveFileValidatorFactory(
}
}
-FilePermissionPolicy IsolatedMountPointProvider::GetPermissionPolicy(
+FilePermissionPolicy MediaFileSystemMountPointProvider::GetPermissionPolicy(
const FileSystemURL& url, int permissions) const {
- if (url.type() == kFileSystemTypeDragged && url.path().empty()) {
- // The root directory of the dragged filesystem must be always read-only.
- if (permissions & ~fileapi::kReadFilePermissions)
- return FILE_PERMISSION_ALWAYS_DENY;
- }
- // Access to isolated file systems should be checked using per-filesystem
+ // Access to media file systems should be checked using per-filesystem
// access permission.
return FILE_PERMISSION_USE_FILESYSTEM_PERMISSION;
}
-FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation(
+FileSystemOperation*
+MediaFileSystemMountPointProvider::CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
base::PlatformFileError* error_code) const {
- if (url.type() != kFileSystemTypeNativeMedia &&
- url.type() != kFileSystemTypeDeviceMedia) {
- return new LocalFileSystemOperation(
- context, make_scoped_ptr(new FileSystemOperationContext(context)));
- }
-
- // For media filesystems.
scoped_ptr<FileSystemOperationContext> operation_context(
new FileSystemOperationContext(
context, context->task_runners()->media_task_runner()));
operation_context->SetUserValue(kMediaPathFilterKey,
media_path_filter_.get());
-
#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
if (url.type() == kFileSystemTypeDeviceMedia) {
operation_context->SetUserValue(kMTPDeviceDelegateURLKey,
@@ -211,7 +178,7 @@ FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation(
}
scoped_ptr<webkit_blob::FileStreamReader>
-IsolatedMountPointProvider::CreateFileStreamReader(
+MediaFileSystemMountPointProvider::CreateFileStreamReader(
const FileSystemURL& url,
int64 offset,
const base::Time& expected_modification_time,
@@ -222,7 +189,8 @@ IsolatedMountPointProvider::CreateFileStreamReader(
url.path(), offset, expected_modification_time));
}
-scoped_ptr<FileStreamWriter> IsolatedMountPointProvider::CreateFileStreamWriter(
+scoped_ptr<FileStreamWriter>
+MediaFileSystemMountPointProvider::CreateFileStreamWriter(
const FileSystemURL& url,
int64 offset,
FileSystemContext* context) const {
@@ -230,12 +198,12 @@ scoped_ptr<FileStreamWriter> IsolatedMountPointProvider::CreateFileStreamWriter(
new LocalFileStreamWriter(url.path(), offset));
}
-FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() {
+FileSystemQuotaUtil* MediaFileSystemMountPointProvider::GetQuotaUtil() {
// No quota support.
return NULL;
}
-void IsolatedMountPointProvider::DeleteFileSystem(
+void MediaFileSystemMountPointProvider::DeleteFileSystem(
const GURL& origin_url,
FileSystemType type,
FileSystemContext* context,
« no previous file with comments | « webkit/fileapi/media/media_file_system_mount_point_provider.h ('k') | webkit/fileapi/media/native_media_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698