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 CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // | 63 // |
64 // filesystem:<origin>/external/<mount_name>/... | 64 // filesystem:<origin>/external/<mount_name>/... |
65 // | 65 // |
66 class FileSystemBackend : public fileapi::ExternalFileSystemBackend { | 66 class FileSystemBackend : public fileapi::ExternalFileSystemBackend { |
67 public: | 67 public: |
68 using fileapi::FileSystemBackend::OpenFileSystemCallback; | 68 using fileapi::FileSystemBackend::OpenFileSystemCallback; |
69 | 69 |
70 // FileSystemBackend will take an ownership of a |mount_points| | 70 // FileSystemBackend will take an ownership of a |mount_points| |
71 // reference. On the other hand, |system_mount_points| will be kept as a raw | 71 // reference. On the other hand, |system_mount_points| will be kept as a raw |
72 // pointer and it should outlive FileSystemBackend instance. | 72 // pointer and it should outlive FileSystemBackend instance. |
73 // The ownership of |drive_delegate| is also taken. | 73 // The ownerships of |drive_delegate| and |file_system_provider_delegate| are |
| 74 // also taken. |
74 FileSystemBackend( | 75 FileSystemBackend( |
75 FileSystemBackendDelegate* drive_delegate, | 76 FileSystemBackendDelegate* drive_delegate, |
| 77 FileSystemBackendDelegate* file_system_provider_delegate, |
76 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, | 78 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
77 scoped_refptr<fileapi::ExternalMountPoints> mount_points, | 79 scoped_refptr<fileapi::ExternalMountPoints> mount_points, |
78 fileapi::ExternalMountPoints* system_mount_points); | 80 fileapi::ExternalMountPoints* system_mount_points); |
79 virtual ~FileSystemBackend(); | 81 virtual ~FileSystemBackend(); |
80 | 82 |
81 // Adds system mount points, such as "archive", and "removable". This | 83 // Adds system mount points, such as "archive", and "removable". This |
82 // function is no-op if these mount points are already present. | 84 // function is no-op if these mount points are already present. |
83 void AddSystemMountPoints(); | 85 void AddSystemMountPoints(); |
84 | 86 |
85 // Returns true if CrosMountpointProvider can handle |url|, i.e. its | 87 // Returns true if CrosMountpointProvider can handle |url|, i.e. its |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 virtual void RevokeAccessForExtension( | 130 virtual void RevokeAccessForExtension( |
129 const std::string& extension_id) OVERRIDE; | 131 const std::string& extension_id) OVERRIDE; |
130 virtual bool GetVirtualPath(const base::FilePath& filesystem_path, | 132 virtual bool GetVirtualPath(const base::FilePath& filesystem_path, |
131 base::FilePath* virtual_path) OVERRIDE; | 133 base::FilePath* virtual_path) OVERRIDE; |
132 | 134 |
133 private: | 135 private: |
134 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 136 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
135 scoped_ptr<FileAccessPermissions> file_access_permissions_; | 137 scoped_ptr<FileAccessPermissions> file_access_permissions_; |
136 scoped_ptr<fileapi::AsyncFileUtil> local_file_util_; | 138 scoped_ptr<fileapi::AsyncFileUtil> local_file_util_; |
137 | 139 |
138 // The Delegate instance for the drive file system related operation. | 140 // The delegate instance for the drive file system related operations. |
139 scoped_ptr<FileSystemBackendDelegate> drive_delegate_; | 141 scoped_ptr<FileSystemBackendDelegate> drive_delegate_; |
140 | 142 |
| 143 // The delegate instance for the provided file system related operations. |
| 144 scoped_ptr<FileSystemBackendDelegate> file_system_provider_delegate_; |
| 145 |
141 // Mount points specific to the owning context (i.e. per-profile mount | 146 // Mount points specific to the owning context (i.e. per-profile mount |
142 // points). | 147 // points). |
143 // | 148 // |
144 // It is legal to have mount points with the same name as in | 149 // It is legal to have mount points with the same name as in |
145 // system_mount_points_. Also, mount point paths may overlap with mount point | 150 // system_mount_points_. Also, mount point paths may overlap with mount point |
146 // paths in system_mount_points_. In both cases mount points in | 151 // paths in system_mount_points_. In both cases mount points in |
147 // |mount_points_| will have a priority. | 152 // |mount_points_| will have a priority. |
148 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and | 153 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and |
149 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| | 154 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| |
150 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from | 155 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from |
151 // |mount_points_| will be used). | 156 // |mount_points_| will be used). |
152 scoped_refptr<fileapi::ExternalMountPoints> mount_points_; | 157 scoped_refptr<fileapi::ExternalMountPoints> mount_points_; |
153 | 158 |
154 // Globally visible mount points. System MountPonts instance should outlive | 159 // Globally visible mount points. System MountPonts instance should outlive |
155 // all FileSystemBackend instances, so raw pointer is safe. | 160 // all FileSystemBackend instances, so raw pointer is safe. |
156 fileapi::ExternalMountPoints* system_mount_points_; | 161 fileapi::ExternalMountPoints* system_mount_points_; |
157 | 162 |
158 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); | 163 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); |
159 }; | 164 }; |
160 | 165 |
161 } // namespace chromeos | 166 } // namespace chromeos |
162 | 167 |
163 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 168 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |