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> |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // An interface to construct or crack sandboxed filesystem paths for | 35 // An interface to construct or crack sandboxed filesystem paths for |
36 // TEMPORARY or PERSISTENT filesystems, which are placed under the user's | 36 // TEMPORARY or PERSISTENT filesystems, which are placed under the user's |
37 // profile directory in a sandboxed way. | 37 // profile directory in a sandboxed way. |
38 // This interface also lets one enumerate and remove storage for the origins | 38 // This interface also lets one enumerate and remove storage for the origins |
39 // that use the filesystem. | 39 // that use the filesystem. |
40 class FILEAPI_EXPORT SandboxMountPointProvider | 40 class FILEAPI_EXPORT SandboxMountPointProvider |
41 : public FileSystemMountPointProvider, | 41 : public FileSystemMountPointProvider, |
42 public FileSystemQuotaUtil { | 42 public FileSystemQuotaUtil { |
43 public: | 43 public: |
44 typedef FileSystemMountPointProvider::ValidateFileSystemCallback | 44 using FileSystemMountPointProvider::ValidateFileSystemCallback; |
45 ValidateFileSystemCallback; | 45 using FileSystemMountPointProvider::DeleteFileSystemCallback; |
46 | 46 |
47 // Origin enumerator interface. | 47 // Origin enumerator interface. |
48 // An instance of this interface is assumed to be called on the file thread. | 48 // An instance of this interface is assumed to be called on the file thread. |
49 class OriginEnumerator { | 49 class OriginEnumerator { |
50 public: | 50 public: |
51 virtual ~OriginEnumerator() {} | 51 virtual ~OriginEnumerator() {} |
52 | 52 |
53 // Returns the next origin. Returns empty if there are no more origins. | 53 // Returns the next origin. Returns empty if there are no more origins. |
54 virtual GURL Next() = 0; | 54 virtual GURL Next() = 0; |
55 | 55 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 FileSystemContext* context) const OVERRIDE; | 97 FileSystemContext* context) const OVERRIDE; |
98 virtual webkit_blob::FileStreamReader* CreateFileStreamReader( | 98 virtual webkit_blob::FileStreamReader* CreateFileStreamReader( |
99 const FileSystemURL& url, | 99 const FileSystemURL& url, |
100 int64 offset, | 100 int64 offset, |
101 FileSystemContext* context) const OVERRIDE; | 101 FileSystemContext* context) const OVERRIDE; |
102 virtual FileStreamWriter* CreateFileStreamWriter( | 102 virtual FileStreamWriter* CreateFileStreamWriter( |
103 const FileSystemURL& url, | 103 const FileSystemURL& url, |
104 int64 offset, | 104 int64 offset, |
105 FileSystemContext* context) const OVERRIDE; | 105 FileSystemContext* context) const OVERRIDE; |
106 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; | 106 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; |
| 107 virtual void DeleteFileSystem( |
| 108 const GURL& origin_url, |
| 109 FileSystemType type, |
| 110 FileSystemContext* context, |
| 111 const DeleteFileSystemCallback& callback) OVERRIDE; |
107 | 112 |
108 FilePath old_base_path() const; | 113 FilePath old_base_path() const; |
109 FilePath new_base_path() const; | 114 FilePath new_base_path() const; |
110 FilePath renamed_old_base_path() const; | 115 FilePath renamed_old_base_path() const; |
111 | 116 |
112 // Returns an origin enumerator of this provider. | 117 // Returns an origin enumerator of this provider. |
113 // This method can only be called on the file thread. | 118 // This method can only be called on the file thread. |
114 OriginEnumerator* CreateOriginEnumerator() const; | 119 OriginEnumerator* CreateOriginEnumerator() const; |
115 | 120 |
116 // Gets a base directory path of the sandboxed filesystem that is | 121 // Gets a base directory path of the sandboxed filesystem that is |
117 // specified by |origin_url| and |type|. | 122 // specified by |origin_url| and |type|. |
118 // (The path is similar to the origin's root path but doesn't contain | 123 // (The path is similar to the origin's root path but doesn't contain |
119 // the 'unique' part.) | 124 // the 'unique' part.) |
120 // Returns an empty path if the given type is invalid. | 125 // Returns an empty path if the given type is invalid. |
121 // This method can only be called on the file thread. | 126 // This method can only be called on the file thread. |
122 FilePath GetBaseDirectoryForOriginAndType( | 127 FilePath GetBaseDirectoryForOriginAndType( |
123 const GURL& origin_url, | 128 const GURL& origin_url, |
124 FileSystemType type, | 129 FileSystemType type, |
125 bool create) const; | 130 bool create) const; |
126 | 131 |
127 // Deletes the data on the origin and reports the amount of deleted data | 132 // Deletes the data on the origin and reports the amount of deleted data |
128 // to the quota manager via |proxy|. | 133 // to the quota manager via |proxy|. |
129 bool DeleteOriginDataOnFileThread( | 134 base::PlatformFileError DeleteOriginDataOnFileThread( |
130 FileSystemContext* context, | 135 FileSystemContext* context, |
131 quota::QuotaManagerProxy* proxy, | 136 quota::QuotaManagerProxy* proxy, |
132 const GURL& origin_url, | 137 const GURL& origin_url, |
133 FileSystemType type); | 138 FileSystemType type); |
134 | 139 |
135 // Quota util methods. | 140 // Quota util methods. |
136 virtual void GetOriginsForTypeOnFileThread( | 141 virtual void GetOriginsForTypeOnFileThread( |
137 FileSystemType type, | 142 FileSystemType type, |
138 std::set<GURL>* origins) OVERRIDE; | 143 std::set<GURL>* origins) OVERRIDE; |
139 virtual void GetOriginsForHostOnFileThread( | 144 virtual void GetOriginsForHostOnFileThread( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 base::Time next_release_time_for_open_filesystem_stat_; | 200 base::Time next_release_time_for_open_filesystem_stat_; |
196 | 201 |
197 base::WeakPtrFactory<SandboxMountPointProvider> weak_factory_; | 202 base::WeakPtrFactory<SandboxMountPointProvider> weak_factory_; |
198 | 203 |
199 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); | 204 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); |
200 }; | 205 }; |
201 | 206 |
202 } // namespace fileapi | 207 } // namespace fileapi |
203 | 208 |
204 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ | 209 #endif // WEBKIT_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ |
OLD | NEW |