| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( | 66 FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( |
| 67 const GURL& origin_url, | 67 const GURL& origin_url, |
| 68 FileSystemType type, | 68 FileSystemType type, |
| 69 const FilePath& virtual_path, | 69 const FilePath& virtual_path, |
| 70 bool create) { | 70 bool create) { |
| 71 if (create || type != kFileSystemTypeIsolated) | 71 if (create || type != kFileSystemTypeIsolated) |
| 72 return FilePath(); | 72 return FilePath(); |
| 73 std::string fsid; | 73 std::string fsid; |
| 74 FilePath root, path; | 74 FilePath path; |
| 75 IsolatedContext::FileInfo root; |
| 75 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, &root, &path)) | 76 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, &root, &path)) |
| 76 return FilePath(); | 77 return FilePath(); |
| 77 return root; | 78 return root.path; |
| 78 } | 79 } |
| 79 | 80 |
| 80 bool IsolatedMountPointProvider::IsAccessAllowed( | 81 bool IsolatedMountPointProvider::IsAccessAllowed( |
| 81 const GURL& origin_url, FileSystemType type, const FilePath& virtual_path) { | 82 const GURL& origin_url, FileSystemType type, const FilePath& virtual_path) { |
| 82 if (type != fileapi::kFileSystemTypeIsolated) | 83 if (type != fileapi::kFileSystemTypeIsolated) |
| 83 return false; | 84 return false; |
| 84 | 85 |
| 85 std::string filesystem_id; | 86 std::string filesystem_id; |
| 86 FilePath root, path; | 87 FilePath path; |
| 87 return isolated_context()->CrackIsolatedPath( | 88 return isolated_context()->CrackIsolatedPath( |
| 88 virtual_path, &filesystem_id, &root, &path); | 89 virtual_path, &filesystem_id, NULL, &path); |
| 89 } | 90 } |
| 90 | 91 |
| 91 bool IsolatedMountPointProvider::IsRestrictedFileName( | 92 bool IsolatedMountPointProvider::IsRestrictedFileName( |
| 92 const FilePath& filename) const { | 93 const FilePath& filename) const { |
| 93 return false; | 94 return false; |
| 94 } | 95 } |
| 95 | 96 |
| 96 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil() { | 97 FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil() { |
| 97 return isolated_file_util_.get(); | 98 return isolated_file_util_.get(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 FilePath IsolatedMountPointProvider::GetPathForPermissionsCheck( | 101 FilePath IsolatedMountPointProvider::GetPathForPermissionsCheck( |
| 101 const FilePath& virtual_path) const { | 102 const FilePath& virtual_path) const { |
| 102 std::string fsid; | 103 std::string fsid; |
| 103 FilePath root, path; | 104 FilePath path; |
| 104 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, &root, &path)) | 105 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path)) |
| 105 return FilePath(); | 106 return FilePath(); |
| 106 return path; | 107 return path; |
| 107 } | 108 } |
| 108 | 109 |
| 109 FileSystemOperationInterface* | 110 FileSystemOperationInterface* |
| 110 IsolatedMountPointProvider::CreateFileSystemOperation( | 111 IsolatedMountPointProvider::CreateFileSystemOperation( |
| 111 const FileSystemURL& url, | 112 const FileSystemURL& url, |
| 112 FileSystemContext* context) const { | 113 FileSystemContext* context) const { |
| 113 return new FileSystemOperation(context); | 114 return new FileSystemOperation(context); |
| 114 } | 115 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 130 FilePath path = GetPathFromURL(url, true); | 131 FilePath path = GetPathFromURL(url, true); |
| 131 return path.empty() ? NULL : new LocalFileStreamWriter(path, offset); | 132 return path.empty() ? NULL : new LocalFileStreamWriter(path, offset); |
| 132 } | 133 } |
| 133 | 134 |
| 134 FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() { | 135 FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() { |
| 135 // No quota support. | 136 // No quota support. |
| 136 return NULL; | 137 return NULL; |
| 137 } | 138 } |
| 138 | 139 |
| 139 } // namespace fileapi | 140 } // namespace fileapi |
| OLD | NEW |