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

Unified Diff: webkit/fileapi/isolated_mount_point_provider.cc

Issue 10540070: Make Isolated file system writable only if it is configured so (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added writer wiring for sandbox and test mpp Created 8 years, 6 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/sandbox_mount_point_provider.cc » ('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 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
« no previous file with comments | « webkit/fileapi/isolated_mount_point_provider.h ('k') | webkit/fileapi/sandbox_mount_point_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698