| 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 | 29 |
| 30 // An interface to construct or crack sandboxed filesystem paths. | 30 // An interface to construct or crack sandboxed filesystem paths. |
| 31 // Currently each sandboxed filesystem path looks like (soon will be changed): | 31 // Currently each sandboxed filesystem path looks like (soon will be changed): |
| 32 // <profile_dir>/FileSystem/<origin_identifier>/<type>/chrome-<unique>/... | 32 // <profile_dir>/FileSystem/<origin_identifier>/<type>/chrome-<unique>/... |
| 33 // <type> is either one of "Temporary" or "Persistent". | 33 // <type> is either one of "Temporary" or "Persistent". |
| 34 class SandboxMountPointProvider | 34 class SandboxMountPointProvider |
| 35 : public FileSystemMountPointProvider, | 35 : public FileSystemMountPointProvider, |
| 36 public FileSystemQuotaUtil { | 36 public FileSystemQuotaUtil { |
| 37 public: | 37 public: |
| 38 // Origin enumerator interface. | 38 // Origin enumerator interface. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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* GetFileSystemFileUtil(); | 111 virtual FileSystemFileUtil* GetFileUtil(); |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 friend class SandboxMountPointProviderOriginEnumeratorTest; | 164 friend class SandboxMountPointProviderOriginEnumeratorTest; |
| 165 | 165 |
| 166 // The path_manager_ isn't owned by this instance; this instance is owned by | 166 // The path_manager_ isn't owned by this instance; this instance is owned by |
| 167 // the path_manager_, and they have the same lifetime. | 167 // the path_manager_, and they have the same lifetime. |
| 168 FileSystemPathManager* path_manager_; | 168 FileSystemPathManager* path_manager_; |
| 169 | 169 |
| 170 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 170 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
| 171 | 171 |
| 172 const FilePath profile_path_; | 172 const FilePath profile_path_; |
| 173 | 173 |
| 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 |