| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // | 60 // |
| 61 // These mount points are placed under the "external" namespace, and file | 61 // These mount points are placed under the "external" namespace, and file |
| 62 // system URLs for these mount points look like: | 62 // system URLs for these mount points look like: |
| 63 // | 63 // |
| 64 // filesystem:<origin>/external/<mount_name>/... | 64 // filesystem:<origin>/external/<mount_name>/... |
| 65 // | 65 // |
| 66 class FileSystemBackend : public storage::ExternalFileSystemBackend { | 66 class FileSystemBackend : public storage::ExternalFileSystemBackend { |
| 67 public: | 67 public: |
| 68 using storage::FileSystemBackend::OpenFileSystemCallback; | 68 using storage::FileSystemBackend::OpenFileSystemCallback; |
| 69 | 69 |
| 70 // FileSystemBackend will take an ownership of a |mount_points| | 70 // |system_mount_points| should outlive FileSystemBackend instance. |
| 71 // reference. On the other hand, |system_mount_points| will be kept as a raw | |
| 72 // pointer and it should outlive FileSystemBackend instance. | |
| 73 // The ownerships of |drive_delegate| and |file_system_provider_delegate| are | |
| 74 // also taken. | |
| 75 FileSystemBackend( | 71 FileSystemBackend( |
| 76 FileSystemBackendDelegate* drive_delegate, | 72 std::unique_ptr<FileSystemBackendDelegate> drive_delegate, |
| 77 FileSystemBackendDelegate* file_system_provider_delegate, | 73 std::unique_ptr<FileSystemBackendDelegate> file_system_provider_delegate, |
| 78 FileSystemBackendDelegate* mtp_delegate, | 74 std::unique_ptr<FileSystemBackendDelegate> mtp_delegate, |
| 75 std::unique_ptr<FileSystemBackendDelegate> arc_content_delegate, |
| 79 scoped_refptr<storage::ExternalMountPoints> mount_points, | 76 scoped_refptr<storage::ExternalMountPoints> mount_points, |
| 80 storage::ExternalMountPoints* system_mount_points); | 77 storage::ExternalMountPoints* system_mount_points); |
| 81 ~FileSystemBackend() override; | 78 ~FileSystemBackend() override; |
| 82 | 79 |
| 83 // Adds system mount points, such as "archive", and "removable". This | 80 // Adds system mount points, such as "archive", and "removable". This |
| 84 // function is no-op if these mount points are already present. | 81 // function is no-op if these mount points are already present. |
| 85 void AddSystemMountPoints(); | 82 void AddSystemMountPoints(); |
| 86 | 83 |
| 87 // Returns true if CrosMountpointProvider can handle |url|, i.e. its | 84 // Returns true if CrosMountpointProvider can handle |url|, i.e. its |
| 88 // file system type matches with what this provider supports. | 85 // file system type matches with what this provider supports. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 145 |
| 149 // The delegate instance for the drive file system related operations. | 146 // The delegate instance for the drive file system related operations. |
| 150 std::unique_ptr<FileSystemBackendDelegate> drive_delegate_; | 147 std::unique_ptr<FileSystemBackendDelegate> drive_delegate_; |
| 151 | 148 |
| 152 // The delegate instance for the provided file system related operations. | 149 // The delegate instance for the provided file system related operations. |
| 153 std::unique_ptr<FileSystemBackendDelegate> file_system_provider_delegate_; | 150 std::unique_ptr<FileSystemBackendDelegate> file_system_provider_delegate_; |
| 154 | 151 |
| 155 // The delegate instance for the MTP file system related operations. | 152 // The delegate instance for the MTP file system related operations. |
| 156 std::unique_ptr<FileSystemBackendDelegate> mtp_delegate_; | 153 std::unique_ptr<FileSystemBackendDelegate> mtp_delegate_; |
| 157 | 154 |
| 155 // The delegate instance for the ARC content file system related operations. |
| 156 std::unique_ptr<FileSystemBackendDelegate> arc_content_delegate_; |
| 157 |
| 158 // Mount points specific to the owning context (i.e. per-profile mount | 158 // Mount points specific to the owning context (i.e. per-profile mount |
| 159 // points). | 159 // points). |
| 160 // | 160 // |
| 161 // It is legal to have mount points with the same name as in | 161 // It is legal to have mount points with the same name as in |
| 162 // system_mount_points_. Also, mount point paths may overlap with mount point | 162 // system_mount_points_. Also, mount point paths may overlap with mount point |
| 163 // paths in system_mount_points_. In both cases mount points in | 163 // paths in system_mount_points_. In both cases mount points in |
| 164 // |mount_points_| will have a priority. | 164 // |mount_points_| will have a priority. |
| 165 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and | 165 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and |
| 166 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| | 166 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| |
| 167 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from | 167 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from |
| 168 // |mount_points_| will be used). | 168 // |mount_points_| will be used). |
| 169 scoped_refptr<storage::ExternalMountPoints> mount_points_; | 169 scoped_refptr<storage::ExternalMountPoints> mount_points_; |
| 170 | 170 |
| 171 // Globally visible mount points. System MountPonts instance should outlive | 171 // Globally visible mount points. System MountPonts instance should outlive |
| 172 // all FileSystemBackend instances, so raw pointer is safe. | 172 // all FileSystemBackend instances, so raw pointer is safe. |
| 173 storage::ExternalMountPoints* system_mount_points_; | 173 storage::ExternalMountPoints* system_mount_points_; |
| 174 | 174 |
| 175 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); | 175 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 } // namespace chromeos | 178 } // namespace chromeos |
| 179 | 179 |
| 180 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 180 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
| OLD | NEW |