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 WEBKIT_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "webkit/browser/fileapi/file_system_backend.h" | 13 #include "webkit/browser/fileapi/file_system_backend.h" |
14 #include "webkit/browser/fileapi/file_system_options.h" | 14 #include "webkit/browser/fileapi/file_system_options.h" |
15 #include "webkit/browser/fileapi/file_system_quota_util.h" | 15 #include "webkit/browser/fileapi/file_system_quota_util.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class SequencedTaskRunner; | 18 class SequencedTaskRunner; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class PluginPrivateFileSystemBackendTest; | 22 class PluginPrivateFileSystemBackendTest; |
23 } | 23 } |
24 | 24 |
25 namespace quota { | 25 namespace storage { |
26 class SpecialStoragePolicy; | 26 class SpecialStoragePolicy; |
27 } | 27 } |
28 | 28 |
29 namespace fileapi { | 29 namespace storage { |
30 | 30 |
31 class ObfuscatedFileUtil; | 31 class ObfuscatedFileUtil; |
32 | 32 |
33 class WEBKIT_STORAGE_BROWSER_EXPORT PluginPrivateFileSystemBackend | 33 class WEBKIT_STORAGE_BROWSER_EXPORT PluginPrivateFileSystemBackend |
34 : public FileSystemBackend, | 34 : public FileSystemBackend, |
35 public FileSystemQuotaUtil { | 35 public FileSystemQuotaUtil { |
36 public: | 36 public: |
37 class FileSystemIDToPluginMap; | 37 class FileSystemIDToPluginMap; |
38 typedef base::Callback<void(base::File::Error result)> StatusCallback; | 38 typedef base::Callback<void(base::File::Error result)> StatusCallback; |
39 | 39 |
40 PluginPrivateFileSystemBackend( | 40 PluginPrivateFileSystemBackend( |
41 base::SequencedTaskRunner* file_task_runner, | 41 base::SequencedTaskRunner* file_task_runner, |
42 const base::FilePath& profile_path, | 42 const base::FilePath& profile_path, |
43 quota::SpecialStoragePolicy* special_storage_policy, | 43 storage::SpecialStoragePolicy* special_storage_policy, |
44 const FileSystemOptions& file_system_options); | 44 const FileSystemOptions& file_system_options); |
45 virtual ~PluginPrivateFileSystemBackend(); | 45 virtual ~PluginPrivateFileSystemBackend(); |
46 | 46 |
47 // This must be used to open 'private' filesystem instead of regular | 47 // This must be used to open 'private' filesystem instead of regular |
48 // OpenFileSystem. | 48 // OpenFileSystem. |
49 // |plugin_id| must be an identifier string for per-plugin | 49 // |plugin_id| must be an identifier string for per-plugin |
50 // isolation, e.g. name, MIME type etc. | 50 // isolation, e.g. name, MIME type etc. |
51 // NOTE: |plugin_id| must be sanitized ASCII string that doesn't | 51 // NOTE: |plugin_id| must be sanitized ASCII string that doesn't |
52 // include *any* dangerous character like '/'. | 52 // include *any* dangerous character like '/'. |
53 void OpenPrivateFileSystem( | 53 void OpenPrivateFileSystem( |
(...skipping 13 matching lines...) Expand all Loading... |
67 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; | 67 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; |
68 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( | 68 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
69 FileSystemType type, | 69 FileSystemType type, |
70 base::File::Error* error_code) OVERRIDE; | 70 base::File::Error* error_code) OVERRIDE; |
71 virtual FileSystemOperation* CreateFileSystemOperation( | 71 virtual FileSystemOperation* CreateFileSystemOperation( |
72 const FileSystemURL& url, | 72 const FileSystemURL& url, |
73 FileSystemContext* context, | 73 FileSystemContext* context, |
74 base::File::Error* error_code) const OVERRIDE; | 74 base::File::Error* error_code) const OVERRIDE; |
75 virtual bool SupportsStreaming(const FileSystemURL& url) const OVERRIDE; | 75 virtual bool SupportsStreaming(const FileSystemURL& url) const OVERRIDE; |
76 virtual bool HasInplaceCopyImplementation( | 76 virtual bool HasInplaceCopyImplementation( |
77 fileapi::FileSystemType type) const OVERRIDE; | 77 storage::FileSystemType type) const OVERRIDE; |
78 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( | 78 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
79 const FileSystemURL& url, | 79 const FileSystemURL& url, |
80 int64 offset, | 80 int64 offset, |
81 const base::Time& expected_modification_time, | 81 const base::Time& expected_modification_time, |
82 FileSystemContext* context) const OVERRIDE; | 82 FileSystemContext* context) const OVERRIDE; |
83 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( | 83 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( |
84 const FileSystemURL& url, | 84 const FileSystemURL& url, |
85 int64 offset, | 85 int64 offset, |
86 FileSystemContext* context) const OVERRIDE; | 86 FileSystemContext* context) const OVERRIDE; |
87 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; | 87 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; |
88 | 88 |
89 // FileSystemQuotaUtil overrides. | 89 // FileSystemQuotaUtil overrides. |
90 virtual base::File::Error DeleteOriginDataOnFileTaskRunner( | 90 virtual base::File::Error DeleteOriginDataOnFileTaskRunner( |
91 FileSystemContext* context, | 91 FileSystemContext* context, |
92 quota::QuotaManagerProxy* proxy, | 92 storage::QuotaManagerProxy* proxy, |
93 const GURL& origin_url, | 93 const GURL& origin_url, |
94 FileSystemType type) OVERRIDE; | 94 FileSystemType type) OVERRIDE; |
95 virtual void GetOriginsForTypeOnFileTaskRunner( | 95 virtual void GetOriginsForTypeOnFileTaskRunner( |
96 FileSystemType type, | 96 FileSystemType type, |
97 std::set<GURL>* origins) OVERRIDE; | 97 std::set<GURL>* origins) OVERRIDE; |
98 virtual void GetOriginsForHostOnFileTaskRunner( | 98 virtual void GetOriginsForHostOnFileTaskRunner( |
99 FileSystemType type, | 99 FileSystemType type, |
100 const std::string& host, | 100 const std::string& host, |
101 std::set<GURL>* origins) OVERRIDE; | 101 std::set<GURL>* origins) OVERRIDE; |
102 virtual int64 GetOriginUsageOnFileTaskRunner( | 102 virtual int64 GetOriginUsageOnFileTaskRunner( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 135 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
136 const FileSystemOptions file_system_options_; | 136 const FileSystemOptions file_system_options_; |
137 const base::FilePath base_path_; | 137 const base::FilePath base_path_; |
138 scoped_ptr<AsyncFileUtil> file_util_; | 138 scoped_ptr<AsyncFileUtil> file_util_; |
139 FileSystemIDToPluginMap* plugin_map_; // Owned by file_util_. | 139 FileSystemIDToPluginMap* plugin_map_; // Owned by file_util_. |
140 base::WeakPtrFactory<PluginPrivateFileSystemBackend> weak_factory_; | 140 base::WeakPtrFactory<PluginPrivateFileSystemBackend> weak_factory_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(PluginPrivateFileSystemBackend); | 142 DISALLOW_COPY_AND_ASSIGN(PluginPrivateFileSystemBackend); |
143 }; | 143 }; |
144 | 144 |
145 } // namespace fileapi | 145 } // namespace storage |
146 | 146 |
147 #endif // WEBKIT_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ | 147 #endif // WEBKIT_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |