summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/isolated_mount_point_provider.cc
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/fileapi/isolated_mount_point_provider.cc')
-rw-r--r--webkit/fileapi/isolated_mount_point_provider.cc36
1 files changed, 24 insertions, 12 deletions
diff --git a/webkit/fileapi/isolated_mount_point_provider.cc b/webkit/fileapi/isolated_mount_point_provider.cc
index 1e6b8b5..f32f28a 100644
--- a/webkit/fileapi/isolated_mount_point_provider.cc
+++ b/webkit/fileapi/isolated_mount_point_provider.cc
@@ -21,6 +21,7 @@
#include "webkit/fileapi/file_system_util.h"
#include "webkit/fileapi/isolated_context.h"
#include "webkit/fileapi/isolated_file_util.h"
+#include "webkit/fileapi/local_file_writer.h"
#include "webkit/fileapi/native_file_util.h"
namespace fileapi {
@@ -105,21 +106,19 @@ webkit_blob::FileReader* IsolatedMountPointProvider::CreateFileReader(
const GURL& url,
int64 offset,
FileSystemContext* context) const {
- GURL origin_url;
- FileSystemType file_system_type = kFileSystemTypeUnknown;
- FilePath virtual_path;
- if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &virtual_path))
- return NULL;
- std::string fsid;
- FilePath path;
- if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path))
- return NULL;
- if (path.empty())
- return NULL;
- return new webkit_blob::LocalFileReader(
+ FilePath path = GetPathFromURL(url);
+ return path.empty() ? NULL : new webkit_blob::LocalFileReader(
context->file_task_runner(), path, offset, base::Time());
}
+FileWriter* IsolatedMountPointProvider::CreateFileWriter(
+ const GURL& url,
+ int64 offset,
+ FileSystemContext* context) const {
+ FilePath path = GetPathFromURL(url);
+ return path.empty() ? NULL : new LocalFileWriter(path, offset);
+}
+
FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() {
// No quota support.
return NULL;
@@ -129,4 +128,17 @@ IsolatedContext* IsolatedMountPointProvider::isolated_context() const {
return IsolatedContext::GetInstance();
}
+FilePath IsolatedMountPointProvider::GetPathFromURL(const GURL& url) const {
+ GURL origin_url;
+ FileSystemType file_system_type = kFileSystemTypeUnknown;
+ FilePath virtual_path;
+ if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &virtual_path))
+ return FilePath();
+ std::string fsid;
+ FilePath path;
+ if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path))
+ return FilePath();
+ return path;
+}
+
} // namespace fileapi