| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ |
| 6 #define WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 | 10 |
| 11 class FilePath; | 11 class FilePath; |
| 12 class GURL; | 12 class GURL; |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class FileUtilProxyBase; |
| 15 class MessageLoopProxy; | 16 class MessageLoopProxy; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace fileapi { | 19 namespace fileapi { |
| 19 | 20 |
| 20 class FileSystemPathManager; | 21 class FileSystemPathManager; |
| 21 class FileSystemQuotaManager; | 22 class FileSystemQuotaManager; |
| 23 class ObfuscatedFileUtilProxy; |
| 22 class SandboxedFileSystemContext; | 24 class SandboxedFileSystemContext; |
| 23 | 25 |
| 24 struct DefaultContextDeleter; | 26 struct DefaultContextDeleter; |
| 25 | 27 |
| 26 // This class keeps and provides a sandboxed file system context. | 28 // This class keeps and provides a sandboxed file system context. |
| 27 class SandboxedFileSystemContext | 29 class SandboxedFileSystemContext |
| 28 : public base::RefCountedThreadSafe<SandboxedFileSystemContext, | 30 : public base::RefCountedThreadSafe<SandboxedFileSystemContext, |
| 29 DefaultContextDeleter> { | 31 DefaultContextDeleter> { |
| 30 public: | 32 public: |
| 31 SandboxedFileSystemContext( | 33 SandboxedFileSystemContext( |
| 32 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 34 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 33 scoped_refptr<base::MessageLoopProxy> io_message_loop, | 35 scoped_refptr<base::MessageLoopProxy> io_message_loop, |
| 34 const FilePath& profile_path, | 36 const FilePath& profile_path, |
| 35 bool is_incognito, | 37 bool is_incognito, |
| 36 bool allow_file_access_from_files, | 38 bool allow_file_access_from_files, |
| 37 bool unlimited_quota); | 39 bool unlimited_quota, |
| 40 bool obfuscate = false); |
| 38 ~SandboxedFileSystemContext(); | 41 ~SandboxedFileSystemContext(); |
| 39 | 42 |
| 40 void Shutdown(); | 43 void Shutdown(); |
| 41 | 44 |
| 42 void DeleteDataForOriginOnFileThread(const GURL& origin_url); | 45 void DeleteDataForOriginOnFileThread(const GURL& origin_url); |
| 43 | 46 |
| 44 // Quota related methods. | 47 // Quota related methods. |
| 45 void SetOriginQuotaUnlimited(const GURL& url); | 48 void SetOriginQuotaUnlimited(const GURL& url); |
| 46 void ResetOriginQuotaUnlimited(const GURL& url); | 49 void ResetOriginQuotaUnlimited(const GURL& url); |
| 47 | 50 |
| 48 FileSystemPathManager* path_manager() { return path_manager_.get(); } | 51 FileSystemPathManager* path_manager() { return path_manager_.get(); } |
| 49 FileSystemQuotaManager* quota_manager() { return quota_manager_.get(); } | 52 FileSystemQuotaManager* quota_manager() { return quota_manager_.get(); } |
| 50 | 53 base::FileUtilProxyBase* file_util_proxy() { return file_util_proxy_; } |
| 51 private: | 54 private: |
| 52 friend struct DefaultContextDeleter; | 55 friend struct DefaultContextDeleter; |
| 53 void DeleteOnCorrectThread() const; | 56 void DeleteOnCorrectThread() const; |
| 54 | 57 |
| 55 bool allow_file_access_from_files_; | 58 bool allow_file_access_from_files_; |
| 56 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 59 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
| 57 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 60 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 58 scoped_ptr<FileSystemPathManager> path_manager_; | 61 scoped_ptr<FileSystemPathManager> path_manager_; |
| 59 scoped_ptr<FileSystemQuotaManager> quota_manager_; | 62 scoped_ptr<FileSystemQuotaManager> quota_manager_; |
| 63 base::FileUtilProxyBase* file_util_proxy_; |
| 64 bool delete_file_util_proxy_; |
| 60 | 65 |
| 61 DISALLOW_IMPLICIT_CONSTRUCTORS(SandboxedFileSystemContext); | 66 DISALLOW_IMPLICIT_CONSTRUCTORS(SandboxedFileSystemContext); |
| 62 }; | 67 }; |
| 63 | 68 |
| 64 struct DefaultContextDeleter { | 69 struct DefaultContextDeleter { |
| 65 static void Destruct(const SandboxedFileSystemContext* context) { | 70 static void Destruct(const SandboxedFileSystemContext* context) { |
| 66 context->DeleteOnCorrectThread(); | 71 context->DeleteOnCorrectThread(); |
| 67 } | 72 } |
| 68 }; | 73 }; |
| 69 | 74 |
| 70 } // namespace fileapi | 75 } // namespace fileapi |
| 71 | 76 |
| 72 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ | 77 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |