| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ |
| 6 #define STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ | 6 #define STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 public FileSystemQuotaUtil { | 37 public FileSystemQuotaUtil { |
| 38 public: | 38 public: |
| 39 class FileSystemIDToPluginMap; | 39 class FileSystemIDToPluginMap; |
| 40 typedef base::Callback<void(base::File::Error result)> StatusCallback; | 40 typedef base::Callback<void(base::File::Error result)> StatusCallback; |
| 41 | 41 |
| 42 PluginPrivateFileSystemBackend( | 42 PluginPrivateFileSystemBackend( |
| 43 base::SequencedTaskRunner* file_task_runner, | 43 base::SequencedTaskRunner* file_task_runner, |
| 44 const base::FilePath& profile_path, | 44 const base::FilePath& profile_path, |
| 45 storage::SpecialStoragePolicy* special_storage_policy, | 45 storage::SpecialStoragePolicy* special_storage_policy, |
| 46 const FileSystemOptions& file_system_options); | 46 const FileSystemOptions& file_system_options); |
| 47 virtual ~PluginPrivateFileSystemBackend(); | 47 ~PluginPrivateFileSystemBackend() override; |
| 48 | 48 |
| 49 // This must be used to open 'private' filesystem instead of regular | 49 // This must be used to open 'private' filesystem instead of regular |
| 50 // OpenFileSystem. | 50 // OpenFileSystem. |
| 51 // |plugin_id| must be an identifier string for per-plugin | 51 // |plugin_id| must be an identifier string for per-plugin |
| 52 // isolation, e.g. name, MIME type etc. | 52 // isolation, e.g. name, MIME type etc. |
| 53 // NOTE: |plugin_id| must be sanitized ASCII string that doesn't | 53 // NOTE: |plugin_id| must be sanitized ASCII string that doesn't |
| 54 // include *any* dangerous character like '/'. | 54 // include *any* dangerous character like '/'. |
| 55 void OpenPrivateFileSystem( | 55 void OpenPrivateFileSystem( |
| 56 const GURL& origin_url, | 56 const GURL& origin_url, |
| 57 FileSystemType type, | 57 FileSystemType type, |
| 58 const std::string& filesystem_id, | 58 const std::string& filesystem_id, |
| 59 const std::string& plugin_id, | 59 const std::string& plugin_id, |
| 60 OpenFileSystemMode mode, | 60 OpenFileSystemMode mode, |
| 61 const StatusCallback& callback); | 61 const StatusCallback& callback); |
| 62 | 62 |
| 63 // FileSystemBackend overrides. | 63 // FileSystemBackend overrides. |
| 64 virtual bool CanHandleType(FileSystemType type) const override; | 64 bool CanHandleType(FileSystemType type) const override; |
| 65 virtual void Initialize(FileSystemContext* context) override; | 65 void Initialize(FileSystemContext* context) override; |
| 66 virtual void ResolveURL(const FileSystemURL& url, | 66 void ResolveURL(const FileSystemURL& url, |
| 67 OpenFileSystemMode mode, | 67 OpenFileSystemMode mode, |
| 68 const OpenFileSystemCallback& callback) override; | 68 const OpenFileSystemCallback& callback) override; |
| 69 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) override; | 69 AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) override; |
| 70 virtual WatcherManager* GetWatcherManager(FileSystemType type) override; | 70 WatcherManager* GetWatcherManager(FileSystemType type) override; |
| 71 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( | 71 CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
| 72 FileSystemType type, | 72 FileSystemType type, |
| 73 base::File::Error* error_code) override; | 73 base::File::Error* error_code) override; |
| 74 virtual FileSystemOperation* CreateFileSystemOperation( | 74 FileSystemOperation* CreateFileSystemOperation( |
| 75 const FileSystemURL& url, | 75 const FileSystemURL& url, |
| 76 FileSystemContext* context, | 76 FileSystemContext* context, |
| 77 base::File::Error* error_code) const override; | 77 base::File::Error* error_code) const override; |
| 78 virtual bool SupportsStreaming(const FileSystemURL& url) const override; | 78 bool SupportsStreaming(const FileSystemURL& url) const override; |
| 79 virtual bool HasInplaceCopyImplementation( | 79 bool HasInplaceCopyImplementation( |
| 80 storage::FileSystemType type) const override; | 80 storage::FileSystemType type) const override; |
| 81 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( | 81 scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
| 82 const FileSystemURL& url, | 82 const FileSystemURL& url, |
| 83 int64 offset, | 83 int64 offset, |
| 84 int64 max_bytes_to_read, | 84 int64 max_bytes_to_read, |
| 85 const base::Time& expected_modification_time, | 85 const base::Time& expected_modification_time, |
| 86 FileSystemContext* context) const override; | 86 FileSystemContext* context) const override; |
| 87 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( | 87 scoped_ptr<FileStreamWriter> CreateFileStreamWriter( |
| 88 const FileSystemURL& url, | 88 const FileSystemURL& url, |
| 89 int64 offset, | 89 int64 offset, |
| 90 FileSystemContext* context) const override; | 90 FileSystemContext* context) const override; |
| 91 virtual FileSystemQuotaUtil* GetQuotaUtil() override; | 91 FileSystemQuotaUtil* GetQuotaUtil() override; |
| 92 virtual const UpdateObserverList* GetUpdateObservers( | 92 const UpdateObserverList* GetUpdateObservers( |
| 93 FileSystemType type) const override; | 93 FileSystemType type) const override; |
| 94 virtual const ChangeObserverList* GetChangeObservers( | 94 const ChangeObserverList* GetChangeObservers( |
| 95 FileSystemType type) const override; | 95 FileSystemType type) const override; |
| 96 virtual const AccessObserverList* GetAccessObservers( | 96 const AccessObserverList* GetAccessObservers( |
| 97 FileSystemType type) const override; | 97 FileSystemType type) const override; |
| 98 | 98 |
| 99 // FileSystemQuotaUtil overrides. | 99 // FileSystemQuotaUtil overrides. |
| 100 virtual base::File::Error DeleteOriginDataOnFileTaskRunner( | 100 base::File::Error DeleteOriginDataOnFileTaskRunner( |
| 101 FileSystemContext* context, | 101 FileSystemContext* context, |
| 102 storage::QuotaManagerProxy* proxy, | 102 storage::QuotaManagerProxy* proxy, |
| 103 const GURL& origin_url, | 103 const GURL& origin_url, |
| 104 FileSystemType type) override; | 104 FileSystemType type) override; |
| 105 virtual void GetOriginsForTypeOnFileTaskRunner( | 105 void GetOriginsForTypeOnFileTaskRunner(FileSystemType type, |
| 106 FileSystemType type, | 106 std::set<GURL>* origins) override; |
| 107 std::set<GURL>* origins) override; | 107 void GetOriginsForHostOnFileTaskRunner(FileSystemType type, |
| 108 virtual void GetOriginsForHostOnFileTaskRunner( | 108 const std::string& host, |
| 109 FileSystemType type, | 109 std::set<GURL>* origins) override; |
| 110 const std::string& host, | 110 int64 GetOriginUsageOnFileTaskRunner(FileSystemContext* context, |
| 111 std::set<GURL>* origins) override; | 111 const GURL& origin_url, |
| 112 virtual int64 GetOriginUsageOnFileTaskRunner( | 112 FileSystemType type) override; |
| 113 FileSystemContext* context, | 113 scoped_refptr<QuotaReservation> CreateQuotaReservationOnFileTaskRunner( |
| 114 const GURL& origin_url, | 114 const GURL& origin_url, |
| 115 FileSystemType type) override; | 115 FileSystemType type) override; |
| 116 virtual scoped_refptr<QuotaReservation> | |
| 117 CreateQuotaReservationOnFileTaskRunner( | |
| 118 const GURL& origin_url, | |
| 119 FileSystemType type) override; | |
| 120 | 116 |
| 121 private: | 117 private: |
| 122 friend class content::PluginPrivateFileSystemBackendTest; | 118 friend class content::PluginPrivateFileSystemBackendTest; |
| 123 | 119 |
| 124 ObfuscatedFileUtil* obfuscated_file_util(); | 120 ObfuscatedFileUtil* obfuscated_file_util(); |
| 125 const base::FilePath& base_path() const { return base_path_; } | 121 const base::FilePath& base_path() const { return base_path_; } |
| 126 | 122 |
| 127 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 123 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
| 128 const FileSystemOptions file_system_options_; | 124 const FileSystemOptions file_system_options_; |
| 129 const base::FilePath base_path_; | 125 const base::FilePath base_path_; |
| 130 scoped_ptr<AsyncFileUtil> file_util_; | 126 scoped_ptr<AsyncFileUtil> file_util_; |
| 131 FileSystemIDToPluginMap* plugin_map_; // Owned by file_util_. | 127 FileSystemIDToPluginMap* plugin_map_; // Owned by file_util_. |
| 132 base::WeakPtrFactory<PluginPrivateFileSystemBackend> weak_factory_; | 128 base::WeakPtrFactory<PluginPrivateFileSystemBackend> weak_factory_; |
| 133 | 129 |
| 134 DISALLOW_COPY_AND_ASSIGN(PluginPrivateFileSystemBackend); | 130 DISALLOW_COPY_AND_ASSIGN(PluginPrivateFileSystemBackend); |
| 135 }; | 131 }; |
| 136 | 132 |
| 137 } // namespace storage | 133 } // namespace storage |
| 138 | 134 |
| 139 #endif // STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ | 135 #endif // STORAGE_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ |
| OLD | NEW |