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

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

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FILE_SYSTEM_CONTEXT_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/file.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
16 #include "base/platform_file.h"
17 #include "base/sequenced_task_runner_helpers.h" 17 #include "base/sequenced_task_runner_helpers.h"
18 #include "webkit/browser/fileapi/file_system_url.h" 18 #include "webkit/browser/fileapi/file_system_url.h"
19 #include "webkit/browser/fileapi/open_file_system_mode.h" 19 #include "webkit/browser/fileapi/open_file_system_mode.h"
20 #include "webkit/browser/fileapi/plugin_private_file_system_backend.h" 20 #include "webkit/browser/fileapi/plugin_private_file_system_backend.h"
21 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" 21 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h"
22 #include "webkit/browser/fileapi/task_runner_bound_observer_list.h" 22 #include "webkit/browser/fileapi/task_runner_bound_observer_list.h"
23 #include "webkit/browser/webkit_storage_browser_export.h" 23 #include "webkit/browser/webkit_storage_browser_export.h"
24 #include "webkit/common/fileapi/file_system_types.h" 24 #include "webkit/common/fileapi/file_system_types.h"
25 25
26 namespace base { 26 namespace base {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // it is not a quota-managed storage. 127 // it is not a quota-managed storage.
128 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const; 128 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const;
129 129
130 // Returns the appropriate AsyncFileUtil instance for the given |type|. 130 // Returns the appropriate AsyncFileUtil instance for the given |type|.
131 AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) const; 131 AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) const;
132 132
133 // Returns the appropriate CopyOrMoveFileValidatorFactory for the given 133 // Returns the appropriate CopyOrMoveFileValidatorFactory for the given
134 // |type|. If |error_code| is PLATFORM_FILE_OK and the result is NULL, 134 // |type|. If |error_code| is PLATFORM_FILE_OK and the result is NULL,
135 // then no validator is required. 135 // then no validator is required.
136 CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( 136 CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
137 FileSystemType type, base::PlatformFileError* error_code) const; 137 FileSystemType type, base::File::Error* error_code) const;
138 138
139 // Returns the file system backend instance for the given |type|. 139 // Returns the file system backend instance for the given |type|.
140 // This may return NULL if it is given an invalid or unsupported filesystem 140 // This may return NULL if it is given an invalid or unsupported filesystem
141 // type. 141 // type.
142 FileSystemBackend* GetFileSystemBackend( 142 FileSystemBackend* GetFileSystemBackend(
143 FileSystemType type) const; 143 FileSystemType type) const;
144 144
145 // Returns true for sandboxed filesystems. Currently this does 145 // Returns true for sandboxed filesystems. Currently this does
146 // the same as GetQuotaUtil(type) != NULL. (In an assumption that 146 // the same as GetQuotaUtil(type) != NULL. (In an assumption that
147 // all sandboxed filesystems must cooperate with QuotaManager so that 147 // all sandboxed filesystems must cooperate with QuotaManager so that
148 // they can get deleted) 148 // they can get deleted)
149 bool IsSandboxFileSystem(FileSystemType type) const; 149 bool IsSandboxFileSystem(FileSystemType type) const;
150 150
151 // Returns observers for the given filesystem type. 151 // Returns observers for the given filesystem type.
152 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const; 152 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const;
153 const AccessObserverList* GetAccessObservers(FileSystemType type) const; 153 const AccessObserverList* GetAccessObservers(FileSystemType type) const;
154 154
155 // Returns all registered filesystem types. 155 // Returns all registered filesystem types.
156 void GetFileSystemTypes(std::vector<FileSystemType>* types) const; 156 void GetFileSystemTypes(std::vector<FileSystemType>* types) const;
157 157
158 // Returns a FileSystemBackend instance for external filesystem 158 // Returns a FileSystemBackend instance for external filesystem
159 // type, which is used only by chromeos for now. This is equivalent to 159 // type, which is used only by chromeos for now. This is equivalent to
160 // calling GetFileSystemBackend(kFileSystemTypeExternal). 160 // calling GetFileSystemBackend(kFileSystemTypeExternal).
161 ExternalFileSystemBackend* external_backend() const; 161 ExternalFileSystemBackend* external_backend() const;
162 162
163 // Used for OpenFileSystem. 163 // Used for OpenFileSystem.
164 typedef base::Callback<void(const GURL& root, 164 typedef base::Callback<void(const GURL& root,
165 const std::string& name, 165 const std::string& name,
166 base::PlatformFileError result)> 166 base::File::Error result)>
167 OpenFileSystemCallback; 167 OpenFileSystemCallback;
168 168
169 // Used for ResolveURL. 169 // Used for ResolveURL.
170 typedef base::Callback<void(base::PlatformFileError result, 170 typedef base::Callback<void(base::File::Error result,
171 const FileSystemInfo& info, 171 const FileSystemInfo& info,
172 const base::FilePath& file_path, 172 const base::FilePath& file_path,
173 bool is_directory)> ResolveURLCallback; 173 bool is_directory)> ResolveURLCallback;
174 174
175 // Used for DeleteFileSystem and OpenPluginPrivateFileSystem. 175 // Used for DeleteFileSystem and OpenPluginPrivateFileSystem.
176 typedef base::Callback<void(base::PlatformFileError result)> StatusCallback; 176 typedef base::Callback<void(base::File::Error result)> StatusCallback;
177 177
178 // Opens the filesystem for the given |origin_url| and |type|, and dispatches 178 // Opens the filesystem for the given |origin_url| and |type|, and dispatches
179 // |callback| on completion. 179 // |callback| on completion.
180 // If |create| is true this may actually set up a filesystem instance 180 // If |create| is true this may actually set up a filesystem instance
181 // (e.g. by creating the root directory or initializing the database 181 // (e.g. by creating the root directory or initializing the database
182 // entry etc). 182 // entry etc).
183 void OpenFileSystem( 183 void OpenFileSystem(
184 const GURL& origin_url, 184 const GURL& origin_url,
185 FileSystemType type, 185 FileSystemType type,
186 OpenFileSystemMode mode, 186 OpenFileSystemMode mode,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 // Creates a new FileSystemOperation instance by getting an appropriate 290 // Creates a new FileSystemOperation instance by getting an appropriate
291 // FileSystemBackend for |url| and calling the backend's corresponding 291 // FileSystemBackend for |url| and calling the backend's corresponding
292 // CreateFileSystemOperation method. 292 // CreateFileSystemOperation method.
293 // The resolved FileSystemBackend could perform further specialization 293 // The resolved FileSystemBackend could perform further specialization
294 // depending on the filesystem type pointed by the |url|. 294 // depending on the filesystem type pointed by the |url|.
295 // 295 //
296 // Called by FileSystemOperationRunner. 296 // Called by FileSystemOperationRunner.
297 FileSystemOperation* CreateFileSystemOperation( 297 FileSystemOperation* CreateFileSystemOperation(
298 const FileSystemURL& url, 298 const FileSystemURL& url,
299 base::PlatformFileError* error_code); 299 base::File::Error* error_code);
300 300
301 // For non-cracked isolated and external mount points, returns a FileSystemURL 301 // For non-cracked isolated and external mount points, returns a FileSystemURL
302 // created by cracking |url|. The url is cracked using MountPoints registered 302 // created by cracking |url|. The url is cracked using MountPoints registered
303 // as |url_crackers_|. If the url cannot be cracked, returns invalid 303 // as |url_crackers_|. If the url cannot be cracked, returns invalid
304 // FileSystemURL. 304 // FileSystemURL.
305 // 305 //
306 // If the original url does not point to an isolated or external filesystem, 306 // If the original url does not point to an isolated or external filesystem,
307 // returns the original url, without attempting to crack it. 307 // returns the original url, without attempting to crack it.
308 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const; 308 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const;
309 309
310 // For initial backend_map construction. This must be called only from 310 // For initial backend_map construction. This must be called only from
311 // the constructor. 311 // the constructor.
312 void RegisterBackend(FileSystemBackend* backend); 312 void RegisterBackend(FileSystemBackend* backend);
313 313
314 void DidOpenFileSystemForResolveURL( 314 void DidOpenFileSystemForResolveURL(
315 const FileSystemURL& url, 315 const FileSystemURL& url,
316 const ResolveURLCallback& callback, 316 const ResolveURLCallback& callback,
317 const GURL& filesystem_root, 317 const GURL& filesystem_root,
318 const std::string& filesystem_name, 318 const std::string& filesystem_name,
319 base::PlatformFileError error); 319 base::File::Error error);
320 320
321 // Returns a FileSystemBackend, used only by test code. 321 // Returns a FileSystemBackend, used only by test code.
322 SandboxFileSystemBackend* sandbox_backend() const { 322 SandboxFileSystemBackend* sandbox_backend() const {
323 return sandbox_backend_.get(); 323 return sandbox_backend_.get();
324 } 324 }
325 325
326 // Used only by test code. 326 // Used only by test code.
327 PluginPrivateFileSystemBackend* plugin_private_backend() const { 327 PluginPrivateFileSystemBackend* plugin_private_backend() const {
328 return plugin_private_backend_.get(); 328 return plugin_private_backend_.get();
329 } 329 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 struct DefaultContextDeleter { 372 struct DefaultContextDeleter {
373 static void Destruct(const FileSystemContext* context) { 373 static void Destruct(const FileSystemContext* context) {
374 context->DeleteOnCorrectThread(); 374 context->DeleteOnCorrectThread();
375 } 375 }
376 }; 376 };
377 377
378 } // namespace fileapi 378 } // namespace fileapi
379 379
380 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ 380 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_backend.h ('k') | webkit/browser/fileapi/file_system_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698