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

Unified Diff: webkit/chromeos/fileapi/cros_mount_point_provider.cc

Issue 12193007: Deprecate MountPointProvider::IsAccessAllowed in favor of GetPermissionPolicy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base::FilePath fix Created 7 years, 10 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/chromeos/fileapi/cros_mount_point_provider.cc
diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider.cc b/webkit/chromeos/fileapi/cros_mount_point_provider.cc
index a90fcfaa6ecd871b295f950bce332557fbff086f..7f130026618ac6c886c57b0d83791c0348e49d4d 100644
--- a/webkit/chromeos/fileapi/cros_mount_point_provider.cc
+++ b/webkit/chromeos/fileapi/cros_mount_point_provider.cc
@@ -89,8 +89,22 @@ base::FilePath CrosMountPointProvider::GetFileSystemRootPathOnFileThread(
return root_path.DirName();
}
+fileapi::FileSystemQuotaUtil* CrosMountPointProvider::GetQuotaUtil() {
+ // No quota support.
+ return NULL;
+}
+
+void CrosMountPointProvider::DeleteFileSystem(
+ const GURL& origin_url,
+ fileapi::FileSystemType type,
+ fileapi::FileSystemContext* context,
+ const DeleteFileSystemCallback& callback) {
+ NOTREACHED();
+ callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+}
+
bool CrosMountPointProvider::IsAccessAllowed(
- const fileapi::FileSystemURL& url) {
+ const fileapi::FileSystemURL& url) const {
if (!url.is_valid())
return false;
@@ -115,26 +129,6 @@ bool CrosMountPointProvider::IsAccessAllowed(
url.virtual_path());
}
-// TODO(zelidrag): Share this code with SandboxMountPointProvider impl.
-bool CrosMountPointProvider::IsRestrictedFileName(
- const base::FilePath& path) const {
- return false;
-}
-
-fileapi::FileSystemQuotaUtil* CrosMountPointProvider::GetQuotaUtil() {
- // No quota support.
- return NULL;
-}
-
-void CrosMountPointProvider::DeleteFileSystem(
- const GURL& origin_url,
- fileapi::FileSystemType type,
- fileapi::FileSystemContext* context,
- const DeleteFileSystemCallback& callback) {
- NOTREACHED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
-}
-
void CrosMountPointProvider::GrantFullAccessToExtension(
const std::string& extension_id) {
DCHECK(special_storage_policy_->IsFileHandler(extension_id));
@@ -208,11 +202,27 @@ fileapi::AsyncFileUtil* CrosMountPointProvider::GetAsyncFileUtil(
fileapi::FilePermissionPolicy CrosMountPointProvider::GetPermissionPolicy(
const fileapi::FileSystemURL& url, int permissions) const {
+ if (url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal &&
+ (permissions & ~fileapi::kReadFilePermissions)) {
+ // Restricted file system is read-only.
+ return fileapi::FILE_PERMISSION_ALWAYS_DENY;
+ }
+
+ if (!IsAccessAllowed(url))
+ return fileapi::FILE_PERMISSION_ALWAYS_DENY;
+
+ // Permit access to mount points from internal WebUI.
+ const GURL& origin_url = url.origin();
+ if (origin_url.SchemeIs(kChromeUIScheme))
+ return fileapi::FILE_PERMISSION_ALWAYS_ALLOW;
+
if (url.mount_type() == fileapi::kFileSystemTypeIsolated) {
// Permissions in isolated filesystems should be examined with
// FileSystem permission.
return fileapi::FILE_PERMISSION_USE_FILESYSTEM_PERMISSION;
}
+
+ // Also apply system's file permission by default.
return fileapi::FILE_PERMISSION_USE_FILE_PERMISSION;
}
@@ -273,8 +283,9 @@ fileapi::FileStreamWriter* CrosMountPointProvider::CreateFileStreamWriter(
return new fileapi::LocalFileStreamWriter(url.path(), offset);
}
-bool CrosMountPointProvider::GetVirtualPath(const base::FilePath& filesystem_path,
- base::FilePath* virtual_path) {
+bool CrosMountPointProvider::GetVirtualPath(
+ const base::FilePath& filesystem_path,
+ base::FilePath* virtual_path) {
return mount_points_->GetVirtualPath(filesystem_path, virtual_path) ||
system_mount_points_->GetVirtualPath(filesystem_path, virtual_path);
}
« no previous file with comments | « webkit/chromeos/fileapi/cros_mount_point_provider.h ('k') | webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698