| 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 60ad91eea48ce43f3821b9ca73a08e80a55357c1..94142114e0c2ddcb4a9acac0238781e8d3ebf043 100644
|
| --- a/webkit/fileapi/isolated_mount_point_provider.cc
|
| +++ b/webkit/fileapi/isolated_mount_point_provider.cc
|
| @@ -26,6 +26,29 @@
|
|
|
| namespace fileapi {
|
|
|
| +namespace {
|
| +
|
| +IsolatedContext* isolated_context() {
|
| + return IsolatedContext::GetInstance();
|
| +}
|
| +
|
| +FilePath GetPathFromURL(const GURL& url, bool for_writing) {
|
| + 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();
|
| + if (for_writing && !isolated_context()->IsWritable(fsid))
|
| + return FilePath();
|
| + return path;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| IsolatedMountPointProvider::IsolatedMountPointProvider()
|
| : isolated_file_util_(new IsolatedFileUtil()) {
|
| }
|
| @@ -107,7 +130,7 @@ IsolatedMountPointProvider::CreateFileStreamReader(
|
| const GURL& url,
|
| int64 offset,
|
| FileSystemContext* context) const {
|
| - FilePath path = GetPathFromURL(url);
|
| + FilePath path = GetPathFromURL(url, false);
|
| return path.empty() ? NULL : new webkit_blob::LocalFileStreamReader(
|
| context->file_task_runner(), path, offset, base::Time());
|
| }
|
| @@ -116,7 +139,7 @@ FileStreamWriter* IsolatedMountPointProvider::CreateFileStreamWriter(
|
| const GURL& url,
|
| int64 offset,
|
| FileSystemContext* context) const {
|
| - FilePath path = GetPathFromURL(url);
|
| + FilePath path = GetPathFromURL(url, true);
|
| return path.empty() ? NULL : new LocalFileStreamWriter(path, offset);
|
| }
|
|
|
| @@ -125,21 +148,4 @@ FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() {
|
| return NULL;
|
| }
|
|
|
| -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
|
|
|