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

Side by Side Diff: webkit/browser/fileapi/file_system_backend.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, 10 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_BACKEND_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/files/file.h"
12 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/platform_file.h"
15 #include "webkit/browser/fileapi/file_permission_policy.h" 15 #include "webkit/browser/fileapi/file_permission_policy.h"
16 #include "webkit/browser/fileapi/open_file_system_mode.h" 16 #include "webkit/browser/fileapi/open_file_system_mode.h"
17 #include "webkit/browser/webkit_storage_browser_export.h" 17 #include "webkit/browser/webkit_storage_browser_export.h"
18 #include "webkit/common/fileapi/file_system_types.h" 18 #include "webkit/common/fileapi/file_system_types.h"
19 19
20 class GURL; 20 class GURL;
21 21
22 namespace webkit_blob { 22 namespace webkit_blob {
23 class FileStreamReader; 23 class FileStreamReader;
24 } 24 }
(...skipping 12 matching lines...) Expand all
37 // An interface for defining a file system backend. 37 // An interface for defining a file system backend.
38 // 38 //
39 // NOTE: when you implement a new FileSystemBackend for your own 39 // NOTE: when you implement a new FileSystemBackend for your own
40 // FileSystem module, please contact to kinuko@chromium.org. 40 // FileSystem module, please contact to kinuko@chromium.org.
41 // 41 //
42 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemBackend { 42 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemBackend {
43 public: 43 public:
44 // Callback for InitializeFileSystem. 44 // Callback for InitializeFileSystem.
45 typedef base::Callback<void(const GURL& root_url, 45 typedef base::Callback<void(const GURL& root_url,
46 const std::string& name, 46 const std::string& name,
47 base::PlatformFileError error)> 47 base::File::Error error)>
48 OpenFileSystemCallback; 48 OpenFileSystemCallback;
49 virtual ~FileSystemBackend() {} 49 virtual ~FileSystemBackend() {}
50 50
51 // Returns true if this filesystem backend can handle |type|. 51 // Returns true if this filesystem backend can handle |type|.
52 // One filesystem backend may be able to handle multiple filesystem types. 52 // One filesystem backend may be able to handle multiple filesystem types.
53 virtual bool CanHandleType(FileSystemType type) const = 0; 53 virtual bool CanHandleType(FileSystemType type) const = 0;
54 54
55 // This method is called right after the backend is registered in the 55 // This method is called right after the backend is registered in the
56 // FileSystemContext and before any other methods are called. Each backend can 56 // FileSystemContext and before any other methods are called. Each backend can
57 // do additional initialization which depends on FileSystemContext here. 57 // do additional initialization which depends on FileSystemContext here.
(...skipping 11 matching lines...) Expand all
69 OpenFileSystemMode mode, 69 OpenFileSystemMode mode,
70 const OpenFileSystemCallback& callback) = 0; 70 const OpenFileSystemCallback& callback) = 0;
71 71
72 // Returns the specialized AsyncFileUtil for this backend. 72 // Returns the specialized AsyncFileUtil for this backend.
73 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) = 0; 73 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) = 0;
74 74
75 // Returns the specialized CopyOrMoveFileValidatorFactory for this backend 75 // Returns the specialized CopyOrMoveFileValidatorFactory for this backend
76 // and |type|. If |error_code| is PLATFORM_FILE_OK and the result is NULL, 76 // and |type|. If |error_code| is PLATFORM_FILE_OK and the result is NULL,
77 // then no validator is required. 77 // then no validator is required.
78 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( 78 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
79 FileSystemType type, base::PlatformFileError* error_code) = 0; 79 FileSystemType type, base::File::Error* error_code) = 0;
80 80
81 // Returns a new instance of the specialized FileSystemOperation for this 81 // Returns a new instance of the specialized FileSystemOperation for this
82 // backend based on the given triplet of |origin_url|, |file_system_type| 82 // backend based on the given triplet of |origin_url|, |file_system_type|
83 // and |virtual_path|. On failure to create a file system operation, set 83 // and |virtual_path|. On failure to create a file system operation, set
84 // |error_code| correspondingly. 84 // |error_code| correspondingly.
85 // This method is usually dispatched by 85 // This method is usually dispatched by
86 // FileSystemContext::CreateFileSystemOperation. 86 // FileSystemContext::CreateFileSystemOperation.
87 virtual FileSystemOperation* CreateFileSystemOperation( 87 virtual FileSystemOperation* CreateFileSystemOperation(
88 const FileSystemURL& url, 88 const FileSystemURL& url,
89 FileSystemContext* context, 89 FileSystemContext* context,
90 base::PlatformFileError* error_code) const = 0; 90 base::File::Error* error_code) const = 0;
91 91
92 // Creates a new file stream reader for a given filesystem URL |url| with an 92 // Creates a new file stream reader for a given filesystem URL |url| with an
93 // offset |offset|. |expected_modification_time| specifies the expected last 93 // offset |offset|. |expected_modification_time| specifies the expected last
94 // modification if the value is non-null, the reader will check the underlying 94 // modification if the value is non-null, the reader will check the underlying
95 // file's actual modification time to see if the file has been modified, and 95 // file's actual modification time to see if the file has been modified, and
96 // if it does any succeeding read operations should fail with 96 // if it does any succeeding read operations should fail with
97 // ERR_UPLOAD_FILE_CHANGED error. 97 // ERR_UPLOAD_FILE_CHANGED error.
98 // This method itself does *not* check if the given path exists and is a 98 // This method itself does *not* check if the given path exists and is a
99 // regular file. 99 // regular file.
100 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( 100 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const std::string& extension_id) = 0; 141 const std::string& extension_id) = 0;
142 // Gets virtual path by known filesystem path. Returns false when filesystem 142 // Gets virtual path by known filesystem path. Returns false when filesystem
143 // path is not exposed by this provider. 143 // path is not exposed by this provider.
144 virtual bool GetVirtualPath(const base::FilePath& file_system_path, 144 virtual bool GetVirtualPath(const base::FilePath& file_system_path,
145 base::FilePath* virtual_path) = 0; 145 base::FilePath* virtual_path) = 0;
146 }; 146 };
147 147
148 } // namespace fileapi 148 } // namespace fileapi
149 149
150 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ 150 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/dragged_file_util.cc ('k') | webkit/browser/fileapi/file_system_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698