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> |
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_quota_util.h" | 16 #include "webkit/fileapi/file_system_quota_util.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class MessageLoopProxy; | 19 class MessageLoopProxy; |
20 } | 20 } |
21 | 21 |
22 namespace quota { | 22 namespace quota { |
23 class QuotaManagerProxy; | 23 class QuotaManagerProxy; |
24 } | 24 } |
25 | 25 |
26 namespace fileapi { | 26 namespace fileapi { |
27 | 27 |
28 class ObfuscatedFileSystemFileUtil; | 28 class ObfuscatedFileUtil; |
29 class QuotaFileUtil; | 29 class QuotaFileUtil; |
30 | 30 |
31 // An interface to construct or crack sandboxed filesystem paths. | 31 // An interface to construct or crack sandboxed filesystem paths. |
32 // Currently each sandboxed filesystem path looks like (soon will be changed): | 32 // Currently each sandboxed filesystem path looks like (soon will be changed): |
33 // <profile_dir>/FileSystem/<origin_identifier>/<type>/chrome-<unique>/... | 33 // <profile_dir>/FileSystem/<origin_identifier>/<type>/chrome-<unique>/... |
34 // <type> is either one of "Temporary" or "Persistent". | 34 // <type> is either one of "Temporary" or "Persistent". |
35 class SandboxMountPointProvider | 35 class SandboxMountPointProvider |
36 : public FileSystemMountPointProvider, | 36 : public FileSystemMountPointProvider, |
37 public FileSystemQuotaUtil { | 37 public FileSystemQuotaUtil { |
38 public: | 38 public: |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // specified by |origin_url| and |type|. | 102 // specified by |origin_url| and |type|. |
103 // (The path is similar to the origin's root path but doesn't contain | 103 // (The path is similar to the origin's root path but doesn't contain |
104 // the 'unique' part.) | 104 // the 'unique' part.) |
105 // Returns an empty path if the given type is invalid. | 105 // Returns an empty path if the given type is invalid. |
106 // This method can only be called on the file thread. | 106 // This method can only be called on the file thread. |
107 FilePath GetBaseDirectoryForOriginAndType( | 107 FilePath GetBaseDirectoryForOriginAndType( |
108 const GURL& origin_url, | 108 const GURL& origin_url, |
109 FileSystemType type, | 109 FileSystemType type, |
110 bool create) const; | 110 bool create) const; |
111 | 111 |
112 virtual FileSystemFileUtil* GetFileSystemFileUtil(); | 112 virtual FileApiFileUtil* GetFileUtil(); |
113 | 113 |
114 // Deletes the data on the origin and reports the amount of deleted data | 114 // Deletes the data on the origin and reports the amount of deleted data |
115 // to the quota manager via |proxy|. | 115 // to the quota manager via |proxy|. |
116 bool DeleteOriginDataOnFileThread( | 116 bool DeleteOriginDataOnFileThread( |
117 quota::QuotaManagerProxy* proxy, | 117 quota::QuotaManagerProxy* proxy, |
118 const GURL& origin_url, | 118 const GURL& origin_url, |
119 FileSystemType type); | 119 FileSystemType type); |
120 | 120 |
121 // Quota util methods. | 121 // Quota util methods. |
122 virtual void GetOriginsForTypeOnFileThread( | 122 virtual void GetOriginsForTypeOnFileThread( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 // The path_manager_ isn't owned by this instance; this instance is owned by | 165 // The path_manager_ isn't owned by this instance; this instance is owned by |
166 // the path_manager_, and they have the same lifetime. | 166 // the path_manager_, and they have the same lifetime. |
167 FileSystemPathManager* path_manager_; | 167 FileSystemPathManager* path_manager_; |
168 | 168 |
169 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 169 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
170 | 170 |
171 const FilePath profile_path_; | 171 const FilePath profile_path_; |
172 | 172 |
173 QuotaFileUtil *quota_file_util_; | 173 QuotaFileUtil *quota_file_util_; |
174 scoped_refptr<ObfuscatedFileSystemFileUtil> sandbox_file_util_; | 174 scoped_refptr<ObfuscatedFileUtil> sandbox_file_util_; |
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 |