| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 SandboxMountPointProvider( | 51 SandboxMountPointProvider( |
| 52 FileSystemPathManager* path_manager, | 52 FileSystemPathManager* path_manager, |
| 53 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 53 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 54 const FilePath& profile_path); | 54 const FilePath& profile_path); |
| 55 virtual ~SandboxMountPointProvider(); | 55 virtual ~SandboxMountPointProvider(); |
| 56 | 56 |
| 57 // Checks if access to |virtual_path| is allowed from |origin_url|. | 57 // Checks if access to |virtual_path| is allowed from |origin_url|. |
| 58 virtual bool IsAccessAllowed(const GURL& origin_url, | 58 virtual bool IsAccessAllowed(const GURL& origin_url, |
| 59 FileSystemType type, | 59 FileSystemType type, |
| 60 const FilePath& virtual_path); | 60 const FilePath& virtual_path) OVERRIDE; |
| 61 | 61 |
| 62 // Retrieves the root path for the given |origin_url| and |type|, and | 62 // Retrieves the root path for the given |origin_url| and |type|, and |
| 63 // calls the given |callback| with the root path and name. | 63 // calls the given |callback| with the root path and name. |
| 64 // If |create| is true this also creates the directory if it doesn't exist. | 64 // If |create| is true this also creates the directory if it doesn't exist. |
| 65 virtual void ValidateFileSystemRootAndGetURL( | 65 virtual void ValidateFileSystemRootAndGetURL( |
| 66 const GURL& origin_url, | 66 const GURL& origin_url, |
| 67 FileSystemType type, | 67 FileSystemType type, |
| 68 bool create, | 68 bool create, |
| 69 const FileSystemPathManager::GetRootPathCallback& callback); | 69 const FileSystemPathManager::GetRootPathCallback& callback) OVERRIDE; |
| 70 | 70 |
| 71 // Like GetFileSystemRootPath, but synchronous, and can be called only while | 71 // Like GetFileSystemRootPath, but synchronous, and can be called only while |
| 72 // running on the file thread. | 72 // running on the file thread. |
| 73 virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread( | 73 virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread( |
| 74 const GURL& origin_url, | 74 const GURL& origin_url, |
| 75 FileSystemType type, | 75 FileSystemType type, |
| 76 const FilePath& unused, | 76 const FilePath& unused, |
| 77 bool create); | 77 bool create) OVERRIDE; |
| 78 | 78 |
| 79 // The legacy [pre-obfuscation] FileSystem directory name, kept around for | 79 // The legacy [pre-obfuscation] FileSystem directory name, kept around for |
| 80 // migration and migration testing. | 80 // migration and migration testing. |
| 81 static const FilePath::CharType kOldFileSystemDirectory[]; | 81 static const FilePath::CharType kOldFileSystemDirectory[]; |
| 82 // The FileSystem directory name. | 82 // The FileSystem directory name. |
| 83 static const FilePath::CharType kNewFileSystemDirectory[]; | 83 static const FilePath::CharType kNewFileSystemDirectory[]; |
| 84 // Where we move the old filesystem directory if migration fails. | 84 // Where we move the old filesystem directory if migration fails. |
| 85 static const FilePath::CharType kRenamedOldFileSystemDirectory[]; | 85 static const FilePath::CharType kRenamedOldFileSystemDirectory[]; |
| 86 | 86 |
| 87 FilePath old_base_path() const; | 87 FilePath old_base_path() const; |
| 88 FilePath new_base_path() const; | 88 FilePath new_base_path() const; |
| 89 FilePath renamed_old_base_path() const; | 89 FilePath renamed_old_base_path() const; |
| 90 | 90 |
| 91 // Checks if a given |name| contains any restricted names/chars in it. | 91 // Checks if a given |name| contains any restricted names/chars in it. |
| 92 virtual bool IsRestrictedFileName(const FilePath& filename) const; | 92 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; |
| 93 | 93 |
| 94 virtual std::vector<FilePath> GetRootDirectories() const; | 94 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; |
| 95 | 95 |
| 96 // Returns an origin enumerator of this provider. | 96 // Returns an origin enumerator of this provider. |
| 97 // This method can only be called on the file thread. | 97 // This method can only be called on the file thread. |
| 98 OriginEnumerator* CreateOriginEnumerator() const; | 98 OriginEnumerator* CreateOriginEnumerator() const; |
| 99 | 99 |
| 100 // Gets a base directory path of the sandboxed filesystem that is | 100 // Gets a base directory path of the sandboxed filesystem that is |
| 101 // specified by |origin_url| and |type|. | 101 // specified by |origin_url| and |type|. |
| 102 // (The path is similar to the origin's root path but doesn't contain | 102 // (The path is similar to the origin's root path but doesn't contain |
| 103 // the 'unique' part.) | 103 // the 'unique' part.) |
| 104 // Returns an empty path if the given type is invalid. | 104 // Returns an empty path if the given type is invalid. |
| 105 // This method can only be called on the file thread. | 105 // This method can only be called on the file thread. |
| 106 FilePath GetBaseDirectoryForOriginAndType( | 106 FilePath GetBaseDirectoryForOriginAndType( |
| 107 const GURL& origin_url, | 107 const GURL& origin_url, |
| 108 FileSystemType type, | 108 FileSystemType type, |
| 109 bool create) const; | 109 bool create) const; |
| 110 | 110 |
| 111 virtual FileSystemFileUtil* GetFileUtil(); | 111 virtual FileSystemFileUtil* GetFileUtil() OVERRIDE; |
| 112 | 112 |
| 113 // Deletes the data on the origin and reports the amount of deleted data | 113 // Deletes the data on the origin and reports the amount of deleted data |
| 114 // to the quota manager via |proxy|. | 114 // to the quota manager via |proxy|. |
| 115 bool DeleteOriginDataOnFileThread( | 115 bool DeleteOriginDataOnFileThread( |
| 116 quota::QuotaManagerProxy* proxy, | 116 quota::QuotaManagerProxy* proxy, |
| 117 const GURL& origin_url, | 117 const GURL& origin_url, |
| 118 FileSystemType type); | 118 FileSystemType type); |
| 119 | 119 |
| 120 // Quota util methods. | 120 // Quota util methods. |
| 121 virtual void GetOriginsForTypeOnFileThread( | 121 virtual void GetOriginsForTypeOnFileThread( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 // Acccessed only on the file thread. | 176 // Acccessed only on the file thread. |
| 177 std::set<GURL> visited_origins_; | 177 std::set<GURL> visited_origins_; |
| 178 | 178 |
| 179 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); | 179 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 } // namespace fileapi | 182 } // namespace fileapi |
| 183 | 183 |
| 184 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 184 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
| OLD | NEW |