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