| 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_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
| 16 #include "base/sequenced_task_runner_helpers.h" | 16 #include "base/sequenced_task_runner_helpers.h" |
| 17 #include "webkit/fileapi/file_system_types.h" | 17 #include "webkit/fileapi/file_system_types.h" |
| 18 #include "webkit/fileapi/file_system_url.h" | 18 #include "webkit/fileapi/file_system_url.h" |
| 19 #include "webkit/fileapi/task_runner_bound_observer_list.h" | 19 #include "webkit/fileapi/task_runner_bound_observer_list.h" |
| 20 #include "webkit/storage/webkit_storage_export.h" | 20 #include "webkit/storage/webkit_storage_export.h" |
| 21 | 21 |
| 22 namespace base { |
| 22 class FilePath; | 23 class FilePath; |
| 24 } |
| 23 | 25 |
| 24 namespace quota { | 26 namespace quota { |
| 25 class QuotaManagerProxy; | 27 class QuotaManagerProxy; |
| 26 class SpecialStoragePolicy; | 28 class SpecialStoragePolicy; |
| 27 } | 29 } |
| 28 | 30 |
| 29 namespace webkit_blob { | 31 namespace webkit_blob { |
| 30 class BlobURLRequestJobTest; | 32 class BlobURLRequestJobTest; |
| 31 class FileStreamReader; | 33 class FileStreamReader; |
| 32 } | 34 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // |external_mount_points| contains non-system external mount points available | 70 // |external_mount_points| contains non-system external mount points available |
| 69 // in the context. If not NULL, it will be used during URL cracking. On | 71 // in the context. If not NULL, it will be used during URL cracking. On |
| 70 // ChromeOS, it will be passed to external_mount_point_provider. | 72 // ChromeOS, it will be passed to external_mount_point_provider. |
| 71 // |external_mount_points| may be NULL only on platforms different from | 73 // |external_mount_points| may be NULL only on platforms different from |
| 72 // ChromeOS (i.e. platforms that don't use external_mount_point_provider). | 74 // ChromeOS (i.e. platforms that don't use external_mount_point_provider). |
| 73 FileSystemContext( | 75 FileSystemContext( |
| 74 scoped_ptr<FileSystemTaskRunners> task_runners, | 76 scoped_ptr<FileSystemTaskRunners> task_runners, |
| 75 ExternalMountPoints* external_mount_points, | 77 ExternalMountPoints* external_mount_points, |
| 76 quota::SpecialStoragePolicy* special_storage_policy, | 78 quota::SpecialStoragePolicy* special_storage_policy, |
| 77 quota::QuotaManagerProxy* quota_manager_proxy, | 79 quota::QuotaManagerProxy* quota_manager_proxy, |
| 78 const FilePath& partition_path, | 80 const base::FilePath& partition_path, |
| 79 const FileSystemOptions& options); | 81 const FileSystemOptions& options); |
| 80 | 82 |
| 81 bool DeleteDataForOriginOnFileThread(const GURL& origin_url); | 83 bool DeleteDataForOriginOnFileThread(const GURL& origin_url); |
| 82 | 84 |
| 83 quota::QuotaManagerProxy* quota_manager_proxy() const { | 85 quota::QuotaManagerProxy* quota_manager_proxy() const { |
| 84 return quota_manager_proxy_.get(); | 86 return quota_manager_proxy_.get(); |
| 85 } | 87 } |
| 86 | 88 |
| 87 // Returns a quota util for a given filesystem type. This may | 89 // Returns a quota util for a given filesystem type. This may |
| 88 // return NULL if the type does not support the usage tracking or | 90 // return NULL if the type does not support the usage tracking or |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 FileSystemMountPointProvider* provider); | 181 FileSystemMountPointProvider* provider); |
| 180 | 182 |
| 181 FileSystemTaskRunners* task_runners() { return task_runners_.get(); } | 183 FileSystemTaskRunners* task_runners() { return task_runners_.get(); } |
| 182 | 184 |
| 183 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } | 185 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } |
| 184 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker); | 186 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker); |
| 185 | 187 |
| 186 LocalFileSyncContext* sync_context() { return sync_context_.get(); } | 188 LocalFileSyncContext* sync_context() { return sync_context_.get(); } |
| 187 void set_sync_context(LocalFileSyncContext* sync_context); | 189 void set_sync_context(LocalFileSyncContext* sync_context); |
| 188 | 190 |
| 189 const FilePath& partition_path() const { return partition_path_; } | 191 const base::FilePath& partition_path() const { return partition_path_; } |
| 190 | 192 |
| 191 // Same as |CrackFileSystemURL|, but cracks FileSystemURL created from |url|. | 193 // Same as |CrackFileSystemURL|, but cracks FileSystemURL created from |url|. |
| 192 FileSystemURL CrackURL(const GURL& url) const; | 194 FileSystemURL CrackURL(const GURL& url) const; |
| 193 // Same as |CrackFileSystemURL|, but cracks FileSystemURL created from method | 195 // Same as |CrackFileSystemURL|, but cracks FileSystemURL created from method |
| 194 // arguments. | 196 // arguments. |
| 195 FileSystemURL CreateCrackedFileSystemURL(const GURL& origin, | 197 FileSystemURL CreateCrackedFileSystemURL(const GURL& origin, |
| 196 FileSystemType type, | 198 FileSystemType type, |
| 197 const FilePath& path) const; | 199 const base::FilePath& path) const; |
| 198 | 200 |
| 199 private: | 201 private: |
| 200 // Friended for GetFileUtil. | 202 // Friended for GetFileUtil. |
| 201 // These classes know the target filesystem (i.e. sandbox filesystem) | 203 // These classes know the target filesystem (i.e. sandbox filesystem) |
| 202 // supports synchronous FileUtil. | 204 // supports synchronous FileUtil. |
| 203 friend class LocalFileSystemOperation; | 205 friend class LocalFileSystemOperation; |
| 204 friend class LocalFileChangeTracker; | 206 friend class LocalFileChangeTracker; |
| 205 friend class LocalFileSyncContext; | 207 friend class LocalFileSyncContext; |
| 206 | 208 |
| 207 // Friended for GetFileUtil. | 209 // Friended for GetFileUtil. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 252 |
| 251 // External mount points visible in the file system context (excluding system | 253 // External mount points visible in the file system context (excluding system |
| 252 // external mount points). | 254 // external mount points). |
| 253 scoped_refptr<ExternalMountPoints> external_mount_points_; | 255 scoped_refptr<ExternalMountPoints> external_mount_points_; |
| 254 | 256 |
| 255 // MountPoints used to crack FileSystemURLs. The MountPoints are ordered | 257 // MountPoints used to crack FileSystemURLs. The MountPoints are ordered |
| 256 // in order they should try to crack a FileSystemURL. | 258 // in order they should try to crack a FileSystemURL. |
| 257 std::vector<MountPoints*> url_crackers_; | 259 std::vector<MountPoints*> url_crackers_; |
| 258 | 260 |
| 259 // The base path of the storage partition for this context. | 261 // The base path of the storage partition for this context. |
| 260 const FilePath partition_path_; | 262 const base::FilePath partition_path_; |
| 261 | 263 |
| 262 // For syncable file systems. | 264 // For syncable file systems. |
| 263 scoped_ptr<LocalFileChangeTracker> change_tracker_; | 265 scoped_ptr<LocalFileChangeTracker> change_tracker_; |
| 264 scoped_refptr<LocalFileSyncContext> sync_context_; | 266 scoped_refptr<LocalFileSyncContext> sync_context_; |
| 265 | 267 |
| 266 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 268 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
| 267 }; | 269 }; |
| 268 | 270 |
| 269 struct DefaultContextDeleter { | 271 struct DefaultContextDeleter { |
| 270 static void Destruct(const FileSystemContext* context) { | 272 static void Destruct(const FileSystemContext* context) { |
| 271 context->DeleteOnCorrectThread(); | 273 context->DeleteOnCorrectThread(); |
| 272 } | 274 } |
| 273 }; | 275 }; |
| 274 | 276 |
| 275 } // namespace fileapi | 277 } // namespace fileapi |
| 276 | 278 |
| 277 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 279 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |