OLD | NEW |
---|---|
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_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_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_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/platform_file.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/fileapi/task_runner_bound_observer_list.h" | |
17 #include "webkit/browser/webkit_storage_browser_export.h" | 18 #include "webkit/browser/webkit_storage_browser_export.h" |
18 #include "webkit/common/fileapi/file_system_types.h" | 19 #include "webkit/common/fileapi/file_system_types.h" |
19 | 20 |
20 class GURL; | 21 class GURL; |
21 | 22 |
22 namespace webkit_blob { | 23 namespace webkit_blob { |
23 class FileStreamReader; | 24 class FileStreamReader; |
24 } | 25 } |
25 | 26 |
26 namespace fileapi { | 27 namespace fileapi { |
(...skipping 18 matching lines...) Expand all Loading... | |
45 public: | 46 public: |
46 // Callback for OpenFileSystem. | 47 // Callback for OpenFileSystem. |
47 typedef base::Callback<void(base::PlatformFileError error)> | 48 typedef base::Callback<void(base::PlatformFileError error)> |
48 OpenFileSystemCallback; | 49 OpenFileSystemCallback; |
49 virtual ~FileSystemMountPointProvider() {} | 50 virtual ~FileSystemMountPointProvider() {} |
50 | 51 |
51 // Returns true if this mount point provider can handle |type|. | 52 // Returns true if this mount point provider can handle |type|. |
52 // One mount point provider may be able to handle multiple filesystem types. | 53 // One mount point provider may be able to handle multiple filesystem types. |
53 virtual bool CanHandleType(FileSystemType type) const = 0; | 54 virtual bool CanHandleType(FileSystemType type) const = 0; |
54 | 55 |
56 // Returns the root URI for the given |origin_url| and |type|. It is ok to | |
57 // return an empty GURL if this mount point provider cannot handle |type|. | |
58 virtual GURL GetRootURI(const GURL& origin_url, | |
59 FileSystemType type) const = 0; | |
kinuko
2013/07/08 12:31:20
I don't think this is necessary here. (Please see
nhiroki
2013/07/22 04:34:14
Removed.
| |
60 | |
55 // Initializes the filesystem for the given |origin_url| and |type|. | 61 // Initializes the filesystem for the given |origin_url| and |type|. |
56 // This verifies if it is allowed to request (or create) the filesystem | 62 // This verifies if it is allowed to request (or create) the filesystem |
57 // and if it can access (or create) the root directory of the mount point. | 63 // and if it can access (or create) the root directory of the mount point. |
58 // If |mode| is CREATE_IF_NONEXISTENT calling this may also create | 64 // If |mode| is CREATE_IF_NONEXISTENT calling this may also create |
59 // the root directory (and/or related database entries etc) for | 65 // the root directory (and/or related database entries etc) for |
60 // the filesystem if it doesn't exist. | 66 // the filesystem if it doesn't exist. |
61 virtual void OpenFileSystem( | 67 virtual void OpenFileSystem( |
62 const GURL& origin_url, | 68 const GURL& origin_url, |
63 FileSystemType type, | 69 FileSystemType type, |
64 OpenFileSystemMode mode, | 70 OpenFileSystemMode mode, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 // This method itself does *not* check if the given path exists and is a | 114 // This method itself does *not* check if the given path exists and is a |
109 // regular file. | 115 // regular file. |
110 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( | 116 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( |
111 const FileSystemURL& url, | 117 const FileSystemURL& url, |
112 int64 offset, | 118 int64 offset, |
113 FileSystemContext* context) const = 0; | 119 FileSystemContext* context) const = 0; |
114 | 120 |
115 // Returns the specialized FileSystemQuotaUtil for this mount point. | 121 // Returns the specialized FileSystemQuotaUtil for this mount point. |
116 // This could return NULL if this mount point does not support quota. | 122 // This could return NULL if this mount point does not support quota. |
117 virtual FileSystemQuotaUtil* GetQuotaUtil() = 0; | 123 virtual FileSystemQuotaUtil* GetQuotaUtil() = 0; |
124 | |
125 // Returns the update observers for this mount point. This could return NULL | |
126 // if update observer is not available in this mount point. | |
127 virtual const UpdateObserverList* GetUpdateObservers( | |
128 FileSystemType type) const = 0; | |
kinuko
2013/07/08 12:31:20
Can we move this method out of FileSystemMountPoin
nhiroki
2013/07/22 04:34:14
Done in http://crrev.com/211332/
| |
118 }; | 129 }; |
119 | 130 |
120 // An interface to control external file system access permissions. | 131 // An interface to control external file system access permissions. |
121 class ExternalFileSystemMountPointProvider | 132 class ExternalFileSystemMountPointProvider |
122 : public FileSystemMountPointProvider { | 133 : public FileSystemMountPointProvider { |
123 public: | 134 public: |
124 // Returns true if |url| is allowed to be accessed. | 135 // Returns true if |url| is allowed to be accessed. |
125 // This is supposed to perform ExternalFileSystem-specific security | 136 // This is supposed to perform ExternalFileSystem-specific security |
126 // checks. | 137 // checks. |
127 virtual bool IsAccessAllowed(const fileapi::FileSystemURL& url) const = 0; | 138 virtual bool IsAccessAllowed(const fileapi::FileSystemURL& url) const = 0; |
(...skipping 13 matching lines...) Expand all Loading... | |
141 const std::string& extension_id) = 0; | 152 const std::string& extension_id) = 0; |
142 // Gets virtual path by known filesystem path. Returns false when filesystem | 153 // Gets virtual path by known filesystem path. Returns false when filesystem |
143 // path is not exposed by this provider. | 154 // path is not exposed by this provider. |
144 virtual bool GetVirtualPath(const base::FilePath& file_system_path, | 155 virtual bool GetVirtualPath(const base::FilePath& file_system_path, |
145 base::FilePath* virtual_path) = 0; | 156 base::FilePath* virtual_path) = 0; |
146 }; | 157 }; |
147 | 158 |
148 } // namespace fileapi | 159 } // namespace fileapi |
149 | 160 |
150 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ | 161 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ |
OLD | NEW |