Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: webkit/browser/fileapi/plugin_private_file_system_backend.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_
6 #define WEBKIT_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_
7
8 #include <set>
9 #include <string>
10
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "webkit/browser/fileapi/file_system_backend.h"
14 #include "webkit/browser/fileapi/file_system_options.h"
15 #include "webkit/browser/fileapi/file_system_quota_util.h"
16
17 namespace base {
18 class SequencedTaskRunner;
19 }
20
21 namespace content {
22 class PluginPrivateFileSystemBackendTest;
23 }
24
25 namespace quota {
26 class SpecialStoragePolicy;
27 }
28
29 namespace fileapi {
30
31 class ObfuscatedFileUtil;
32
33 class WEBKIT_STORAGE_BROWSER_EXPORT PluginPrivateFileSystemBackend
34 : public FileSystemBackend,
35 public FileSystemQuotaUtil {
36 public:
37 class FileSystemIDToPluginMap;
38 typedef base::Callback<void(base::File::Error result)> StatusCallback;
39
40 PluginPrivateFileSystemBackend(
41 base::SequencedTaskRunner* file_task_runner,
42 const base::FilePath& profile_path,
43 quota::SpecialStoragePolicy* special_storage_policy,
44 const FileSystemOptions& file_system_options);
45 virtual ~PluginPrivateFileSystemBackend();
46
47 // This must be used to open 'private' filesystem instead of regular
48 // OpenFileSystem.
49 // |plugin_id| must be an identifier string for per-plugin
50 // isolation, e.g. name, MIME type etc.
51 // NOTE: |plugin_id| must be sanitized ASCII string that doesn't
52 // include *any* dangerous character like '/'.
53 void OpenPrivateFileSystem(
54 const GURL& origin_url,
55 FileSystemType type,
56 const std::string& filesystem_id,
57 const std::string& plugin_id,
58 OpenFileSystemMode mode,
59 const StatusCallback& callback);
60
61 // FileSystemBackend overrides.
62 virtual bool CanHandleType(FileSystemType type) const OVERRIDE;
63 virtual void Initialize(FileSystemContext* context) OVERRIDE;
64 virtual void ResolveURL(const FileSystemURL& url,
65 OpenFileSystemMode mode,
66 const OpenFileSystemCallback& callback) OVERRIDE;
67 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
68 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
69 FileSystemType type,
70 base::File::Error* error_code) OVERRIDE;
71 virtual FileSystemOperation* CreateFileSystemOperation(
72 const FileSystemURL& url,
73 FileSystemContext* context,
74 base::File::Error* error_code) const OVERRIDE;
75 virtual bool SupportsStreaming(const FileSystemURL& url) const OVERRIDE;
76 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
77 const FileSystemURL& url,
78 int64 offset,
79 const base::Time& expected_modification_time,
80 FileSystemContext* context) const OVERRIDE;
81 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter(
82 const FileSystemURL& url,
83 int64 offset,
84 FileSystemContext* context) const OVERRIDE;
85 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
86
87 // FileSystemQuotaUtil overrides.
88 virtual base::File::Error DeleteOriginDataOnFileTaskRunner(
89 FileSystemContext* context,
90 quota::QuotaManagerProxy* proxy,
91 const GURL& origin_url,
92 FileSystemType type) OVERRIDE;
93 virtual void GetOriginsForTypeOnFileTaskRunner(
94 FileSystemType type,
95 std::set<GURL>* origins) OVERRIDE;
96 virtual void GetOriginsForHostOnFileTaskRunner(
97 FileSystemType type,
98 const std::string& host,
99 std::set<GURL>* origins) OVERRIDE;
100 virtual int64 GetOriginUsageOnFileTaskRunner(
101 FileSystemContext* context,
102 const GURL& origin_url,
103 FileSystemType type) OVERRIDE;
104 virtual scoped_refptr<QuotaReservation>
105 CreateQuotaReservationOnFileTaskRunner(
106 const GURL& origin_url,
107 FileSystemType type) OVERRIDE;
108 virtual void AddFileUpdateObserver(
109 FileSystemType type,
110 FileUpdateObserver* observer,
111 base::SequencedTaskRunner* task_runner) OVERRIDE;
112 virtual void AddFileChangeObserver(
113 FileSystemType type,
114 FileChangeObserver* observer,
115 base::SequencedTaskRunner* task_runner) OVERRIDE;
116 virtual void AddFileAccessObserver(
117 FileSystemType type,
118 FileAccessObserver* observer,
119 base::SequencedTaskRunner* task_runner) OVERRIDE;
120 virtual const UpdateObserverList* GetUpdateObservers(
121 FileSystemType type) const OVERRIDE;
122 virtual const ChangeObserverList* GetChangeObservers(
123 FileSystemType type) const OVERRIDE;
124 virtual const AccessObserverList* GetAccessObservers(
125 FileSystemType type) const OVERRIDE;
126
127 private:
128 friend class content::PluginPrivateFileSystemBackendTest;
129
130 ObfuscatedFileUtil* obfuscated_file_util();
131 const base::FilePath& base_path() const { return base_path_; }
132
133 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
134 const FileSystemOptions file_system_options_;
135 const base::FilePath base_path_;
136 scoped_ptr<AsyncFileUtil> file_util_;
137 FileSystemIDToPluginMap* plugin_map_; // Owned by file_util_.
138 base::WeakPtrFactory<PluginPrivateFileSystemBackend> weak_factory_;
139
140 DISALLOW_COPY_AND_ASSIGN(PluginPrivateFileSystemBackend);
141 };
142
143 } // namespace fileapi
144
145 #endif // WEBKIT_BROWSER_FILEAPI_PLUGIN_PRIVATE_FILE_SYSTEM_BACKEND_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/open_file_system_mode.h ('k') | webkit/browser/fileapi/plugin_private_file_system_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698