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