Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // 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 ownerships of |drive_delegate| and |file_system_provider_delegate| are | 73 // The ownerships of |drive_delegate| and |file_system_provider_delegate| are |
| 74 // also taken. | 74 // also taken. |
| 75 FileSystemBackend( | 75 FileSystemBackend(FileSystemBackendDelegate* drive_delegate, |
|
Luis Héctor Chávez
2016/10/25 17:15:47
Can you clearly document (in code) what pointers w
hashimoto
2016/10/26 05:23:12
Done.
| |
| 76 FileSystemBackendDelegate* drive_delegate, | 76 FileSystemBackendDelegate* file_system_provider_delegate, |
| 77 FileSystemBackendDelegate* file_system_provider_delegate, | 77 FileSystemBackendDelegate* mtp_delegate, |
| 78 FileSystemBackendDelegate* mtp_delegate, | 78 FileSystemBackendDelegate* arc_content_delegate, |
| 79 scoped_refptr<storage::ExternalMountPoints> mount_points, | 79 scoped_refptr<storage::ExternalMountPoints> mount_points, |
| 80 storage::ExternalMountPoints* system_mount_points); | 80 storage::ExternalMountPoints* system_mount_points); |
| 81 ~FileSystemBackend() override; | 81 ~FileSystemBackend() override; |
| 82 | 82 |
| 83 // Adds system mount points, such as "archive", and "removable". This | 83 // Adds system mount points, such as "archive", and "removable". This |
| 84 // function is no-op if these mount points are already present. | 84 // function is no-op if these mount points are already present. |
| 85 void AddSystemMountPoints(); | 85 void AddSystemMountPoints(); |
| 86 | 86 |
| 87 // Returns true if CrosMountpointProvider can handle |url|, i.e. its | 87 // Returns true if CrosMountpointProvider can handle |url|, i.e. its |
| 88 // file system type matches with what this provider supports. | 88 // file system type matches with what this provider supports. |
| 89 // This could be called on any threads. | 89 // This could be called on any threads. |
| 90 static bool CanHandleURL(const storage::FileSystemURL& url); | 90 static bool CanHandleURL(const storage::FileSystemURL& url); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 | 148 |
| 149 // The delegate instance for the drive file system related operations. | 149 // The delegate instance for the drive file system related operations. |
| 150 std::unique_ptr<FileSystemBackendDelegate> drive_delegate_; | 150 std::unique_ptr<FileSystemBackendDelegate> drive_delegate_; |
| 151 | 151 |
| 152 // The delegate instance for the provided file system related operations. | 152 // The delegate instance for the provided file system related operations. |
| 153 std::unique_ptr<FileSystemBackendDelegate> file_system_provider_delegate_; | 153 std::unique_ptr<FileSystemBackendDelegate> file_system_provider_delegate_; |
| 154 | 154 |
| 155 // The delegate instance for the MTP file system related operations. | 155 // The delegate instance for the MTP file system related operations. |
| 156 std::unique_ptr<FileSystemBackendDelegate> mtp_delegate_; | 156 std::unique_ptr<FileSystemBackendDelegate> mtp_delegate_; |
| 157 | 157 |
| 158 // The delegate instance for the ARC content file system related operations. | |
| 159 std::unique_ptr<FileSystemBackendDelegate> arc_content_delegate_; | |
| 160 | |
| 158 // Mount points specific to the owning context (i.e. per-profile mount | 161 // Mount points specific to the owning context (i.e. per-profile mount |
| 159 // points). | 162 // points). |
| 160 // | 163 // |
| 161 // It is legal to have mount points with the same name as in | 164 // 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 | 165 // system_mount_points_. Also, mount point paths may overlap with mount point |
| 163 // paths in system_mount_points_. In both cases mount points in | 166 // paths in system_mount_points_. In both cases mount points in |
| 164 // |mount_points_| will have a priority. | 167 // |mount_points_| will have a priority. |
| 165 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and | 168 // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and |
| 166 // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths| | 169 // |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 | 170 // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from |
| 168 // |mount_points_| will be used). | 171 // |mount_points_| will be used). |
| 169 scoped_refptr<storage::ExternalMountPoints> mount_points_; | 172 scoped_refptr<storage::ExternalMountPoints> mount_points_; |
| 170 | 173 |
| 171 // Globally visible mount points. System MountPonts instance should outlive | 174 // Globally visible mount points. System MountPonts instance should outlive |
| 172 // all FileSystemBackend instances, so raw pointer is safe. | 175 // all FileSystemBackend instances, so raw pointer is safe. |
| 173 storage::ExternalMountPoints* system_mount_points_; | 176 storage::ExternalMountPoints* system_mount_points_; |
| 174 | 177 |
| 175 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); | 178 DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); |
| 176 }; | 179 }; |
| 177 | 180 |
| 178 } // namespace chromeos | 181 } // namespace chromeos |
| 179 | 182 |
| 180 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ | 183 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ |
| OLD | NEW |