Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 } | 65 } |
| 66 | 66 |
| 67 base::FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( | 67 base::FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( |
| 68 const FileSystemURL& url, | 68 const FileSystemURL& url, |
| 69 bool create) { | 69 bool create) { |
| 70 // This is not supposed to be used. | 70 // This is not supposed to be used. |
| 71 NOTREACHED(); | 71 NOTREACHED(); |
| 72 return base::FilePath(); | 72 return base::FilePath(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool IsolatedMountPointProvider::IsAccessAllowed(const FileSystemURL& url) { | |
| 76 return true; | |
| 77 } | |
| 78 | |
| 79 bool IsolatedMountPointProvider::IsRestrictedFileName( | |
| 80 const base::FilePath& filename) const { | |
| 81 // TODO(kinuko): We need to check platform-specific restricted file names | |
| 82 // before we actually start allowing file creation in isolated file systems. | |
| 83 return false; | |
| 84 } | |
| 85 | |
| 86 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( | 75 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( |
| 87 FileSystemType type) { | 76 FileSystemType type) { |
| 88 switch (type) { | 77 switch (type) { |
| 89 case kFileSystemTypeNativeLocal: | 78 case kFileSystemTypeNativeLocal: |
| 90 return isolated_file_util_->sync_file_util(); | 79 return isolated_file_util_->sync_file_util(); |
| 91 case kFileSystemTypeDragged: | 80 case kFileSystemTypeDragged: |
| 92 return dragged_file_util_->sync_file_util(); | 81 return dragged_file_util_->sync_file_util(); |
| 93 case kFileSystemTypeNativeMedia: | 82 case kFileSystemTypeNativeMedia: |
| 94 return native_media_file_util_->sync_file_util(); | 83 return native_media_file_util_->sync_file_util(); |
| 95 case kFileSystemTypeDeviceMedia: | 84 case kFileSystemTypeDeviceMedia: |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 118 default: | 107 default: |
| 119 NOTREACHED(); | 108 NOTREACHED(); |
| 120 } | 109 } |
| 121 return NULL; | 110 return NULL; |
| 122 } | 111 } |
| 123 | 112 |
| 124 FilePermissionPolicy IsolatedMountPointProvider::GetPermissionPolicy( | 113 FilePermissionPolicy IsolatedMountPointProvider::GetPermissionPolicy( |
| 125 const FileSystemURL& url, int permissions) const { | 114 const FileSystemURL& url, int permissions) const { |
| 126 if (url.type() == kFileSystemTypeDragged && url.path().empty()) { | 115 if (url.type() == kFileSystemTypeDragged && url.path().empty()) { |
| 127 // The root directory of the dragged filesystem must be always read-only. | 116 // The root directory of the dragged filesystem must be always read-only. |
| 128 if (permissions != kReadFilePermissions) | 117 if (permissions &~ fileapi::kReadFilePermissions) |
|
ericu
2013/02/05 21:51:57
Same again.
| |
| 129 return FILE_PERMISSION_ALWAYS_DENY; | 118 return FILE_PERMISSION_ALWAYS_DENY; |
| 130 } | 119 } |
| 131 // Access to isolated file systems should be checked using per-filesystem | 120 // Access to isolated file systems should be checked using per-filesystem |
| 132 // access permission. | 121 // access permission. |
| 133 return FILE_PERMISSION_USE_FILESYSTEM_PERMISSION; | 122 return FILE_PERMISSION_USE_FILESYSTEM_PERMISSION; |
| 134 } | 123 } |
| 135 | 124 |
| 136 FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation( | 125 FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation( |
| 137 const FileSystemURL& url, | 126 const FileSystemURL& url, |
| 138 FileSystemContext* context, | 127 FileSystemContext* context, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 void IsolatedMountPointProvider::DeleteFileSystem( | 169 void IsolatedMountPointProvider::DeleteFileSystem( |
| 181 const GURL& origin_url, | 170 const GURL& origin_url, |
| 182 FileSystemType type, | 171 FileSystemType type, |
| 183 FileSystemContext* context, | 172 FileSystemContext* context, |
| 184 const DeleteFileSystemCallback& callback) { | 173 const DeleteFileSystemCallback& callback) { |
| 185 NOTREACHED(); | 174 NOTREACHED(); |
| 186 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 175 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
| 187 } | 176 } |
| 188 | 177 |
| 189 } // namespace fileapi | 178 } // namespace fileapi |
| OLD | NEW |