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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) | 93 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) |
94 return device_media_file_util_.get(); | 94 return device_media_file_util_.get(); |
95 #endif | 95 #endif |
96 | 96 |
97 default: | 97 default: |
98 NOTREACHED(); | 98 NOTREACHED(); |
99 } | 99 } |
100 return NULL; | 100 return NULL; |
101 } | 101 } |
102 | 102 |
103 FilePath IsolatedMountPointProvider::GetPathForPermissionsCheck( | 103 FilePermissionPolicy IsolatedMountPointProvider::GetPermissionPolicy( |
104 const FilePath& virtual_path) const { | 104 const FileSystemURL& url, int permissions) const { |
105 // For isolated filesystems we only check per-filesystem permissions. | 105 if (url.type() == kFileSystemTypeDragged && url.path().empty()) { |
106 return FilePath(); | 106 // The root directory of the dragged filesystem must be always read-only. |
| 107 if (permissions != kReadFilePermissions) |
| 108 return FILE_PERMISSION_ALWAYS_DENY; |
| 109 } |
| 110 // Access to isolated file systems should be checked using per-filesystem |
| 111 // access permission. |
| 112 return FILE_PERMISSION_USE_FILESYSTEM_PERMISSION; |
107 } | 113 } |
108 | 114 |
109 FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation( | 115 FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation( |
110 const FileSystemURL& url, | 116 const FileSystemURL& url, |
111 FileSystemContext* context, | 117 FileSystemContext* context, |
112 base::PlatformFileError* error_code) const { | 118 base::PlatformFileError* error_code) const { |
113 scoped_ptr<FileSystemOperationContext> operation_context( | 119 scoped_ptr<FileSystemOperationContext> operation_context( |
114 new FileSystemOperationContext(context)); | 120 new FileSystemOperationContext(context)); |
115 if (url.type() == kFileSystemTypeNativeMedia || | 121 if (url.type() == kFileSystemTypeNativeMedia || |
116 url.type() == kFileSystemTypeDeviceMedia) { | 122 url.type() == kFileSystemTypeDeviceMedia) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 void IsolatedMountPointProvider::DeleteFileSystem( | 159 void IsolatedMountPointProvider::DeleteFileSystem( |
154 const GURL& origin_url, | 160 const GURL& origin_url, |
155 FileSystemType type, | 161 FileSystemType type, |
156 FileSystemContext* context, | 162 FileSystemContext* context, |
157 const DeleteFileSystemCallback& callback) { | 163 const DeleteFileSystemCallback& callback) { |
158 NOTREACHED(); | 164 NOTREACHED(); |
159 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 165 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
160 } | 166 } |
161 | 167 |
162 } // namespace fileapi | 168 } // namespace fileapi |
OLD | NEW |