| 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_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.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 "webkit/browser/fileapi/file_system_backend.h" | 15 #include "storage/browser/fileapi/file_system_backend.h" |
| 16 #include "webkit/browser/fileapi/file_system_quota_util.h" | 16 #include "storage/browser/fileapi/file_system_quota_util.h" |
| 17 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" | 17 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" |
| 18 #include "webkit/browser/fileapi/task_runner_bound_observer_list.h" | 18 #include "storage/browser/fileapi/task_runner_bound_observer_list.h" |
| 19 #include "webkit/browser/quota/special_storage_policy.h" | 19 #include "storage/browser/quota/special_storage_policy.h" |
| 20 #include "webkit/browser/webkit_storage_browser_export.h" | 20 #include "storage/common/storage_export.h" |
| 21 | 21 |
| 22 namespace fileapi { | 22 namespace storage { |
| 23 | 23 |
| 24 // TEMPORARY or PERSISTENT filesystems, which are placed under the user's | 24 // TEMPORARY or PERSISTENT filesystems, which are placed under the user's |
| 25 // profile directory in a sandboxed way. | 25 // profile directory in a sandboxed way. |
| 26 // This interface also lets one enumerate and remove storage for the origins | 26 // This interface also lets one enumerate and remove storage for the origins |
| 27 // that use the filesystem. | 27 // that use the filesystem. |
| 28 class WEBKIT_STORAGE_BROWSER_EXPORT SandboxFileSystemBackend | 28 class STORAGE_EXPORT SandboxFileSystemBackend : public FileSystemBackend { |
| 29 : public FileSystemBackend { | |
| 30 public: | 29 public: |
| 31 explicit SandboxFileSystemBackend(SandboxFileSystemBackendDelegate* delegate); | 30 explicit SandboxFileSystemBackend(SandboxFileSystemBackendDelegate* delegate); |
| 32 virtual ~SandboxFileSystemBackend(); | 31 virtual ~SandboxFileSystemBackend(); |
| 33 | 32 |
| 34 // FileSystemBackend overrides. | 33 // FileSystemBackend overrides. |
| 35 virtual bool CanHandleType(FileSystemType type) const OVERRIDE; | 34 virtual bool CanHandleType(FileSystemType type) const OVERRIDE; |
| 36 virtual void Initialize(FileSystemContext* context) OVERRIDE; | 35 virtual void Initialize(FileSystemContext* context) OVERRIDE; |
| 37 virtual void ResolveURL(const FileSystemURL& url, | 36 virtual void ResolveURL(const FileSystemURL& url, |
| 38 OpenFileSystemMode mode, | 37 OpenFileSystemMode mode, |
| 39 const OpenFileSystemCallback& callback) OVERRIDE; | 38 const OpenFileSystemCallback& callback) OVERRIDE; |
| 40 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; | 39 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; |
| 41 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( | 40 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
| 42 FileSystemType type, | 41 FileSystemType type, |
| 43 base::File::Error* error_code) OVERRIDE; | 42 base::File::Error* error_code) OVERRIDE; |
| 44 virtual FileSystemOperation* CreateFileSystemOperation( | 43 virtual FileSystemOperation* CreateFileSystemOperation( |
| 45 const FileSystemURL& url, | 44 const FileSystemURL& url, |
| 46 FileSystemContext* context, | 45 FileSystemContext* context, |
| 47 base::File::Error* error_code) const OVERRIDE; | 46 base::File::Error* error_code) const OVERRIDE; |
| 48 virtual bool SupportsStreaming(const FileSystemURL& url) const OVERRIDE; | 47 virtual bool SupportsStreaming(const FileSystemURL& url) const OVERRIDE; |
| 49 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( | 48 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
| 50 const FileSystemURL& url, | 49 const FileSystemURL& url, |
| 51 int64 offset, | 50 int64 offset, |
| 52 const base::Time& expected_modification_time, | 51 const base::Time& expected_modification_time, |
| 53 FileSystemContext* context) const OVERRIDE; | 52 FileSystemContext* context) const OVERRIDE; |
| 54 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( | 53 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( |
| 55 const FileSystemURL& url, | 54 const FileSystemURL& url, |
| 56 int64 offset, | 55 int64 offset, |
| 57 FileSystemContext* context) const OVERRIDE; | 56 FileSystemContext* context) const OVERRIDE; |
| 58 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; | 57 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; |
| 59 | 58 |
| 60 // Returns an origin enumerator of this backend. | 59 // Returns an origin enumerator of this backend. |
| 61 // This method can only be called on the file thread. | 60 // This method can only be called on the file thread. |
| 62 SandboxFileSystemBackendDelegate::OriginEnumerator* CreateOriginEnumerator(); | 61 SandboxFileSystemBackendDelegate::OriginEnumerator* CreateOriginEnumerator(); |
| 63 | 62 |
| 64 void set_enable_temporary_file_system_in_incognito(bool enable) { | 63 void set_enable_temporary_file_system_in_incognito(bool enable) { |
| 65 enable_temporary_file_system_in_incognito_ = enable; | 64 enable_temporary_file_system_in_incognito_ = enable; |
| 66 } | 65 } |
| 67 bool enable_temporary_file_system_in_incognito() const { | 66 bool enable_temporary_file_system_in_incognito() const { |
| 68 return enable_temporary_file_system_in_incognito_; | 67 return enable_temporary_file_system_in_incognito_; |
| 69 } | 68 } |
| 70 | 69 |
| 71 | |
| 72 private: | 70 private: |
| 73 SandboxFileSystemBackendDelegate* delegate_; // Not owned. | 71 SandboxFileSystemBackendDelegate* delegate_; // Not owned. |
| 74 | 72 |
| 75 bool enable_temporary_file_system_in_incognito_; | 73 bool enable_temporary_file_system_in_incognito_; |
| 76 | 74 |
| 77 DISALLOW_COPY_AND_ASSIGN(SandboxFileSystemBackend); | 75 DISALLOW_COPY_AND_ASSIGN(SandboxFileSystemBackend); |
| 78 }; | 76 }; |
| 79 | 77 |
| 80 } // namespace fileapi | 78 } // namespace storage |
| 81 | 79 |
| 82 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ | 80 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ |
| OLD | NEW |