| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/fileapi/isolated_mount_point_provider.h" | 5 #include "webkit/fileapi/isolated_mount_point_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 base::FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( | 74 base::FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( |
| 75 const FileSystemURL& url, | 75 const FileSystemURL& url, |
| 76 bool create) { | 76 bool create) { |
| 77 // This is not supposed to be used. | 77 // This is not supposed to be used. |
| 78 NOTREACHED(); | 78 NOTREACHED(); |
| 79 return base::FilePath(); | 79 return base::FilePath(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool IsolatedMountPointProvider::IsAccessAllowed(const FileSystemURL& url) { | |
| 83 return true; | |
| 84 } | |
| 85 | |
| 86 bool IsolatedMountPointProvider::IsRestrictedFileName( | |
| 87 const base::FilePath& filename) const { | |
| 88 // TODO(kinuko): We need to check platform-specific restricted file names | |
| 89 // before we actually start allowing file creation in isolated file systems. | |
| 90 return false; | |
| 91 } | |
| 92 | |
| 93 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( | 82 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( |
| 94 FileSystemType type) { | 83 FileSystemType type) { |
| 95 switch (type) { | 84 switch (type) { |
| 96 case kFileSystemTypeNativeLocal: | 85 case kFileSystemTypeNativeLocal: |
| 97 return isolated_file_util_->sync_file_util(); | 86 return isolated_file_util_->sync_file_util(); |
| 98 case kFileSystemTypeDragged: | 87 case kFileSystemTypeDragged: |
| 99 return dragged_file_util_->sync_file_util(); | 88 return dragged_file_util_->sync_file_util(); |
| 100 case kFileSystemTypeNativeMedia: | 89 case kFileSystemTypeNativeMedia: |
| 101 return native_media_file_util_->sync_file_util(); | 90 return native_media_file_util_->sync_file_util(); |
| 102 case kFileSystemTypeDeviceMedia: | 91 case kFileSystemTypeDeviceMedia: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 129 default: | 118 default: |
| 130 NOTREACHED(); | 119 NOTREACHED(); |
| 131 } | 120 } |
| 132 return NULL; | 121 return NULL; |
| 133 } | 122 } |
| 134 | 123 |
| 135 FilePermissionPolicy IsolatedMountPointProvider::GetPermissionPolicy( | 124 FilePermissionPolicy IsolatedMountPointProvider::GetPermissionPolicy( |
| 136 const FileSystemURL& url, int permissions) const { | 125 const FileSystemURL& url, int permissions) const { |
| 137 if (url.type() == kFileSystemTypeDragged && url.path().empty()) { | 126 if (url.type() == kFileSystemTypeDragged && url.path().empty()) { |
| 138 // The root directory of the dragged filesystem must be always read-only. | 127 // The root directory of the dragged filesystem must be always read-only. |
| 139 if (permissions != kReadFilePermissions) | 128 if (permissions & ~fileapi::kReadFilePermissions) |
| 140 return FILE_PERMISSION_ALWAYS_DENY; | 129 return FILE_PERMISSION_ALWAYS_DENY; |
| 141 } | 130 } |
| 142 // Access to isolated file systems should be checked using per-filesystem | 131 // Access to isolated file systems should be checked using per-filesystem |
| 143 // access permission. | 132 // access permission. |
| 144 return FILE_PERMISSION_USE_FILESYSTEM_PERMISSION; | 133 return FILE_PERMISSION_USE_FILESYSTEM_PERMISSION; |
| 145 } | 134 } |
| 146 | 135 |
| 147 FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation( | 136 FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation( |
| 148 const FileSystemURL& url, | 137 const FileSystemURL& url, |
| 149 FileSystemContext* context, | 138 FileSystemContext* context, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 void IsolatedMountPointProvider::DeleteFileSystem( | 180 void IsolatedMountPointProvider::DeleteFileSystem( |
| 192 const GURL& origin_url, | 181 const GURL& origin_url, |
| 193 FileSystemType type, | 182 FileSystemType type, |
| 194 FileSystemContext* context, | 183 FileSystemContext* context, |
| 195 const DeleteFileSystemCallback& callback) { | 184 const DeleteFileSystemCallback& callback) { |
| 196 NOTREACHED(); | 185 NOTREACHED(); |
| 197 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 186 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
| 198 } | 187 } |
| 199 | 188 |
| 200 } // namespace fileapi | 189 } // namespace fileapi |
| OLD | NEW |