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

Unified Diff: webkit/fileapi/isolated_mount_point_provider.cc

Issue 10810053: Enables internal filesystem types via Isolated filesystems (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: layout test crash fix 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
« no previous file with comments | « webkit/fileapi/isolated_mount_point_provider.h ('k') | webkit/fileapi/local_file_system_test_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a144a740f1d5317bfb8fb3ea44553c1bdc69b856..92d214fc736b31b014a6d038fdd5bf33d42565a0 100644
--- a/webkit/fileapi/isolated_mount_point_provider.cc
+++ b/webkit/fileapi/isolated_mount_point_provider.cc
@@ -31,20 +31,11 @@ IsolatedContext* isolated_context() {
return IsolatedContext::GetInstance();
}
-FilePath GetPathFromURL(const FileSystemURL& url) {
- if (!url.is_valid() || url.type() != kFileSystemTypeIsolated)
- return FilePath();
- std::string fsid;
- FilePath path;
- if (!isolated_context()->CrackIsolatedPath(url.path(), &fsid, NULL, &path))
- return FilePath();
- return path;
-}
-
} // namespace
IsolatedMountPointProvider::IsolatedMountPointProvider()
- : isolated_file_util_(new IsolatedFileUtil()) {
+ : isolated_file_util_(new IsolatedFileUtil()),
+ dragged_file_util_(new DraggedFileUtil()) {
}
IsolatedMountPointProvider::~IsolatedMountPointProvider() {
@@ -66,44 +57,36 @@ FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread(
FileSystemType type,
const FilePath& virtual_path,
bool create) {
- if (create || type != kFileSystemTypeIsolated)
- return FilePath();
- std::string fsid;
- FilePath path;
- IsolatedContext::FileInfo root;
- if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, &root, &path))
- return FilePath();
- return root.path;
+ // This is not supposed to be used.
+ NOTREACHED();
+ return FilePath();
}
bool IsolatedMountPointProvider::IsAccessAllowed(
const GURL& origin_url, FileSystemType type, const FilePath& virtual_path) {
- if (type != fileapi::kFileSystemTypeIsolated)
- return false;
-
- std::string filesystem_id;
- FilePath path;
- return isolated_context()->CrackIsolatedPath(
- virtual_path, &filesystem_id, NULL, &path);
+ return true;
}
bool IsolatedMountPointProvider::IsRestrictedFileName(
const FilePath& filename) const {
+ // TODO(kinuko): We need to check platform-specific restricted file names
+ // before we actually start allowing file creation in isolated file systems.
return false;
}
-FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil() {
- // TODO(kinuko): Return different FileUtil's based on types.
- return isolated_file_util_.get();
+FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil(
+ FileSystemType type) {
+ if (type == kFileSystemTypeDragged)
+ return dragged_file_util_.get();
+ else
+ return isolated_file_util_.get();
}
FilePath IsolatedMountPointProvider::GetPathForPermissionsCheck(
const FilePath& virtual_path) const {
- std::string fsid;
- FilePath path;
- if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path))
- return FilePath();
- return path;
+ // For isolated filesystems we only check per-filesystem permissions.
+ NOTREACHED();
+ return virtual_path;
}
FileSystemOperationInterface*
@@ -118,17 +101,15 @@ IsolatedMountPointProvider::CreateFileStreamReader(
const FileSystemURL& url,
int64 offset,
FileSystemContext* context) const {
- FilePath path = GetPathFromURL(url);
- return path.empty() ? NULL : new webkit_blob::LocalFileStreamReader(
- context->file_task_runner(), path, offset, base::Time());
+ return new webkit_blob::LocalFileStreamReader(
+ context->file_task_runner(), url.path(), offset, base::Time());
}
FileStreamWriter* IsolatedMountPointProvider::CreateFileStreamWriter(
const FileSystemURL& url,
int64 offset,
FileSystemContext* context) const {
- FilePath path = GetPathFromURL(url);
- return path.empty() ? NULL : new LocalFileStreamWriter(path, offset);
+ return new LocalFileStreamWriter(url.path(), offset);
}
FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() {
« no previous file with comments | « webkit/fileapi/isolated_mount_point_provider.h ('k') | webkit/fileapi/local_file_system_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698