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 #ifndef WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
6 #define WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 #include "webkit/fileapi/file_system_mount_point_provider.h" | 15 #include "webkit/fileapi/file_system_mount_point_provider.h" |
16 #include "webkit/fileapi/file_system_options.h" | 16 #include "webkit/fileapi/file_system_options.h" |
17 #include "webkit/fileapi/file_system_quota_util.h" | 17 #include "webkit/fileapi/file_system_quota_util.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class MessageLoopProxy; | 20 class SequencedTaskRunner; |
21 } | 21 } |
22 | 22 |
23 namespace quota { | 23 namespace quota { |
24 class QuotaManagerProxy; | 24 class QuotaManagerProxy; |
25 } | 25 } |
26 | 26 |
27 namespace fileapi { | 27 namespace fileapi { |
28 | 28 |
29 class ObfuscatedFileUtil; | 29 class ObfuscatedFileUtil; |
30 | 30 |
(...skipping 23 matching lines...) Expand all Loading... |
54 }; | 54 }; |
55 | 55 |
56 // The legacy [pre-obfuscation] FileSystem directory name, kept around for | 56 // The legacy [pre-obfuscation] FileSystem directory name, kept around for |
57 // migration and migration testing. | 57 // migration and migration testing. |
58 static const FilePath::CharType kOldFileSystemDirectory[]; | 58 static const FilePath::CharType kOldFileSystemDirectory[]; |
59 // The FileSystem directory name. | 59 // The FileSystem directory name. |
60 static const FilePath::CharType kNewFileSystemDirectory[]; | 60 static const FilePath::CharType kNewFileSystemDirectory[]; |
61 // Where we move the old filesystem directory if migration fails. | 61 // Where we move the old filesystem directory if migration fails. |
62 static const FilePath::CharType kRenamedOldFileSystemDirectory[]; | 62 static const FilePath::CharType kRenamedOldFileSystemDirectory[]; |
63 | 63 |
| 64 // |file_task_runner| is used to validate the root directory and delete the |
| 65 // obfuscated file util. |
64 SandboxMountPointProvider( | 66 SandboxMountPointProvider( |
65 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 67 base::SequencedTaskRunner* file_task_runner, |
66 const FilePath& profile_path, | 68 const FilePath& profile_path, |
67 const FileSystemOptions& file_system_options); | 69 const FileSystemOptions& file_system_options); |
68 virtual ~SandboxMountPointProvider(); | 70 virtual ~SandboxMountPointProvider(); |
69 | 71 |
70 // FileSystemMountPointProvider overrides. | 72 // FileSystemMountPointProvider overrides. |
71 virtual void ValidateFileSystemRoot( | 73 virtual void ValidateFileSystemRoot( |
72 const GURL& origin_url, | 74 const GURL& origin_url, |
73 FileSystemType type, | 75 FileSystemType type, |
74 bool create, | 76 bool create, |
75 const ValidateFileSystemCallback& callback) OVERRIDE; | 77 const ValidateFileSystemCallback& callback) OVERRIDE; |
76 virtual FilePath GetFileSystemRootPathOnFileThread( | 78 virtual FilePath GetFileSystemRootPathOnFileThread( |
77 const GURL& origin_url, | 79 const GURL& origin_url, |
78 FileSystemType type, | 80 FileSystemType type, |
79 const FilePath& virtual_path, | 81 const FilePath& virtual_path, |
80 bool create) OVERRIDE; | 82 bool create) OVERRIDE; |
81 virtual bool IsAccessAllowed( | 83 virtual bool IsAccessAllowed( |
82 const GURL& origin_url, | 84 const GURL& origin_url, |
83 FileSystemType type, | 85 FileSystemType type, |
84 const FilePath& virtual_path) OVERRIDE; | 86 const FilePath& virtual_path) OVERRIDE; |
85 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; | 87 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; |
86 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; | 88 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; |
87 virtual FileSystemFileUtil* GetFileUtil() OVERRIDE; | 89 virtual FileSystemFileUtil* GetFileUtil() OVERRIDE; |
88 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path) | 90 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path) |
89 const OVERRIDE; | 91 const OVERRIDE; |
90 virtual FileSystemOperationInterface* CreateFileSystemOperation( | 92 virtual FileSystemOperationInterface* CreateFileSystemOperation( |
91 const GURL& origin_url, | 93 const GURL& origin_url, |
92 FileSystemType file_system_type, | 94 FileSystemType file_system_type, |
93 const FilePath& virtual_path, | 95 const FilePath& virtual_path, |
94 base::MessageLoopProxy* file_proxy, | |
95 FileSystemContext* context) const OVERRIDE; | 96 FileSystemContext* context) const OVERRIDE; |
96 virtual webkit_blob::FileReader* CreateFileReader( | 97 virtual webkit_blob::FileReader* CreateFileReader( |
97 const GURL& url, | 98 const GURL& url, |
98 int64 offset, | 99 int64 offset, |
99 base::MessageLoopProxy* file_proxy, | |
100 FileSystemContext* context) const OVERRIDE; | 100 FileSystemContext* context) const OVERRIDE; |
101 | 101 |
102 FilePath old_base_path() const; | 102 FilePath old_base_path() const; |
103 FilePath new_base_path() const; | 103 FilePath new_base_path() const; |
104 FilePath renamed_old_base_path() const; | 104 FilePath renamed_old_base_path() const; |
105 | 105 |
106 // Returns an origin enumerator of this provider. | 106 // Returns an origin enumerator of this provider. |
107 // This method can only be called on the file thread. | 107 // This method can only be called on the file thread. |
108 OriginEnumerator* CreateOriginEnumerator() const; | 108 OriginEnumerator* CreateOriginEnumerator() const; |
109 | 109 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 const GURL& origin_url, FileSystemType type); | 166 const GURL& origin_url, FileSystemType type); |
167 | 167 |
168 // Returns true if the given |url|'s scheme is allowed to access | 168 // Returns true if the given |url|'s scheme is allowed to access |
169 // filesystem. | 169 // filesystem. |
170 bool IsAllowedScheme(const GURL& url) const; | 170 bool IsAllowedScheme(const GURL& url) const; |
171 | 171 |
172 friend class FileSystemTestOriginHelper; | 172 friend class FileSystemTestOriginHelper; |
173 friend class SandboxMountPointProviderMigrationTest; | 173 friend class SandboxMountPointProviderMigrationTest; |
174 friend class SandboxMountPointProviderOriginEnumeratorTest; | 174 friend class SandboxMountPointProviderOriginEnumeratorTest; |
175 | 175 |
176 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 176 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
177 | 177 |
178 const FilePath profile_path_; | 178 const FilePath profile_path_; |
179 | 179 |
180 FileSystemOptions file_system_options_; | 180 FileSystemOptions file_system_options_; |
181 | 181 |
182 scoped_refptr<ObfuscatedFileUtil> sandbox_file_util_; | 182 scoped_refptr<ObfuscatedFileUtil> sandbox_file_util_; |
183 | 183 |
184 // Acccessed only on the file thread. | 184 // Acccessed only on the file thread. |
185 std::set<GURL> visited_origins_; | 185 std::set<GURL> visited_origins_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); | 187 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace fileapi | 190 } // namespace fileapi |
191 | 191 |
192 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 192 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
OLD | NEW |