| 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 MessageLoopProxy; | 15 class MessageLoopProxy; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace fileapi { | 18 namespace fileapi { |
| 19 | 19 |
| 20 class FileSystemPathManager; | 20 class FileSystemPathManager; |
| 21 class FileSystemQuotaManager; | 21 class FileSystemQuotaManager; |
| 22 class FileSystemUsageTracker; |
| 22 class SandboxedFileSystemContext; | 23 class SandboxedFileSystemContext; |
| 23 | 24 |
| 24 struct DefaultContextDeleter; | 25 struct DefaultContextDeleter; |
| 25 | 26 |
| 26 // This class keeps and provides a sandboxed file system context. | 27 // This class keeps and provides a sandboxed file system context. |
| 27 class SandboxedFileSystemContext | 28 class SandboxedFileSystemContext |
| 28 : public base::RefCountedThreadSafe<SandboxedFileSystemContext, | 29 : public base::RefCountedThreadSafe<SandboxedFileSystemContext, |
| 29 DefaultContextDeleter> { | 30 DefaultContextDeleter> { |
| 30 public: | 31 public: |
| 31 SandboxedFileSystemContext( | 32 SandboxedFileSystemContext( |
| 32 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 33 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 33 scoped_refptr<base::MessageLoopProxy> io_message_loop, | 34 scoped_refptr<base::MessageLoopProxy> io_message_loop, |
| 34 const FilePath& profile_path, | 35 const FilePath& profile_path, |
| 35 bool is_incognito, | 36 bool is_incognito, |
| 36 bool allow_file_access_from_files, | 37 bool allow_file_access_from_files, |
| 37 bool unlimited_quota); | 38 bool unlimited_quota); |
| 38 ~SandboxedFileSystemContext(); | 39 ~SandboxedFileSystemContext(); |
| 39 | 40 |
| 40 void Shutdown(); | 41 void Shutdown(); |
| 41 | 42 |
| 42 void DeleteDataForOriginOnFileThread(const GURL& origin_url); | 43 void DeleteDataForOriginOnFileThread(const GURL& origin_url); |
| 43 | 44 |
| 44 // Quota related methods. | 45 // Quota related methods. |
| 45 void SetOriginQuotaUnlimited(const GURL& url); | 46 void SetOriginQuotaUnlimited(const GURL& url); |
| 46 void ResetOriginQuotaUnlimited(const GURL& url); | 47 void ResetOriginQuotaUnlimited(const GURL& url); |
| 47 | 48 |
| 48 FileSystemPathManager* path_manager() { return path_manager_.get(); } | 49 FileSystemPathManager* path_manager() { return path_manager_.get(); } |
| 49 FileSystemQuotaManager* quota_manager() { return quota_manager_.get(); } | 50 FileSystemQuotaManager* quota_manager() { return quota_manager_.get(); } |
| 51 FileSystemUsageTracker* usage_tracker() { return usage_tracker_.get(); } |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 friend struct DefaultContextDeleter; | 54 friend struct DefaultContextDeleter; |
| 53 void DeleteOnCorrectThread() const; | 55 void DeleteOnCorrectThread() const; |
| 54 | 56 |
| 55 bool allow_file_access_from_files_; | |
| 56 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 57 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
| 57 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 58 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 58 scoped_ptr<FileSystemPathManager> path_manager_; | 59 scoped_ptr<FileSystemPathManager> path_manager_; |
| 59 scoped_ptr<FileSystemQuotaManager> quota_manager_; | 60 scoped_ptr<FileSystemQuotaManager> quota_manager_; |
| 61 scoped_ptr<FileSystemUsageTracker> usage_tracker_; |
| 60 | 62 |
| 61 DISALLOW_IMPLICIT_CONSTRUCTORS(SandboxedFileSystemContext); | 63 DISALLOW_IMPLICIT_CONSTRUCTORS(SandboxedFileSystemContext); |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 struct DefaultContextDeleter { | 66 struct DefaultContextDeleter { |
| 65 static void Destruct(const SandboxedFileSystemContext* context) { | 67 static void Destruct(const SandboxedFileSystemContext* context) { |
| 66 context->DeleteOnCorrectThread(); | 68 context->DeleteOnCorrectThread(); |
| 67 } | 69 } |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 } // namespace fileapi | 72 } // namespace fileapi |
| 71 | 73 |
| 72 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ | 74 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |